1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#!/usr/bin/perl -w
use Test::More;
use strict;
# test PNG files
BEGIN
{
plan tests => 18;
chdir 't' if -d 't';
use lib '../lib';
use_ok ("Image::Info") or die($@);
};
use Image::Info qw(image_info dim);
my $i = image_info("../img/test.png") ||
die ("Couldn't read test.png: $!");
is ($i->{color_type}, 'Indexed-RGB', 'color_type');
is ($i->{LastModificationTime}, "2006-07-16 12:28:31", 'LastModificationTime');
is ($i->{file_ext}, 'png', 'png');
is ($i->{file_media_type}, 'image/png', 'media_type');
is ($i->{SampleFormat}, 'U4', 'SampleFormat');
is (dim($i), '150x113', 'dim()');
is_deeply ( $i->{ColorPalette},
[ '#171617', '#c8ced6', '#8d929b', '#75787f', '#565961', '#2f3033', '#fefefd',
'#613e2f', '#a6acb6', '#e6ecf2', '#40464d', '#805d4b' ], 'ColorPalette' );
#############################################################################
# interlace test
$i = image_info("../img/interlace.png") ||
die ("Couldn't read interlace.png: $!");
is ($i->{color_type}, 'RGB', 'color_type');
is ($i->{LastModificationTime}, "2006-07-16 12:32:43", 'LastModificationTime');
is ($i->{SampleFormat}, 'U8', 'SampleFormat');
is ($i->{Interlace}, 'Adam7', 'Interlace');
is ($i->{Compression}, 'Deflate', 'Compression');
is ($i->{PNG_Filter}, 'Adaptive', 'PNG_Filter');
is ($i->{file_ext}, 'png', 'png');
is ($i->{file_media_type}, 'image/png', 'media_type');
is ($i->{Comment}, 'Created with The GIMP', 'Comment');
is (dim($i), '200x100', 'dim()');
|