]> git.imager.perl.org - imager.git/commitdiff
RT #94717 libpng 1.6.10 no longer considers CRC errors benign
authorTony Cook <tony@develop-help.com>
Fri, 13 Jun 2014 10:51:05 +0000 (20:51 +1000)
committerTony Cook <tony@develop-help.com>
Fri, 13 Jun 2014 10:51:05 +0000 (20:51 +1000)
use a different badness for checking benign error support

MANIFEST
PNG/MANIFEST
PNG/PNG.pm
PNG/t/10png.t
PNG/testimg/bipalette.png [new file with mode: 0644]

index 1149afc8037c85bbce25652178322f97cd4f0013..f832eedb8b680c910b42ccd99b4d6db7690443b3 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -240,6 +240,7 @@ PNG/t/00load.t
 PNG/t/10png.t                  Test png support
 PNG/testimg/badcrc.png
 PNG/testimg/bilevel.png
+PNG/testimg/bipalette.png      bi-level but with a palette
 PNG/testimg/comment.png
 PNG/testimg/cover.png
 PNG/testimg/cover16.png
index 08579200c90dd443085d4031206946f88fc71391..feec471e29d145d25ccd49db8254c37c84149b65 100644 (file)
@@ -12,6 +12,7 @@ t/00load.t
 t/10png.t
 testimg/badcrc.png
 testimg/bilevel.png
+testimg/bipalette.png          bi-level but with a palette
 testimg/comment.png
 testimg/cover.png
 testimg/cover16.png
index 23fe07545dc592f12710eb3742cf2dd67af79244..15da00fe4b6ea03b599da340327c8bd9928b393e 100644 (file)
@@ -4,7 +4,7 @@ use Imager;
 use vars qw($VERSION @ISA);
 
 BEGIN {
-  $VERSION = "0.89";
+  $VERSION = "0.90";
 
   require XSLoader;
   XSLoader::load('Imager::File::PNG', $VERSION);
index bc109d7250e182d485bcf3a8e10a31213165b924..b9365e468f6864d85c501a9fde16a9db0b3f8e79 100644 (file)
@@ -10,7 +10,7 @@ my $debug_writes = 1;
 
 init_log("testout/t102png.log",1);
 
-plan tests => 249;
+plan tests => 251;
 
 # this loads Imager::File::PNG too
 ok($Imager::formats{"png"}, "must have png format");
@@ -183,11 +183,25 @@ EOS
 SKIP:
 { # ignoring "benign" errors
   $png_feat{"benign-errors"}
-      or skip "libpng not configured for benign error support", 1;
+      or skip "libpng not configured for benign error support", 3;
+
+ SKIP:
+  {
+    Imager::File::PNG::i_png_lib_version() < 10610
+       or skip "1.6.10 and later treat CRC errors as non-benign", 1;
+    my $im = Imager->new;
+    ok($im->read(file => "testimg/badcrc.png", type => "png",
+                png_ignore_benign_errors => 1),
+       "read bad crc with png_ignore_benign_errors");
+  }
+
   my $im = Imager->new;
-  ok($im->read(file => "testimg/badcrc.png", type => "png",
+  ok($im->read(file => "testimg/bipalette.png", type => "png",
               png_ignore_benign_errors => 1),
-     "read bad crc with png_ignore_benign_errors");
+       "read grey image with palette with png_ignore_benign_errors");
+  ok(!$im->read(file => "testimg/bipalette.png", type => "png",
+              png_ignore_benign_errors => 0),
+       "read grey image with palette without png_ignore_benign_errors should fail");
 }
 
 { # write error reporting
diff --git a/PNG/testimg/bipalette.png b/PNG/testimg/bipalette.png
new file mode 100644 (file)
index 0000000..b105e44
Binary files /dev/null and b/PNG/testimg/bipalette.png differ