summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-10-07 14:16:15 -0400
committerJesse Luehrs <doy@tozt.net>2014-10-07 14:56:01 -0400
commit12392181b58a25b8f63410d10759457e070ad24e (patch)
treee8424be87489c0a50adebe814cc77063b80e8696 /t
parentc2372470164611b5597ea63faf8dcfe33381df39 (diff)
downloadimage-pnm-12392181b58a25b8f63410d10759457e070ad24e.tar.gz
image-pnm-12392181b58a25b8f63410d10759457e070ad24e.zip
support output in different formats from input
Diffstat (limited to 't')
-rw-r--r--t/P1.t28
-rw-r--r--t/P2.t27
-rw-r--r--t/P3.t27
3 files changed, 82 insertions, 0 deletions
diff --git a/t/P1.t b/t/P1.t
index 3fbfb04..9e0bf14 100644
--- a/t/P1.t
+++ b/t/P1.t
@@ -26,4 +26,32 @@ P1
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
+
done_testing;
diff --git a/t/P2.t b/t/P2.t
index 41c2d8e..e7b7fdc 100644
--- a/t/P2.t
+++ b/t/P2.t
@@ -13,6 +13,19 @@ is($image->max_pixel_value, 255);
is_deeply($image->raw_pixel(1, 2), [78, 78, 78]);
is_deeply($image->pixel(0, 0), [1, 1, 1]);
+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
@@ -27,4 +40,18 @@ P2
255 255 255 255 255 255
IMAGE
+is($image->as_string('P3'), <<IMAGE);
+P3
+6 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 78 78 78 78 78 78 255 255 255 255 255 255
+255 255 255 0 0 0 255 255 255 255 255 255 0 0 0 255 255 255
+0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 0 0 0
+0 0 0 54 54 54 54 54 54 54 54 54 54 54 54 0 0 0
+0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 0 0 0
+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
+IMAGE
+
done_testing;
diff --git a/t/P3.t b/t/P3.t
index 1b8e663..fd55b8d 100644
--- a/t/P3.t
+++ b/t/P3.t
@@ -13,6 +13,33 @@ is($image->max_pixel_value, 255);
is_deeply($image->raw_pixel(1, 2), [0, 84, 255]);
is_deeply($image->pixel(4, 1), [1, 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
+255
+255 255 255 255 255 255
+255 255 78 78 255 255
+255 0 255 255 0 255
+0 255 255 255 255 0
+0 54 54 54 54 0
+0 255 255 255 255 0
+0 255 255 255 255 0
+255 255 255 255 255 255
+IMAGE
+
is($image->as_string('P3'), <<IMAGE);
P3
6 8