From ed8e2b3f8b13f403f70bec487066bdd30c9a8cc8 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 7 Oct 2014 16:51:57 -0400 Subject: add support for modifying the image --- t/write.t | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 t/write.t (limited to 't') diff --git a/t/write.t b/t/write.t new file mode 100644 index 0000000..36f716e --- /dev/null +++ b/t/write.t @@ -0,0 +1,51 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +use Image::PNM; + +{ + my $image = Image::PNM->new; + $image->width(6); + $image->height(8); + $image->max_pixel_value(255); + + for my $col (0..5) { + for my $row (0..7) { + $image->pixel($row, $col, [1, 1, 1]); + } + } + $image->raw_pixel(1, 2, [0, 84, 255]); + $image->raw_pixel(1, 3, [0, 84, 255]); + $image->raw_pixel(2, 1, [0, 0, 0]); + $image->raw_pixel(2, 4, [0, 0, 0]); + $image->raw_pixel(3, 0, [0, 0, 0]); + $image->raw_pixel(3, 5, [0, 0, 0]); + $image->raw_pixel(4, 0, [0, 0, 0]); + $image->raw_pixel(4, 1, [255, 0, 0]); + $image->raw_pixel(4, 2, [255, 0, 0]); + $image->raw_pixel(4, 3, [255, 0, 0]); + $image->raw_pixel(4, 4, [255, 0, 0]); + $image->raw_pixel(4, 5, [0, 0, 0]); + $image->raw_pixel(5, 0, [0, 0, 0]); + $image->raw_pixel(5, 5, [0, 0, 0]); + $image->raw_pixel(6, 0, [0, 0, 0]); + $image->raw_pixel(6, 5, [0, 0, 0]); + + is($image->as_string('P3'), <