summaryrefslogtreecommitdiffstats
path: root/t/P3.t
blob: 3c75def9526707fb7058723d6418e26c98c21443 (plain) (blame)
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
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;

use Image::PNM;

my $image = Image::PNM->new('t/data/P3.pnm');

is($image->width, 8);
is($image->height, 8);
is($image->max_pixel_value, 255);
is_deeply($image->raw_pixel(1, 3), [0, 84, 255]);
is_deeply($image->pixel(4, 2), [1, 0, 0]);

is($image->as_string('P3'), <<IMAGE);
P3
8 8
255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 0 84 255 0 84 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 0 0 0 255 255 255 255 255 255 0 0 0 255 255 255 255 255 255
255 255 255 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 0 0 0 255 255 255
255 255 255 0 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 0 255 255 255
255 255 255 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 0 0 0 255 255 255
255 255 255 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 0 0 0 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
IMAGE

done_testing;