Test::Image

Test an image
Download

Test::Image Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Fotango Ltd
  • Publisher web site:
  • http://search.cpan.org/~fotango/

Test::Image Tags


Test::Image Description

Test an image Test::Image is a Test::Builder compatible testing module for testing images.Calling the methods of this module prints out Test Anything Protocol output designed to be processed by Test::Harness during a make test or ./Build test. This module 'plays nice' with other test modules also crafted with Test::Builder. For example, you can happily use this module in conjunction with Test::More, Test::Exception, Test::DatabaseRow, etc, and not have to worry about your test numbers getting confused.All methods take an optional description as the last arguement. For example: $i->width(400); # prints "ok 1 - image width" $i->width(400, "1st width"); # prints "ok 2 - 1st width"SYNOPSIS use Test::More plan => 1; use Test::Image; # create a new image tester my $i = Test::Image->new(Image::Imlib2->new("foo.jpg")); ok($i, "image ok"); $i->size(400,300); # (see also $i->width, $i->height) # you can check pixels using names, rgb hex, or rgb decimal $i->pixel(10,10,"white"); # 10, 10 is white $i->pixel(10,10,"ffffff"); # 10, 10 is white $i->pixel(10,10,); # 10, 10 is white $i->pixel_not(10,10,"white"); # 10, 10 isn't white $i->pixel_not(10,10,"ffffff"); # 10, 10 isn't white $i->pixel_not(10,10,); # 10, 10 isn't white # you can use multiple posibilities too # check pixel is red, white or blue: $i->pixel(10,10,); $i->pixel(10,10,); $i->pixel(10,10,, , ]); # check that the pixel isn't red white or blue: $i->pixel_not(10,10,); $i->pixel_not(10,10,); $i->pixel_not(10,10,, , ]); # row functions (or replace "row" with "col" or "column" for column tests) # you can use multiple colours $i->row(10, "white"); # row 11 is all white $i->row_all(10, "white"); # row 11 is all white $i->row_any(10, "white"); # row 11 has a white pixel $i->row_none(10, "white"); # row 11 has no white pixels # likewise for the whole image (again can use multiple colours) $i->all("white"); # whole image is white $i->any("white"); # whole image has a white pixel $i->none("white"); # whole image has no white pixels # finally regions (you can use _all, _any or _none too) # check the 10x10 region starting at 40,30 $i->region(40, 30, "r10", "r10", "white"); Requirements: · Perl


Test::Image Related Software