diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-07 14:06:09 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-07 14:11:00 -0400 |
commit | 64157f5b6f4649f7ca845cb119535863dd221822 (patch) | |
tree | de45a4943ae8edf39097a866d346dd6b771b4b9d /t | |
parent | ffcd82f3b5f1fb197550b005b11cae1651a8fe34 (diff) | |
download | image-pnm-64157f5b6f4649f7ca845cb119535863dd221822.tar.gz image-pnm-64157f5b6f4649f7ca845cb119535863dd221822.zip |
add P1 format
Diffstat (limited to 't')
-rw-r--r-- | t/P1.t | 29 | ||||
-rw-r--r-- | t/data/P1.pbm | 4 |
2 files changed, 33 insertions, 0 deletions
@@ -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; diff --git a/t/data/P1.pbm b/t/data/P1.pbm new file mode 100644 index 0000000..276a9d8 --- /dev/null +++ b/t/data/P1.pbm @@ -0,0 +1,4 @@ +P1 +# CREATOR: GIMP PNM Filter Version 1.1 +6 8 +000000001100010010100001111111100001100001000000 |