]> git.imager.perl.org - imager.git/blobdiff - t/t31font.t
consistently use _valid_image() internally to ensure image validity
[imager.git] / t / t31font.t
index b26648596a8a0a37ed0319fc4ddf9cef0fa2fd5d..0d1bd65b6242c4f06e8c744ab1253d913fdf8802 100644 (file)
@@ -1,7 +1,7 @@
 #!perl -w
 use strict;
 use Imager;
-use Test::More tests => 10;
+use Test::More tests => 14;
 
 unshift @INC, "t";
 
@@ -40,3 +40,20 @@ SKIP:
     or skip("Failed to load", 1);
   ok($good->isa("GoodTestFont"), "and it's the right type");
 }
+
+
+use Imager::Font::Test;
+
+# check string() and align_string() handle an empty image
+{
+  my $font = Imager::Font::Test->new;
+  my $empty = Imager->new;
+  ok(!$empty->string(text => "foo", x => 0, y => 10, size => 10, font => $font),
+     "can't draw text on an empty image");
+  is($empty->errstr, "string: empty input image",
+     "check error message");
+  ok(!$empty->align_string(text => "foo", x => 0, y => 10, size => 10, font => $font),
+     "can't draw text on an empty image");
+  is($empty->errstr, "align_string: empty input image",
+     "check error message");
+}