Unit Tests

- Added specific calendar colors to the rc file used in cal.t, so that
  the colors in the tests (which are in the old theme) match the new
  default theme.
This commit is contained in:
Paul Beckingham 2010-07-05 23:36:08 -04:00
parent b3f3261190
commit 25db00e97d

View file

@ -38,6 +38,10 @@ if (open my $fh, '>', 'cal.rc')
print $fh "data.location=.\n", print $fh "data.location=.\n",
"dateformat=YMD\n", "dateformat=YMD\n",
"color=on\n", "color=on\n",
"color.calendar.today=black on cyan\n",
"color.calendar.due=black on green\n",
"color.calendar.weeknumber=black on white\n",
"color.calendar.overdue=black on red\n",
"confirmation=no\n"; "confirmation=no\n";
close $fh; close $fh;
ok (-r 'cal.rc', 'Created cal.rc'); ok (-r 'cal.rc', 'Created cal.rc');
@ -52,14 +56,14 @@ my $nextmonth = $months[($nmon+1) % 12];
my $year = $nyear + 1900; my $year = $nyear + 1900;
my $nextyear = $nyear + 1901; my $nextyear = $nyear + 1901;
if ( $day <= 9) if ($day <= 9)
{ {
$day = " ".$day; $day = " ".$day;
} }
# task cal and task cal y # task cal and task cal y
my $output = qx{../task rc:cal.rc rc._forcecolor:on cal}; my $output = qx{../task rc:cal.rc rc._forcecolor:on cal};
if ( $wday == 6 || $wday == 0) if ($wday == 6 || $wday == 0)
{ {
like ($output, qr/\[30;106m$day/, 'Current day is highlighted'); like ($output, qr/\[30;106m$day/, 'Current day is highlighted');
} }
@ -77,12 +81,12 @@ $output = qx{../task rc:cal.rc rc.weekstart:Monday cal};
like ($output, qr/Fr Sa Su/, 'Week starts on Monday'); like ($output, qr/Fr Sa Su/, 'Week starts on Monday');
$output = qx{../task rc:cal.rc cal y}; $output = qx{../task rc:cal.rc cal y};
like ($output, qr/$month\S*?\s+?$year/, 'Current month and year are displayed'); like ($output, qr/$month\S*?\s+?$year/, 'Current month and year are displayed');
if ( $month eq "Jan") if ($month eq "Jan")
{ {
$nextyear = $nextyear - 1; $nextyear = $nextyear - 1;
} }
like ($output, qr/$prevmonth\S*?\s+?$nextyear/, 'Month and year one year ahead are displayed'); like ($output, qr/$prevmonth\S*?\s+?$nextyear/, 'Month and year one year ahead are displayed');
if ( $month eq "Jan") if ($month eq "Jan")
{ {
$nextyear = $nextyear + 1; $nextyear = $nextyear + 1;
} }