[rt #87338] Imager::Font::Wrap no longer requires the image parameter
authorTony Cook <tony@develop-help.com>
Mon, 30 Sep 2013 04:01:40 +0000 (14:01 +1000)
committerTony Cook <tony@develop-help.com>
Mon, 30 Sep 2013 04:01:40 +0000 (14:01 +1000)
Changes
lib/Imager/Font/Wrap.pm
t/350-font/100-texttools.t

diff --git a/Changes b/Changes
index 6ec27a5b096e78e0184f20db34430faa72dd54c9..b335370aa62517efdd0a5f2744dfcb7bcfd20c9e 100644 (file)
--- a/Changes
+++ b/Changes
@@ -15,6 +15,9 @@ Imager release history.  Older releases can be found in Changes.old
    truncated early.
    https://rt.cpan.org/Ticket/Display.html?id=88993
 
+ - Imager::Font::Wrap no longer requires the image parameter.
+   https://rt.cpan.org/Ticket/Display.html?id=87338
+
 Imager 0.97 - 15 Jul 2013
 ===========
 
index 4bca828734b94a5b7a6b9ccacf6902a3c26c314d..a1f8130172f553ec1f0039e670d5a0347e81e239 100644 (file)
@@ -4,7 +4,7 @@ use Imager;
 use Imager::Font;
 use vars qw($VERSION);
 
-$VERSION = "1.003";
+$VERSION = "1.004";
 
 *_first = \&Imager::Font::_first;
 
@@ -89,8 +89,6 @@ sub wrap_text {
   # try to get something useful
   my $x = _first(delete $input{'x'}, 0);
   my $y = _first(delete $input{'y'}, 0);
-  exists $input{image}
-    or return Imager->_set_error('No image parameter supplied');
   my $im = delete $input{image};
   my $imerr = $im || 'Imager';
   my $width = delete $input{width};
@@ -286,7 +284,7 @@ will be stored into the scalar this refers to.
 =item *
 
 C<image> - The image to render the text to.  Can be supplied as
-C<undef> to simply calculate the bounding box.
+C<undef> or not provided to simply calculate the bounding box.
 
 =item *
 
index b685c7c3d5e419d0fb51521632e1988e681cedc0..2789af1a179806bdca856adaee65628cc108a3a6 100644 (file)
@@ -1,6 +1,6 @@
 #!perl -w
 use strict;
-use Test::More tests => 13;
+use Test::More tests => 14;
 
 BEGIN { use_ok('Imager') }
 
@@ -39,7 +39,7 @@ my $font = Imager::Font->new(file=>$fontfile);
 SKIP:
 {
   $Imager::formats{'tt'} || $Imager::formats{'ft2'}
-      or skip("Need Freetype 1.x or 2.x to test", 11);
+      or skip("Need Freetype 1.x or 2.x to test", 12);
 
   ok($font, "loading font")
     or skip("Could not load test font", 8);
@@ -64,6 +64,14 @@ SKIP:
                                 justify=>'left',
                                 color=>'FFFFFF'),
       "no image test");
+  ok(scalar Imager::Font::Wrap->wrap_text(string => $text,
+                                font=>$font,
+                                size=>13,
+                                width => 380,
+                                x=>10, 'y'=>10,
+                                justify=>'left',
+                                color=>'FFFFFF'),
+      "no image parameter test");
   my $bbox = $font->bounding_box(string=>"Xx", size=>13);
   ok($bbox, "get height for check");