From: Arnar Mar Hrafnkelsson <addi@cpan.org> Date: Tue, 15 May 2001 12:43:14 +0000 (+0000) Subject: Some tests were logging into the wrong files and t50basicoo.t was using X-Git-Tag: Imager-0.48^2~639 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/e2cb7e23a020e351088922c899a4ee53dea3e24f Some tests were logging into the wrong files and t50basicoo.t was using files that the now removed t10formats.t generated. Now it uses the files generated by t10{1,2,3,4,5,6}*.t. --- diff --git a/Changes b/Changes index 85f5cd7b..69dd9b96 100644 --- a/Changes +++ b/Changes @@ -431,9 +431,13 @@ Revision history for Perl extension Imager. - other internal image representations (design/represent.txt) + - Error handling, make a general i_errstr object and arrange + such that each image has an i_errstr object to hold its + local errors? + Good stuff: - image colour transformations based on input images, see - design/cmyktorgb.txt for Addi's description + design/cmyktorgb.txt for Addi's description - eventually support tiff's madness Old sins: @@ -444,8 +448,8 @@ Revision history for Perl extension Imager. - Add mycalloc() and myrealloc() to the malloc() wrappers. - should i_readgif returned colormap be an arrayref of - Imager::Color objects? Note that this will break - compatibility with previous releases. + Imager::Color objects? Note that this will break + compatibility with previous releases. - should Imager::Font be split into a base class whose new chooses a base class (ttf, t1 or win32?) to diff --git a/t/t101jpeg.t b/t/t101jpeg.t index ccc1258d..c78c67b9 100644 --- a/t/t101jpeg.t +++ b/t/t101jpeg.t @@ -21,14 +21,14 @@ if (!i_has_format("jpeg")) { print "ok 1 # skip no jpeg support\n"; print "ok 2 # skip no jpeg support\n"; } else { - open(FH,">testout/t11.jpg") || die "cannot open testout/t11.jpg for writing\n"; + open(FH,">testout/t101.jpg") || die "cannot open testout/t101.jpg for writing\n"; binmode(FH); i_writejpeg($img,fileno(FH),30); close(FH); print "ok 1\n"; - open(FH,"testout/t11.jpg") || die "cannot open testout/t11.jpg\n"; + open(FH,"testout/t101.jpg") || die "cannot open testout/t101.jpg\n"; binmode(FH); ($cmpimg,undef)=i_readjpeg(fileno(FH)); diff --git a/t/t106tiff.t b/t/t106tiff.t index 17faa853..f74c8471 100644 --- a/t/t106tiff.t +++ b/t/t106tiff.t @@ -1,7 +1,7 @@ print "1..4\n"; use Imager qw(:all); -init_log("testout/t105gif.log",1); +init_log("testout/t106tiff.log",1); $green=i_color_new(0,255,0,255); $blue=i_color_new(0,0,255,255); @@ -24,7 +24,7 @@ if (!i_has_format("tiff")) { print "ok 2 # skip no tiff support\n"; print "ok 3 # skip no tiff support\n"; } else { - open(FH,">testout/t10.tiff") || die "cannot open testout/t10.tiff for writing\n"; + open(FH,">testout/t106.tiff") || die "cannot open testout/t10.tiff for writing\n"; binmode(FH); my $IO = Imager::io_new_fd(fileno(FH)); i_writetiff_wiol($img, $IO); @@ -32,7 +32,7 @@ if (!i_has_format("tiff")) { print "ok 1\n"; - open(FH,"testout/t10.tiff") or die "cannot open testout/t10.tiff\n"; + open(FH,"testout/t106.tiff") or die "cannot open testout/t106.tiff\n"; binmode(FH); $IO = Imager::io_new_fd(fileno(FH)); $cmpimg = i_readtiff_wiol($IO, -1); @@ -47,7 +47,7 @@ if (!i_has_format("tiff")) { Imager::i_writetiff_wiol($img, $IO) or die "Cannot write to bufferchain\n"; my $tiffdata = Imager::io_slurp($IO); - open(FH,"testout/t10.tiff"); + open(FH,"testout/t106.tiff"); my $odata; { local $/; $odata = <FH>; diff --git a/t/t50basicoo.t b/t/t50basicoo.t index f6b74f68..fc43b9e0 100644 --- a/t/t50basicoo.t +++ b/t/t50basicoo.t @@ -9,14 +9,12 @@ BEGIN { $| = 1; print "1..2\n"; } END {print "not ok 1\n" unless $loaded;} use Imager; -#use Data::Dumper; + $loaded = 1; print "ok 1\n"; -init_log("testout/t00basicoo.log",1); - -#list_formats(); +Imager::init(log=>"testout/t50basicoo.log"); %hsh=%Imager::formats; @@ -27,24 +25,28 @@ for(keys %hsh) { print "# $_\n"; } $img = Imager->new(); -@all=qw(tiff gif jpg png ppm raw); - -for(@all) { - if (!$hsh{$_}) { next; } - print "#opening Format: $_\n"; - if ($_ eq "raw") { - $img->read(file=>"testout/t10.$_",type=>'raw', xsize=>150,ysize=>150) or die "failed: ",$img->{ERRSTR},"\n"; - } else { - $img->read(file=>"testout/t10.$_") or die "failed: ",$img->{ERRSTR},"\n"; - } +@types = qw( jpeg png raw ppm gif tiff ); + +@files{@types} = ({ file => "testout/t101.jpg" }, + { file => "testout/t102.png" }, + { file => "testout/t103.raw", xsize=>150, ysize=>150, type=>"raw" }, + { file => "testout/t104.ppm" }, + { file => "testout/t105.gif" }, + { file => "testout/t106.tiff" }); + +for $type (@types) { + next unless $hsh{$type}; + my %opts = %{$files{$type}}; + my @a = map { "$_=>${opts{$_}}" } keys %opts; + print "#opening Format: $type, options: @a\n"; + $img->read( %opts ) or die "failed: ",$img->errstr,"\n"; } -$img2=$img->crop(width=>50,height=>50); -$img2->write(file=>'testout/t50.ppm',type=>'pnm'); +$img2=$img->crop(width=>50, height=>50); +$img2->write(file=> 'testout/t50.ppm', type=>'pnm'); undef($img); -malloc_state(); - +Imager::malloc_state(); print "ok 2\n"; diff --git a/t/t60dyntest.t b/t/t60dyntest.t index 1fc3eabd..fddf8a2b 100644 --- a/t/t60dyntest.t +++ b/t/t60dyntest.t @@ -10,7 +10,7 @@ Imager::init('log'=>'testout/t60dyntest.log'); $img=Imager->new() || die "unable to create image object\n"; -$img->open(file=>'testout/t10.ppm',type=>'pnm') || die "failed: ",$img->{ERRSTR},"\n"; +$img->open(file=>'testout/t104.ppm',type=>'pnm') || die "failed: ",$img->{ERRSTR},"\n"; $plug='dynfilt/dyntest.'.$Config{'so'}; load_plugin($plug) || die "unable to load plugin:\n$Imager::ERRSTR\n";