From d6f4e9648ea286895dd02aa0186e59a3cdc12233 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Mon, 30 Sep 2013 14:01:40 +1000 Subject: [PATCH] [rt #87338] Imager::Font::Wrap no longer requires the image parameter --- Changes | 3 +++ lib/Imager/Font/Wrap.pm | 6 ++---- t/350-font/100-texttools.t | 12 ++++++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Changes b/Changes index 6ec27a5b..b335370a 100644 --- 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 =========== diff --git a/lib/Imager/Font/Wrap.pm b/lib/Imager/Font/Wrap.pm index 4bca8287..a1f81301 100644 --- a/lib/Imager/Font/Wrap.pm +++ b/lib/Imager/Font/Wrap.pm @@ -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 - The image to render the text to. Can be supplied as -C to simply calculate the bounding box. +C or not provided to simply calculate the bounding box. =item * diff --git a/t/350-font/100-texttools.t b/t/350-font/100-texttools.t index b685c7c3..2789af1a 100644 --- a/t/350-font/100-texttools.t +++ b/t/350-font/100-texttools.t @@ -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"); -- 2.39.5