]> git.imager.perl.org - imager.git/commitdiff
- improved missing argument handling a little for the string() method
authorTony Cook <tony@develop=help.com>
Mon, 5 Dec 2005 02:15:47 +0000 (02:15 +0000)
committerTony Cook <tony@develop=help.com>
Mon, 5 Dec 2005 02:15:47 +0000 (02:15 +0000)
t/t35ttfont.t

index 7e2f306728e566bd52f6a4a248d3e90c8247799b..f93c8d22756119a36bb6a754f0fcd53e369d34d6 100644 (file)
@@ -1,7 +1,7 @@
 #!perl -w
 use strict;
 use lib 't';
-use Test::More tests => 65;
+use Test::More tests => 71;
 
 BEGIN { use_ok(Imager => ':all') }
 require "t/testtools.pl";
@@ -230,5 +230,22 @@ SKIP:
          "test error message");
   }
 
+  { # check errstr set correctly
+    my $font = Imager::Font->new(file=>$fontname, type=>'tt',
+                               size => undef);
+    ok($font, "made size error test font");
+    my $im = Imager->new(xsize=>100, ysize=>100);
+    ok($im, "made size error test image");
+    ok(!$im->string(font=>$font, x=>10, 'y'=>50, string=>"Hello"),
+       "drawing should fail with no size");
+    is($im->errstr, "No font size provided", "check error message");
+
+    # try no string
+    ok(!$im->string(font=>$font, x=>10, 'y'=>50, size=>15),
+       "drawing should fail with no string");
+    is($im->errstr, "missing required parameter 'string'",
+       "check error message");
+  }
+
   ok(1, "end of code");
 }