]> git.imager.perl.org - imager.git/blobdiff - t/t21draw.t
prefer static first
[imager.git] / t / t21draw.t
index 28b62bbb74cc16e04f8c7aab906d37229ae14350..a1f7f2ab71278c26b554a446465d49534e4e788d 100644 (file)
@@ -1,10 +1,12 @@
 #!perl -w
 use strict;
-use Test::More tests => 250;
+use Test::More tests => 256;
 use Imager ':all';
 use Imager::Test qw(is_color3 is_image);
 use constant PI => 3.14159265358979;
 
+-d "testout" or mkdir "testout";
+
 init_log("testout/t21draw.log",1);
 
 my $redobj = NC(255, 0, 0);
@@ -295,21 +297,26 @@ my $white = '#FFFFFF';
   }
 }
 
-{ # flood_fill wouldn't fill to the right if the area was just a 
-  # single scan-line
-  my $im = Imager->new(xsize => 5, ysize => 3);
-  ok($im, "make flood_fill test image");
-  ok($im->line(x1 => 0, y1 => 1, x2 => 4, y2 => 1, color => "white"),
-     "create fill area");
-  ok($im->flood_fill(x => 3, y => 1, color => "blue"),
-     "fill it");
-  my $cmp = Imager->new(xsize => 5, ysize => 3);
-  ok($cmp, "make test image");
-  ok($cmp->line(x1 => 0, y1 => 1, x2 => 4, y2 => 1, color => "blue"),
-     "synthezied filled area");
-  is_image($im, $cmp, "flood_fill filled horizontal line");
+{
+  my $empty = Imager->new;
+  ok(!$empty->box(), "can't draw box to empty image");
+  is($empty->errstr, "box: empty input image", "check error message");
+  ok(!$empty->arc(), "can't draw arc to empty image");
+  is($empty->errstr, "arc: empty input image", "check error message");
+  ok(!$empty->line(x1 => 0, y1 => 0, x2 => 10, y2 => 0),
+     "can't draw line to empty image");
+  is($empty->errstr, "line: empty input image", "check error message");
+  ok(!$empty->polyline(points => [ [ 0, 0 ], [ 10, 0 ] ]),
+     "can't draw polyline to empty image");
+  is($empty->errstr, "polyline: empty input image", "check error message");
+  ok(!$empty->polygon(points => [ [ 0, 0 ], [ 10, 0 ], [ 0, 10 ] ]),
+     "can't draw polygon to empty image");
+  is($empty->errstr, "polygon: empty input image", "check error message");
+  ok(!$empty->flood_fill(x => 0, y => 0), "can't flood fill to empty image");
+  is($empty->errstr, "flood_fill: empty input image", "check error message");
 }
 
+
 malloc_state();
 
 unless ($ENV{IMAGER_KEEP_FILES}) {