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...

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');
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.

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.


In reply to Re^6: Testing image output by Bod
in thread Testing image output by Bod

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.