in reply to Re^5: Testing image output
in thread Testing image output
it is to be expected that libgd and/or the GD::Image wrapper around that library together have sufficient tests on copyResampled to ensure that it works in any situation they claim it will work
I think that's the key...
I have been getting too focussed on testing everything but I don't need to test the things that are out of the control of my module!
Following on from your 3 points I have tried this approach...
Drawing a rectangle with a smaller, red rectangle inside it. Then drawing the three parts of this simple shape and comparing them to the output from Image::Square. This works for the left image but not centre or right. Examining the image files, the output from Image::Square is one byte less. Not doubt from copyResampled.use strict; use warnings; use Test::More; use GD::Simple; use Image::Square; plan tests => 3; my $horizontal = GD::Simple->new(160, 90, 1); $horizontal->bgcolor('red'); $horizontal->rectangle(10,10,150,80); my $left = GD::Simple->new(90, 90, 1); $left->bgcolor('red'); $left->rectangle(10,10,90,80); my $center = GD::Simple->new(90, 90, 1); $center->bgcolor('red'); $center->rectangle(0,10,90,80); my $right = GD::Simple->new(90, 90, 1); $right->bgcolor('red'); $right->rectangle(0,10,80,80); my $square = Image::Square->new($horizontal->gd); my $im_left = $square->square(0, 0); cmp_ok($im_left->png, 'eq', $left->png, 'left image'); my $im_center = $square->square(0, 0.5); cmp_ok($im_center->png(5), 'eq', $center->png(5), 'center image'); my $im_right = $square->square(0, 1); cmp_ok($im_right->png(5), 'eq', $right->png(5), 'right image');
Given your excellent point about libgd and GD::Image being tested, I don't think it is worth me testing the images other than to ensure they are the expected dimensions.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Testing image output
by Anonymous Monk on Sep 16, 2023 at 11:02 UTC |