PlotCalendar

 view release on metacpan or  search on metacpan

t/month.t  view on Meta::CPAN

<B><FONT SIZE=+0 COLOR=BLACK > 31 </FONT></B>
<B><I><FONT SIZE=-1 COLOR=BLACK >  </FONT></I></B>
<FONT SIZE=-1 COLOR=BLACK >
  
  </FONT></A></TD>
<TD WIDTH=11 BGCOLOR=#66FFFF>&nbsp;  </TD>
<TD WIDTH=11 BGCOLOR=#66FFFF>&nbsp;  </TD>
<TD WIDTH=11 BGCOLOR=#66FFFF>&nbsp;  </TD>
<TD WIDTH=11 BGCOLOR=#66FFFF>&nbsp;  </TD>
</TR>
<TR>
</TABLE>
TEST2

#---------------------------------------- normal month

	my $month = PlotCalendar::Month->new($mon, $year);

	#	 These are values with default settings, so these are optional

	# global values, to be applied to all cells

	$month -> size(700,700); # width, height in pixels
	$month -> font('14','10','8');
	$month -> cliptext('yes');
	$month -> firstday('Sun'); # First column is Sunday
	$month -> artwork('/home/ajackson/public_html/cgi-bin/Calendar/Calendar_art3/'); 

	#	arrays of values, if not an array, apply to all cells, if an array
	#  apply to each cell, indexed by day-of-month

	my @text;
	my @daynames;
	my @nameref;
	my @bgcolor;
	my @colors = ('WHITE','#33cc00','#FF99FF','#FF7070','#FFB0B0',);
	my (@textcol,@textsize,@textstyle,@textref);
	my @style = ('i','u','b',);
	my @url;


	for (my $i=1;$i<=31;$i++) {
		$daynames[$i] = "Day number $i";
		$nameref[$i] = "<A HREF=\"http://www.$i.ca\">";
		$bgcolor[$i] = $colors[$i%5];
		@{$text[$i]} = ("Text 1 for $i","Second $i text","$i bit of text",);
		@{$textref[$i]} = ("<A HREF=\"http://www.$i.com/\">","Second $i text","<A HREF=\"http://www.$i.net/\">",);
		@{$textcol[$i]} = ($colors[($i+1)%5],$colors[($i+2)%5],$colors[($i+3)%5]);
		@{$textsize[$i]} = ("8","10","8",);
		@{$textstyle[$i]} = @style;
		@style = reverse(@style);
		$url[$i] = '<A href="http://some.org/name_number_' . $i . '">';
	}

	$month -> fgcolor('BLACK',); #  Global foreground color
	$month -> bgcolor(@bgcolor); # Background color per day
	$month -> styles('b','bi','ui',); # Global text styles

	#	Comments

	my @prefs = ('before','after','after');
	my @comments = (['Comment one'],["Comment two","and so on"],['Comment three']);
	my @comcol = qw(b g b);
	my @comstyle = qw(n b bi);
	my @comsize = qw(8 10 14);

	$month->comments(\@prefs,\@comments,\@comcol,\@comstyle,\@comsize);

	$month -> dayname(@daynames);
	$month -> nameref(@nameref);

	$month -> text(@text);
	$month -> textcolor(@textcol);
	$month -> textsize(@textsize);
	$month -> textstyle(@textstyle);
	$month -> textref(@textref);

	my $html = $month -> gethtml;

		if ($html eq $test1) {
		print "ok 1\n";
	}
	else {
		print "not ok 1\n";
	}

#---------------------------------------- tiny month

	my $tinymonth = PlotCalendar::Month->new($mon, $year);

	#	 These are values with default settings, so these are optional

	# global values, to be applied to all cells

	$tinymonth -> size(80,80); # width, height in pixels
	$tinymonth -> font('8','6','6');
	$tinymonth -> cliptext('yes');
	$tinymonth -> firstday('Sun'); # First column is Sunday

	#	arrays of values, if not an array, apply to all cells, if an array
	#  apply to each cell, indexed by day-of-month

	@colors = ('WHITE','#33cc00','#FF99FF','#FF7070','#FFB0B0',);

	for (my $i=1;$i<=31;$i++) {
		$nameref[$i] = "<A HREF=\"http://www.$i.ca\">";
		$bgcolor[$i] = $colors[$i%5];
		$url[$i] = '<A href="http://some.org/name_number_' . $i . '">';
	}

	$tinymonth -> fgcolor('BLACK',); #  Global foreground color
	$tinymonth -> bgcolor(@bgcolor); # Background color per day

	$tinymonth -> htmlref(@url);
	$tinymonth -> monthref('<A HREF="http://www.lookithere.org/the_whole_month">');

	#	So, what do we have now?

	$html = $tinymonth -> gethtml;

		if ($html eq $test2) {
		print "ok 2\n";
	}
	else {
		print "not ok 2\n";
	}



( run in 0.643 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )