From: pmichaud Date: Fri, 17 Apr 2009 00:04:43 +0000 (+0000) Subject: From Patrick Michaud: X-Git-Tag: v0.07~9 X-Git-Url: http://git.imager.perl.org/imager-graph.git/commitdiff_plain/28acfd43fac4bddd04490be15e227a723ab9e94d From Patrick Michaud: Here you go - tests for warnings, and a fix: --- diff --git a/lib/Imager/Graph/Vertical.pm b/lib/Imager/Graph/Vertical.pm index ee6ccb8..f667fc4 100644 --- a/lib/Imager/Graph/Vertical.pm +++ b/lib/Imager/Graph/Vertical.pm @@ -804,7 +804,7 @@ sub set_y_tics { } sub _get_y_tics { - return $_[0]->{'y_tics'}; + return $_[0]->{'y_tics'} || 0; } sub _remove_tics_from_chart_box { diff --git a/t/t11line.t b/t/t11line.t index 09fb7e9..89f6cca 100644 --- a/t/t11line.t +++ b/t/t11line.t @@ -11,9 +11,17 @@ use Test::More; ++$|; +my @warned; +local $SIG{__WARN__} = + sub { + print STDERR $_[0]; + push @warned, $_[0] + }; + + use Imager qw(:handy); -plan tests => 2; +plan tests => 3; #my $fontfile = 'ImUgly.ttf'; #my $font = Imager::Font->new(file=>$fontfile, type => 'ft2', aa=>1) @@ -34,4 +42,6 @@ ok($img1, "drawing line chart"); $img1->write(file=>'testout/t11_basic.ppm') or die "Can't save img1: ".$img1->errstr."\n"; - +unless (is(@warned, 0, "should be no warnings")) { + diag($_) for @warned; +} diff --git a/t/t12column.t b/t/t12column.t index abdb88c..b686dcb 100644 --- a/t/t12column.t +++ b/t/t12column.t @@ -13,7 +13,15 @@ use Test::More; use Imager qw(:handy); -plan tests => 2; +plan tests => 3; + +my @warned; +local $SIG{__WARN__} = + sub { + print STDERR $_[0]; + push @warned, $_[0] + }; + #my $fontfile = 'ImUgly.ttf'; #my $font = Imager::Font->new(file=>$fontfile, type => 'ft2', aa=>1) @@ -34,4 +42,6 @@ ok($img1, "drawing column chart"); $img1->write(file=>'testout/t12_basic.ppm') or die "Can't save img1: ".$img1->errstr."\n"; - +unless (is(@warned, 0, "should be no warnings")) { + diag($_) for @warned; +} diff --git a/t/t13stacked_col.t b/t/t13stacked_col.t index 34c3781..c9cdf13 100644 --- a/t/t13stacked_col.t +++ b/t/t13stacked_col.t @@ -13,7 +13,15 @@ use Test::More; use Imager qw(:handy); -plan tests => 2; +plan tests => 3; + +my @warned; +local $SIG{__WARN__} = + sub { + print STDERR $_[0]; + push @warned, $_[0] + }; + #my $fontfile = 'ImUgly.ttf'; #my $font = Imager::Font->new(file=>$fontfile, type => 'ft2', aa=>1) @@ -35,3 +43,6 @@ ok($img1, "drawing stacked_col chart"); $img1->write(file=>'testout/t13_basic.ppm') or die "Can't save img1: ".$img1->errstr."\n"; +unless (is(@warned, 0, "should be no warnings")) { + diag($_) for @warned; +}