summaryrefslogtreecommitdiffstats
path: root/t/P1.t
diff options
context:
space:
mode:
Diffstat (limited to 't/P1.t')
-rw-r--r--t/P1.t29
1 files changed, 29 insertions, 0 deletions
diff --git a/t/P1.t b/t/P1.t
new file mode 100644
index 0000000..3fbfb04
--- /dev/null
+++ b/t/P1.t
@@ -0,0 +1,29 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+use Image::PNM;
+
+my $image = Image::PNM->new('t/data/P1.pbm');
+
+is($image->width, 6);
+is($image->height, 8);
+is($image->max_pixel_value, 1);
+is_deeply($image->raw_pixel(1, 2), [0, 0, 0]);
+is_deeply($image->pixel(4, 1), [0, 0, 0]);
+
+is($image->as_string('P1'), <<IMAGE);
+P1
+6 8
+0 0 0 0 0 0
+0 0 1 1 0 0
+0 1 0 0 1 0
+1 0 0 0 0 1
+1 1 1 1 1 1
+1 0 0 0 0 1
+1 0 0 0 0 1
+0 0 0 0 0 0
+IMAGE
+
+done_testing;