File: t00countcolor.t

package info (click to toggle)
libimager-perl 1.027%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,820 kB
  • sloc: perl: 32,971; ansic: 28,092; makefile: 52; cpp: 4
file content (22 lines) | stat: -rw-r--r-- 935 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!perl -w
use strict;
use blib;
use Imager;
use Test::More tests => 9;

BEGIN { use_ok('Imager::CountColor' => 'count_color') }

my $black = Imager::Color->new(0, 0, 0);
my $blue = Imager::Color->new(0, 0, 255);
my $red = Imager::Color->new(255, 0, 0);
my $im = Imager->new(xsize=>50, ysize=>50);
is(count_color($im, $black), 2500, "check black vs black image");
is(count_color($im, $red), 0, "check red vs black image");
$im->box(filled=>1, color=>$blue, xmin=>25);
is(count_color($im, $black), 1250, "check black vs black/blue image");
is(count_color($im, $red), 0, "check red vs black/blue image");
is(count_color($im, $blue), 1250, "check blue vs black/blue image");
$im->box(filled=>1, color=>$red, ymin=>25);
is(count_color($im, $black), 625, "check black vs black/blue/red image");
is(count_color($im, $blue), 625, "check black vs black/blue/red image");
is(count_color($im, $red), 1250, "check black vs black/blue/red image");