From: Tony Cook Date: Tue, 24 May 2005 01:09:50 +0000 (+0000) Subject: - add tests to exercise hatch fills for floating images. This code is X-Git-Tag: Imager-0.48^2~147 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/e2d5ca90c24534618234d88628fe63d452d0faad - add tests to exercise hatch fills for floating images. This code is mis-generated with the gcc 4.0 that ships with OS X 10.4 --- diff --git a/Changes b/Changes index 1a69720a..d6480bea 100644 --- a/Changes +++ b/Changes @@ -1079,7 +1079,7 @@ Revision history for Perl extension Imager. - the FT1.x driver now supports the align parameter correctly. Tests were added to each driver to check correct handling of the align parameter. -- the Win32 font driver bounding_box() method now puts accuarate values +- the Win32 font driver bounding_box() method now puts accurate values in the ascent and descent values, previously they were set to the font ascent/descent rather than the values specific to the string. - supplying align=>0 to the win32 font driver string() function @@ -1102,6 +1102,8 @@ Revision history for Perl extension Imager. compiler, MinGW can be used to build Imager. - fixed an inverted condition checking the giflib version, and replaced a manual test skip in t/t105gif.t +- add tests to exercise hatch fills for floating images. This code is + mis-generated with the gcc 4.0 that ships with OS X 10.4 ================================================================= diff --git a/t/t20fill.t b/t/t20fill.t index f63bd278..146b05bf 100644 --- a/t/t20fill.t +++ b/t/t20fill.t @@ -1,6 +1,7 @@ #!perl -w use strict; -use Test::More tests => 47; +use lib 't'; +use Test::More tests => 52; use Imager ':handy'; use Imager::Fill; @@ -12,6 +13,7 @@ Imager::init_log("testout/t20fill.log", 1); my $blue = NC(0,0,255); my $red = NC(255, 0, 0); my $redf = Imager::Color::Float->new(1, 0, 0); +my $bluef = Imager::Color::Float->new(0, 0, 1); my $rsolid = Imager::i_new_fill_solid($blue, 0); ok($rsolid, "building solid fill"); my $raw1 = Imager::ImgRaw::new(100, 100, 3); @@ -68,6 +70,30 @@ Imager::i_box_cfill($raw2, 0, 0, 99, 99, $rcustom); $diff = Imager::i_img_diff($raw1, $raw2); ok(!$diff, "custom hatch mismatch"); +{ + # basic test of floating color hatch fills + # this will exercise the code that the gcc shipped with OS X 10.4 + # forgets to generate + # the float version is called iff we're working with a non-8-bit image + # i_new_fill_hatchf() makes the same object as i_new_fill_hatch() but + # we test the other construction code path here + my $fraw1 = Imager::i_img_double_new(100, 100, 3); + my $fhatch1 = Imager::i_new_fill_hatchf($redf, $bluef, 0, 1, undef, 0, 0); + ok($fraw1, "making double image 1"); + ok($fhatch1, "making float hatch 1"); + Imager::i_box_cfill($fraw1, 0, 0, 99, 99, $fhatch1); + my $fraw2 = Imager::i_img_double_new(100, 100, 3); + my $fhatch2 = Imager::i_new_fill_hatchf($bluef, $redf, 0, 1, undef, 0, 2); + ok($fraw2, "making double image 2"); + ok($fhatch2, "making float hatch 2"); + Imager::i_box_cfill($fraw2, 0, 0, 99, 99, $fhatch2); + + $diff = Imager::i_img_diff($fraw1, $fraw2); + ok(!$diff, "float custom hatch mismatch"); + save($fraw1, "testout/t20hatchf1.ppm"); + save($fraw2, "testout/t20hatchf2.ppm"); +} + # test the oo interface my $im1 = Imager->new(xsize=>100, ysize=>100); my $im2 = Imager->new(xsize=>100, ysize=>100);