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.)
10 BEGIN { $| = 1; print "1..8\n"; }
11 END {print "not ok 1\n" unless $loaded;}
13 use Imager qw(:all :handy);
18 Imager::init('log'=>'testout/t70newgif.log');
20 $green=i_color_new(0,255,0,0);
21 $blue=i_color_new(0,0,255,0);
24 $img->open(file=>'testimg/scale.ppm',type=>'pnm') || print "failed: ",$img->{ERRSTR},"\n";
28 $img->write(file=>'testout/t70newgif.gif',type=>'gif',gifplanes=>1,gifquant=>'lm',lmfixed=>[$green,$blue]) || print "failed: ",$img->{ERRSTR},"\n";
31 # make sure the palette is loaded properly (minimal test)
32 my $im2 = Imager->new();
34 if ($im2->read(file=>'testimg/bandw.gif', colors=>\$map)) {
41 my @sorted = sort { comp_entry($a,$b) } @$map;
42 # first entry must be #000000 and second #FFFFFF
43 if (comp_entry($sorted[0], NC(0,0,0)) == 0) {
47 print "not ok 7 # entry should be black\n";
49 if (comp_entry($sorted[1], NC(255,255,255)) == 0) {
53 print "not ok 8 # entry should be white\n";
57 print "not ok 6 # bad map size\n";
58 print "ok 7 # skipped bad map size\n";
59 print "ok 8 # skipped bad map size\n";
63 print "not ok 5 # no map returned\n";
65 print "ok $_ # skipped no map returned\n";
70 print "not ok 4 # ",$im2->errstr,"\n";
71 print "ok 5 # skipped - couldn't load image\n";
78 return $l[0] <=> $r[0]