From Patrick Michaud:
authorpmichaud <pmichaud@pobox.com>
Fri, 17 Apr 2009 00:04:43 +0000 (00:04 +0000)
committerTony Cook <tony@develop-help.com>
Fri, 17 Apr 2009 00:04:43 +0000 (00:04 +0000)
Here you go - tests for warnings, and a fix:

lib/Imager/Graph/Vertical.pm
t/t11line.t
t/t12column.t
t/t13stacked_col.t

index ee6ccb8e7f06d4808302eaa7ac55dddf81be19ea..f667fc4d428dae8ccc444a001cc13f3d1edf2d40 100644 (file)
@@ -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 {
index 09fb7e920e53c111c020804a0ae8be5c075fa80c..89f6ccabb479381c398e3cb15aebe193b60cca06 100644 (file)
@@ -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;
+}
index abdb88cc4f34091fd8633476a3071a22659d1f33..b686dcb413199cd99529e11246b6fca3854f6551 100644 (file)
@@ -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;
+}
index 34c378168cfb929d20a74e1314c40980322158b0..c9cdf131cde3b80fd5929949cc1563f30e7dbb64 100644 (file)
@@ -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;
+}