diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-07 15:43:18 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-07 15:43:18 -0400 |
commit | c58bbc3a8368dc96f1a07e2ee3bf0825c9e2af34 (patch) | |
tree | 6ef718fb22f4a48df82d47897c9140595efda715 /t | |
parent | 12392181b58a25b8f63410d10759457e070ad24e (diff) | |
download | image-pnm-c58bbc3a8368dc96f1a07e2ee3bf0825c9e2af34.tar.gz image-pnm-c58bbc3a8368dc96f1a07e2ee3bf0825c9e2af34.zip |
implement P4
Diffstat (limited to 't')
-rw-r--r-- | t/P1.t | 6 | ||||
-rw-r--r-- | t/P2.t | 6 | ||||
-rw-r--r-- | t/P3.t | 6 | ||||
-rw-r--r-- | t/P4.t | 63 | ||||
-rw-r--r-- | t/data/P4.pbm | bin | 0 -> 54 bytes |
5 files changed, 81 insertions, 0 deletions
@@ -54,4 +54,10 @@ P3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 IMAGE +is($image->as_string('P4') . "\n", <<IMAGE); +P4 +6 8 +\x00\x30\x48\x84\xfc\x84\x84\x00 +IMAGE + done_testing; @@ -54,4 +54,10 @@ P3 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 IMAGE +is($image->as_string('P4') . "\n", <<IMAGE); +P4 +6 8 +\x00\x30\x48\x84\xfc\x84\x84\x00 +IMAGE + done_testing; @@ -54,4 +54,10 @@ P3 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 IMAGE +is($image->as_string('P4') . "\n", <<IMAGE); +P4 +6 8 +\x00\x30\x48\x84\xfc\x84\x84\x00 +IMAGE + done_testing; @@ -0,0 +1,63 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +use Image::PNM; + +my $image = Image::PNM->new('t/data/P4.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 + +is($image->as_string('P2'), <<IMAGE); +P2 +6 8 +1 +1 1 1 1 1 1 +1 1 0 0 1 1 +1 0 1 1 0 1 +0 1 1 1 1 0 +0 0 0 0 0 0 +0 1 1 1 1 0 +0 1 1 1 1 0 +1 1 1 1 1 1 +IMAGE + +is($image->as_string('P3'), <<IMAGE); +P3 +6 8 +1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 +1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 +0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 +0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +IMAGE + +is($image->as_string('P4') . "\n", <<IMAGE); +P4 +6 8 +\x00\x30\x48\x84\xfc\x84\x84\x00 +IMAGE + +done_testing; diff --git a/t/data/P4.pbm b/t/data/P4.pbm Binary files differnew file mode 100644 index 0000000..3512376 --- /dev/null +++ b/t/data/P4.pbm |