From 346cf2f3569c3b7dc8ed10e8c76fd10359ec352b Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Tue, 8 May 2001 09:38:54 +0000 Subject: [PATCH] skip tests if there's no gif support --- t/t70newgif.t | 75 ++++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/t/t70newgif.t b/t/t70newgif.t index 81e11cee..ab7bcd32 100644 --- a/t/t70newgif.t +++ b/t/t70newgif.t @@ -25,50 +25,57 @@ $img->open(file=>'testimg/scale.ppm',type=>'pnm') || print "failed: ",$img->{ERR print "ok 2\n"; -$img->write(file=>'testout/t70newgif.gif',type=>'gif',gifplanes=>1,gifquant=>'lm',lmfixed=>[$green,$blue]) || print "failed: ",$img->{ERRSTR},"\n"; -print "ok 3\n"; +if (i_has_format("gif")) { + $img->write(file=>'testout/t70newgif.gif',type=>'gif',gifplanes=>1,gifquant=>'lm',lmfixed=>[$green,$blue]) || print "failed: ",$img->{ERRSTR},"\nnot "; + print "ok 3\n"; -# make sure the palette is loaded properly (minimal test) -my $im2 = Imager->new(); -my $map; -if ($im2->read(file=>'testimg/bandw.gif', colors=>\$map)) { - print "ok 4\n"; - # check the palette - if ($map) { - print "ok 5\n"; - if (@$map == 2) { - print "ok 6\n"; - my @sorted = sort { comp_entry($a,$b) } @$map; - # first entry must be #000000 and second #FFFFFF - if (comp_entry($sorted[0], NC(0,0,0)) == 0) { - print "ok 7\n"; - } - else { - print "not ok 7 # entry should be black\n"; - } - if (comp_entry($sorted[1], NC(255,255,255)) == 0) { - print "ok 8\n"; - } + # make sure the palette is loaded properly (minimal test) + my $im2 = Imager->new(); + my $map; + if ($im2->read(file=>'testimg/bandw.gif', colors=>\$map)) { + print "ok 4\n"; + # check the palette + if ($map) { + print "ok 5\n"; + if (@$map == 2) { + print "ok 6\n"; + my @sorted = sort { comp_entry($a,$b) } @$map; + # first entry must be #000000 and second #FFFFFF + if (comp_entry($sorted[0], NC(0,0,0)) == 0) { + print "ok 7\n"; + } + else { + print "not ok 7 # entry should be black\n"; + } + if (comp_entry($sorted[1], NC(255,255,255)) == 0) { + print "ok 8\n"; + } + else { + print "not ok 8 # entry should be white\n"; + } + } else { - print "not ok 8 # entry should be white\n"; + print "not ok 6 # bad map size\n"; + print "ok 7 # skipped bad map size\n"; + print "ok 8 # skipped bad map size\n"; } - } + } else { - print "not ok 6 # bad map size\n"; - print "ok 7 # skipped bad map size\n"; - print "ok 8 # skipped bad map size\n"; + print "not ok 5 # no map returned\n"; + for (6..8) { + print "ok $_ # skipped no map returned\n"; + } } } else { - print "not ok 5 # no map returned\n"; - for (6..8) { - print "ok $_ # skipped no map returned\n"; - } + print "not ok 4 # ",$im2->errstr,"\n"; + print "ok 5 # skipped - couldn't load image\n"; } } else { - print "not ok 4 # ",$im2->errstr,"\n"; - print "ok 5 # skipped - couldn't load image\n"; + for (3..8) { + print "ok $_ # skipped: no gif support\n"; + } } sub comp_entry { -- 2.39.5