Permalink
Browse files

PNG re-work: simple tests for reading various images types

including TODOs for paletted checks
  • Loading branch information...
1 parent 9f1597b commit 6d379e0db51f157ad310c8e6d91a6abf7dc9cfee @tonycoz committed Jun 14, 2011
View
@@ -13,7 +13,7 @@ init_log("testout/t102png.log",1);
$Imager::formats{"png"}
or plan skip_all => "No png support";
-plan tests => 51;
+plan tests => 63;
diag("Library version " . Imager::File::PNG::i_png_lib_version());
@@ -224,6 +224,40 @@ SKIP:
}
}
+{ # test grayscale read as greyscale
+ my $im = Imager->new;
+ ok($im->read(file => "testimg/gray.png", type => "png"),
+ "read grayscale");
+ is($im->getchannels, 1, "check channel count");
+ is($im->type, "direct", "check type");
+}
+
+{ # test grayscale + alpha read as greyscale + alpha
+ my $im = Imager->new;
+ ok($im->read(file => "testimg/graya.png", type => "png"),
+ "read grayscale + alpha");
+ is($im->getchannels, 2, "check channel count");
+ is($im->type, "direct", "check type");
+}
+
+{ # test paletted + alpha read as paletted
+ my $im = Imager->new;
+ ok($im->read(file => "testimg/paltrans.png", type => "png"),
+ "read paletted with alpha");
+ is($im->getchannels, 4, "check channel count");
+ local $TODO = "Not yet implemented";
+ is($im->type, "paletted", "check type");
+}
+
+{ # test paletted read as paletted
+ my $im = Imager->new;
+ ok($im->read(file => "testimg/pal.png", type => "png"),
+ "read paletted with alpha");
+ is($im->getchannels, 3, "check channel count");
+ local $TODO = "Not yet implemented";
+ is($im->type, "paletted", "check type");
+}
+
sub limited_write {
my ($limit) = @_;
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6d379e0

Please sign in to comment.