1Test::Image::GD(3)    User Contributed Perl Documentation   Test::Image::GD(3)
2
3
4

NAME

6       Test::Image::GD - A module for testing images using GD
7

SYNOPSIS

9         use Test::More plan => 1;
10         use Test::Image::GD;
11
12         cmp_image('test.gif', 'control.gif', '... these images should match');
13
14         # or
15
16         my $test = GD::Image->new('test.gif');
17         my $control = GD::Image->new('control.gif');
18         cmp_image($test, $control, '... these images should match');
19
20         # some other test functions ...
21
22         size_ok('camel.gif', [ 100, 350 ], '... the image is 100 x 350");
23
24         height_ok('test.gif', 200, '... the image has a height of 200');
25         width_ok('test.gif', 200, '... the image has a width of 200');
26

DESCRIPTION

28       This module is meant to be used for testing custom graphics, it
29       attempts to "visually" compare the images, this means it ignores
30       invisible differences like color palettes and metadata. It also
31       provides some extra functions to check the size of the image.
32

FUNCTIONS

34       cmp_image ($got, $expected, $message)
35           This function will tell you whether the two images will look
36           different, ignoring differences in the order of colors in the color
37           palette and other invisible changes.
38
39           Both $got and $expected can be either instances of "GD::Image" or
40           either a file handle or a file path (both are valid parameters to
41           the "GD::Image" constructor).
42
43       size_ok ($got, [ $width, $height ], ?$message)
44           This function will check if an image is a certain size.
45
46           As with the "cmp_image" function, the $got parameter can be either
47           an instance of "GD::Image" or a file handle or a file path (all are
48           valid parameters to the "GD::Image" constructor).
49
50       height_ok ($got, $height, ?$message)
51           This function will check if an image is a certain height.
52
53           As with the "cmp_image" function, the $got parameter can be either
54           an instance of "GD::Image" or a file handle or a file path (all are
55           valid parameters to the "GD::Image" constructor).
56
57       width_ok ($got, $width, ?$message)
58           This function will check if an image is a certain width.
59
60           As with the "cmp_image" function, the $got parameter can be either
61           an instance of "GD::Image" or a file handle or a file path (all are
62           valid parameters to the "GD::Image" constructor).
63

TO DO

65       Add more functions
66           This module currently serves a very basic need of mine, however, I
67           am sure as I start writing more tests against images I will find a
68           need for other testing functions. Any suggestions are welcome.
69

BUGS

71       None that I am aware of. Of course, if you find a bug, let me know, and
72       I will be sure to fix it.
73

CODE COVERAGE

75       I use Devel::Cover to test the code coverage of my tests, below is the
76       Devel::Cover report on this module test suite.
77
78        ---------------------------- ------ ------ ------ ------ ------ ------ ------
79        File                           stmt   bran   cond    sub    pod   time  total
80        ---------------------------- ------ ------ ------ ------ ------ ------ ------
81        Test/Image/GD.pm              100.0   91.7   63.6  100.0  100.0  100.0   93.7
82        ---------------------------- ------ ------ ------ ------ ------ ------ ------
83        Total                         100.0   91.7   63.6  100.0  100.0  100.0   93.7
84        ---------------------------- ------ ------ ------ ------ ------ ------ ------
85

SEE ALSO

87       The "compare" function of "GD::Image" class, that is how this
88       "cmp_image" is implemented.
89

AUTHOR

91       Stevan Little, <stevan@iinteractive.com>
92
94       Copyright 2005 by Infinity Interactive, Inc.
95
96       <http://www.iinteractive.com>
97
98       This library is free software; you can redistribute it and/or modify it
99       under the same terms as Perl itself.
100
101
102
103perl v5.32.1                      2021-01-27                Test::Image::GD(3)
Impressum