1 # Before `make install' is performed this script should be runnable with
2 # `make test'. After `make install' it should work as `perl test.pl'
4 ######################### We start with some black magic to print on failure.
6 # Change 1..1 below to 1..last_test_to_print .
7 # (It may become useful if the test is moved to ./t subdirectory.)
9 BEGIN { $| = 1; print "1..4\n"; }
10 END {print "not ok 1\n" unless $loaded;}
15 init_log("testout/t15color.log",1);
17 my $c1 = Imager::Color->new(100, 150, 200, 250);
18 print test_col($c1, 100, 150, 200, 250) ? "ok 2\n" : "not ok 2\n";
19 my $c2 = Imager::Color->new(100, 150, 200);
20 print test_col($c2, 100, 150, 200, 255) ? "ok 3\n" : "not ok 3\n";
21 my $c3 = Imager::Color->new("#6496C8");
22 print test_col($c3, 100, 150, 200, 255) ? "ok 4\n" : "not ok 4\n";
25 my ($c, $r, $g, $b, $a) = @_;
26 my ($cr, $cg, $cb, $ca) = $c->rgba;
27 return $r == $cr && $g == $cg && $b == $cb && $a == $ca;