Image-Info-1.20.tar.gz
[Image-Info.git] / t / tiff.t
blob5688cd20971abc1185124ad35a0bdf4836091c84
1 #!/usr/bin/perl -w
3 use Test::More;
4 use strict;
6 BEGIN
8 chdir 't' if -d 't';
9 use lib '../blib/';
10 use lib '../lib/';
11 plan tests => 12;
14 use Image::Info qw(image_info dim);
16 ## This TIFF file has 3 images, in 24-bit colour, 1-bit mono and 8-bit grey.
17 my @i = image_info("../img/test.tif");
18 ok ( @i, 'image_info ran ok');
19 is ( @i, 3, 'Right number of images found' );
21 ## First image
22 is ( scalar @{$i[0]->{BitsPerSample}}, 3 , 'Three lots of BitsPerSample for full-colour image' );
23 is ( $i[0]->{SamplesPerPixel}, 3, 'SamplesPerPixel is 3 for full-colour image' );
24 is ( $i[0]->{width}, 60, 'width is right for full-colour image');
25 is ( $i[0]->{height}, 50, 'height is right for full-colour image');
27 ## Second image
28 is ( $i[1]->{BitsPerSample}, 1, 'BitsPerSample right for 1-bit image' );
29 is ( $i[1]->{SamplesPerPixel}, 1, 'BitsPerSample right for 1-bit image' );
30 is ( $i[1]->{Compression}, 'CCITT T6', 'Compression right for 1-bit image' );
32 ## Third image
33 is ( $i[2]->{BitsPerSample}, 8, 'Bit depth right for greyscale image' );
34 is ( $i[2]->{SamplesPerPixel}, 1, 'Bit depth right for greyscale image' );
35 is ( dim($i[2]), '60x50' , 'dim() function is right for greyscale image' );