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

NAME

6       Imager::Test - common functions used in testing Imager
7

SYNOPSIS

9         use Imager::Test 'diff_text_with_nul';
10         diff_text_with_nul($test_name, $text1, $text2, @string_options);
11

DESCRIPTION

13       This is a repository of functions used in testing Imager.
14
15       Some functions will only be useful in testing Imager itself, while oth‐
16       ers should be useful in testing modules that use Imager.
17
18       No functions are exported by default.
19

FUNCTIONS

21       is_color3($color, $red, $blue, $green, $comment)
22           Tests is $color matches the given ($red, $blue, $green)
23
24       is_image($im1, $im2, $comment)
25           Tests if the 2 images have the same content.  Both images must be
26           defined, have the same width, height, channels and the same color
27           in each pixel.  The color comparison is done at 8-bits per pixel.
28           The color representation such as direct vs paletted, bits per sam‐
29           ple are not checked.  Equivalent to is_image_similar($im1, $im2, 0,
30           $comment).
31
32       is_image_similar($im1, $im2, $maxdiff, $comment)
33           Tests if the 2 images have similar content.  Both images must be
34           defined, have the same width, height and channels.  The cum of the
35           squares of the differences of each sample are calculated and must
36           be less than or equal to $maxdiff for the test to pass.  The color
37           comparison is done at 8-bits per pixel.  The color representation
38           such as direct vs paletted, bits per sample are not checked.
39
40       test_image_raw()
41           Returns a 150x150x3 Imager::ImgRaw test image.
42
43       test_image()
44           Returns a 150x150x3 8-bit/sample OO test image.
45
46       test_image_16()
47           Returns a 150x150x3 16-bit/sample OO test image.
48
49       test_image_double()
50           Returns a 150x150x3 double/sample OO test image.
51
52       diff_text_with_nul($test_name, $text1, $text2, @options)
53           Creates 2 test images and writes $text1 to the first image and
54           $text2 to the second image with the string() method.  Each call
55           adds 3 ok/not ok to the output of the test script.
56
57           Extra options that should be supplied include the font and either a
58           color or channel parameter.
59
60           This was explicitly created for regression tests on #21770.
61
62       image_bounds_checks($im)
63           Attempts to write to various pixel positions outside the edge of
64           the image to ensure that it fails in those locations.
65
66           Any new image type should pass these tests.  Does 16 separate
67           tests.
68
69       test_colorf_gpix($im, $x, $y, $expected, $epsilon, $comment)
70           Retrieves the pixel ($x,$y) from the low-level image $im and com‐
71           pares it to the floating point color $expected, with a tolerance of
72           epsilon.
73
74       test_color_gpix($im, $x, $y, $expected, $comment)
75           Retrieves the pixel ($x,$y) from the low-level image $im and com‐
76           pares it to the floating point color $expected.
77
78       test_colorf_glin($im, $x, $y, $pels, $comment)
79           Retrieves the floating point pixels ($x, $y)-[$x+@$pels, $y] from
80           the low level image $im and compares them against @$pels.
81
82       mask_tests($im, $epsilon)
83           Perform a standard set of mask tests on the OO image $im.
84

AUTHOR

86       Tony Cook <tony@develop-help.com>
87
88
89
90perl v5.8.8                       2008-03-28                   Imager::Test(3)
Impressum