]> git.imager.perl.org - imager.git/blobdiff - t/t62compose.t
prefer static first
[imager.git] / t / t62compose.t
index d7e415bd26887b95bb9f767657fbd4adc4735ede..cbf8af307e990d630161afa45e90fd252c5ed8c7 100644 (file)
@@ -1,7 +1,7 @@
 #!perl -w
 use strict;
 use Imager qw(:handy);
-use Test::More tests => 114;
+use Test::More tests => 120;
 use Imager::Test qw(is_image is_imaged);
 
 -d "testout" or mkdir "testout";
@@ -239,6 +239,21 @@ for my $type_id (sort keys %types) {
   }
 }
 
+{
+  my $empty = Imager->new;
+  my $good = Imager->new(xsize => 1, ysize => 1);
+  ok(!$empty->compose(src => $good), "can't compose to empty image");
+  is($empty->errstr, "compose: empty input image",
+     "check error message");
+  ok(!$good->compose(src => $empty), "can't compose from empty image");
+  is($good->errstr, "compose: empty input image (for src)",
+     "check error message");
+  ok(!$good->compose(src => $good, mask => $empty),
+     "can't compose with empty mask");
+  is($good->errstr, "compose: empty input image (for mask)",
+     "check error message");
+}
+
 unless ($ENV{IMAGER_KEEP_FILES}) {
   unlink @files;
 }