Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rm warning, add skip to tests for no iTXt libpngs.

  • Loading branch information...
commit cbfbff7273139aba1def41abdab574a60476cbff 1 parent 7755101
@benkasminbullock authored
Showing with 26 additions and 22 deletions.
  1. +25 −11 tmpl/PNG.t.tmpl
  2. +1 −1  tmpl/config
  3. +0 −10 tmpl/warning
View
36 tmpl/PNG.t.tmpl
@@ -3,17 +3,27 @@
use warnings;
use strict;
+use utf8;
use FindBin;
use Test::More tests => 10;
+
+# Set up outputs to not print wide character warnings (this is for
+# debugging this file, not for the end-user's benefit).
+
my $builder = Test::More->builder;
binmode $builder->output, ":utf8";
binmode $builder->failure_output, ":utf8";
binmode $builder->todo_output, ":utf8";
+
use_ok ("[% config.base %]");
-use utf8;
use [% config.base %];
+# "Supports" is imported to test whether the underlying library
+# supports iTXt chunks and skip some of the tests if not.
+
+use [% config.base %]::Libpng qw/supports/;
+
my $png = [% config.base %]->new ({verbosity => undef});
my $file = "$FindBin::Bin/test.png";
$png->read ($file);
@@ -48,16 +58,20 @@ ok (! defined $time, "Time () is not defined for PNG with no time");
# Get some text from a PNG file.
-my $text_png = [% config.base %]->new ();
-$text_png->read ("$FindBin::Bin/with-text.png");
-my @text = $text_png->text ();
-# my %h = %{$text[1]};
-# binmode STDOUT, ":utf8";
-# for my $k (keys %h) {
-# print "$k $h{$k}\n";
-# }
-ok ($text[1]->{text} eq 'Leonardo DaVinci', "read ASCII text from PNG");
-ok ($text[2]->{text} eq '工藤俊作', "read Unicode text from PNG");
+SKIP: {
+ skip "Your libpng does not have iTXt support", 2 unless supports ("iTXt");
+
+ my $text_png = [% config.base %]->new ();
+ $text_png->read ("$FindBin::Bin/with-text.png");
+ my @text = $text_png->text ();
+ # my %h = %{$text[1]};
+ # binmode STDOUT, ":utf8";
+ # for my $k (keys %h) {
+ # print "$k $h{$k}\n";
+ # }
+ ok ($text[1]->{text} eq 'Leonardo DaVinci', "read ASCII text from PNG");
+ ok ($text[2]->{text} eq '工藤俊作', "read Unicode text from PNG");
+};
# Local Variables:
# mode: perl
View
2  tmpl/config
@@ -1,4 +1,4 @@
-version: 0.15
+version: 0.16
base: Image::PNG
author: Ben Bullock
author_pause: BKB
View
10 tmpl/warning
@@ -1,10 +0,0 @@
-=head1 WARNING
-
-This version of the module is solely for evaluation and testing. This
-module is currently incomplete and untested, and contains errors,
-bugs, and inconsistencies, including unresolved memory corruption
-errors which can crash Perl. The documentation below refers to
-functions which may or may not exist in the completed module and
-contains links to things which do not exist and may never exist.
-
-
Please sign in to comment.
Something went wrong with that request. Please try again.