]> git.imager.perl.org - imager.git/commitdiff
RT 58761: fix Imager->new(data => $data)
authorTony Cook <tony@develop=help.com>
Mon, 28 Jun 2010 09:43:20 +0000 (09:43 +0000)
committerTony Cook <tony@develop=help.com>
Mon, 28 Jun 2010 09:43:20 +0000 (09:43 +0000)
Changes
Imager.pm
t/t104ppm.t

diff --git a/Changes b/Changes
index da01f680794750a90079950ff16bf5a4367d8766..32f1569e203eebfa15b2d900aaad05b1a83895b9 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,15 @@
 Imager release history.  Older releases can be found in Changes.old
 
-Imager 0.75
+Imager 0.76
+===========
+
+Bugs:
+
+ - Imager->new(data => $data) didn't try to process image file data in
+   $data
+   https://rt.cpan.org/Ticket/Display.html?id=58761
+
+Imager 0.75 - 20 Jun 2010
 ===========
 
  - use PERL_NO_GET_CONTEXT to slightly improve performance on threaded
index 458d69497d7a82b4830b81e702599f6a1ca4d128..1cc70d724c8e9c8b45814d994dffdd873d7bca46 100644 (file)
--- a/Imager.pm
+++ b/Imager.pm
@@ -644,7 +644,8 @@ sub new {
         defined $hsh{fh} ||
         defined $hsh{fd} ||
         defined $hsh{callback} ||
-        defined $hsh{readcb}) {
+        defined $hsh{readcb} ||
+        defined $hsh{data}) {
     # allow $img = Imager->new(file => $filename)
     my %extras;
     
index dc7ddb287b643a8291b12a70ec25cc54cfee5449..a72dc22a0cd94c20611712a32bd178621f5feae4 100644 (file)
@@ -1,6 +1,6 @@
 #!perl -w
 use Imager ':all';
-use Test::More tests => 177;
+use Test::More tests => 181;
 use strict;
 use Imager::Test qw(test_image_raw test_image_16 is_color3 is_color1 is_image);
 
@@ -552,6 +552,19 @@ print "# check error handling\n";
   ok(!$im2, "no image when file failed to load");
   cmp_ok(Imager->errstr, '=~', "bad header magic, not a PNM file",
         "check error message transferred");
+
+  # load from data
+ SKIP:
+  {
+    ok(open(FH, "< testimg/penguin-base.ppm"), "open test file")
+      or skip("couldn't open data source", 4);
+    my $imdata = do { local $/; <FH> };
+    close FH;
+    ok(length $imdata, "we got the data");
+    my $im3 = Imager->new(data => $imdata);
+    ok($im3, "read the file data");
+    is($im3->getwidth, 164, "check width matches image");
+  }
 }
 
 sub openimage {