From 5a50139d382deed79415578f4e7900c0d1ade14a Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Fri, 4 May 2012 21:34:50 +1000 Subject: [PATCH] loosen up comparisons to handle the rounding change in Imager 0.90 --- Changes | 6 ++++++ t/t10pie.t | 2 +- t/t14bar.t | 4 ++-- t/t30many_points.t | 2 +- t/t31tic_color.t | 4 ++-- t/t32series_labels.t | 2 +- t/t33_long_labels.t | 2 +- t/t34horizontal_many_points.t | 2 +- t/t40area.t | 4 ++-- t/x50vstyle.t | 14 +++++++------- t/x51hstyle.t | 12 ++++++------ 11 files changed, 30 insertions(+), 24 deletions(-) diff --git a/Changes b/Changes index 0fac088..4bf4d29 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,11 @@ Revision history for Perl extension Imager::Graph. +Imager-Graph 0.10 - unreleased +================= + + - loosen up image comparisons - the rounding change in Imager 0.90 + made small changes to many pixels in fountain fills + Imager-Graph 0.09 - 05 Aug 2010 ================= diff --git a/t/t10pie.t b/t/t10pie.t index d5a99cb..15f7108 100644 --- a/t/t10pie.t +++ b/t/t10pie.t @@ -259,7 +259,7 @@ cmpimg($img6, "testimg/t10_hlegend.png", 550_000); my $im = $pie->draw(); ok($im, "made lin_found test using methods"); - cmpimg($im, "testimg/t10_lin_fount.png", 180_00); + cmpimg($im, "testimg/t10_lin_fount.png", 180_000); } { diff --git a/t/t14bar.t b/t/t14bar.t index 7216fb9..ebf1443 100644 --- a/t/t14bar.t +++ b/t/t14bar.t @@ -43,7 +43,7 @@ my @labels = qw(alpha beta gamma delta epsilon phi gi); ok($img1, "drawing bar chart"); $img1->write(file=>'testout/t14_bar.ppm') or die "Can't save img1: ".$img1->errstr."\n"; - cmpimg($img1, 'testimg/t14_bar.ppm', 1); + cmpimg($img1, 'testimg/t14_bar.ppm', 80_000); } { # alternative interfaces @@ -58,7 +58,7 @@ my @labels = qw(alpha beta gamma delta epsilon phi gi); ok($img1, "drawing bar chart"); $img1->write(file=>'testout/t14_bar2.ppm') or die "Can't save img1: ".$img1->errstr."\n"; - cmpimg($img1, 'testimg/t14_bar.ppm', 1); + cmpimg($img1, 'testimg/t14_bar.ppm', 80_000); } unless (is(@warned, 0, "should be no warnings")) { diff --git a/t/t30many_points.t b/t/t30many_points.t index 91f4d54..0ee7476 100644 --- a/t/t30many_points.t +++ b/t/t30many_points.t @@ -41,7 +41,7 @@ my $img1 = $line->draw(); ok($img1, "drawing line chart"); $img1->write(file=>'testout/t30_points.ppm') or die "Can't save img1: ".$img1->errstr."\n"; -cmpimg($img1, 'testimg/t30_points.ppm', 1); +cmpimg($img1, 'testimg/t30_points.ppm', 40_000); unless (is(@warned, 0, "should be no warnings")) { diag($_) for @warned; diff --git a/t/t31tic_color.t b/t/t31tic_color.t index 8ae6022..09abf6c 100644 --- a/t/t31tic_color.t +++ b/t/t31tic_color.t @@ -48,10 +48,10 @@ $img1->write(file=>'testout/t31tic_color.ppm') or die "Can't save img1: ".$img1- eval { require Chart::Math::Axis; }; if ($@) { - cmpimg($img1, 'testimg/t31tic_color.ppm', 100); + cmpimg($img1, 'testimg/t31tic_color.ppm', 100_000); } else { - cmpimg($img1, 'testimg/t31tic_color_CMA.ppm', 100); + cmpimg($img1, 'testimg/t31tic_color_CMA.ppm', 100_000); } unless (is(@warned, 0, "should be no warnings")) { diff --git a/t/t32series_labels.t b/t/t32series_labels.t index bb8ff61..e22e2a2 100644 --- a/t/t32series_labels.t +++ b/t/t32series_labels.t @@ -43,7 +43,7 @@ my $img1 = $line->draw(); ok($img1, "drawing line chart"); $img1->write(file=>'testout/t32_series.ppm') or die "Can't save img1: ".$img1->errstr."\n"; -cmpimg($img1, 'testimg/t32_series.ppm', 1); +cmpimg($img1, 'testimg/t32_series.ppm', 80_000); unless (is(@warned, 0, "should be no warnings")) { diag($_) for @warned; diff --git a/t/t33_long_labels.t b/t/t33_long_labels.t index 0c44717..712bec5 100644 --- a/t/t33_long_labels.t +++ b/t/t33_long_labels.t @@ -36,7 +36,7 @@ $graph->set_labels(['AWWWWWWWWWWWWWWA', 'AWWWWWWWWWWWWWWWWWWWWWWWWWWWWWA']); my $img = $graph->draw() || warn $graph->error; -cmpimg($img, 'testimg/t33_long_labels.ppm', 200); +cmpimg($img, 'testimg/t33_long_labels.ppm', 200_000); $img->write(file=>'testout/t33_long_labels.ppm') or die "Can't save img1: ".$img->errstr."\n"; unless (is(@warned, 0, "should be no warnings")) { diff --git a/t/t34horizontal_many_points.t b/t/t34horizontal_many_points.t index 26311e4..149aeec 100644 --- a/t/t34horizontal_many_points.t +++ b/t/t34horizontal_many_points.t @@ -39,7 +39,7 @@ my $img1 = $bar->draw(); ok($img1, "drawing bar chart"); $img1->write(file=>'testout/t34_points.ppm') or die "Can't save img1: ".$img1->errstr."\n"; -cmpimg($img1, 'testimg/t34_points.ppm', 1); +cmpimg($img1, 'testimg/t34_points.ppm', 80_000); unless (is(@warned, 0, "should be no warnings")) { diag($_) for @warned; diff --git a/t/t40area.t b/t/t40area.t index c7af263..0dcc0bf 100644 --- a/t/t40area.t +++ b/t/t40area.t @@ -68,7 +68,7 @@ plan tests => 8; ok($img1->write(file => "testout/t40area1.ppm"), "save to testout"); - cmpimg($img1, "testimg/t40area1.png"); + cmpimg($img1, "testimg/t40area1.png", 100_000); } { @@ -92,7 +92,7 @@ plan tests => 8; ok($img2->write(file => "testout/t40area2.ppm"), "save to file"); - cmpimg($img2, "testimg/t40area2.png"); + cmpimg($img2, "testimg/t40area2.png", 80_000); } END { diff --git a/t/x50vstyle.t b/t/x50vstyle.t index e238697..fb46a21 100644 --- a/t/x50vstyle.t +++ b/t/x50vstyle.t @@ -53,7 +53,7 @@ print "# Font type: ",ref $font,"\n"; ok($img1->write(file => "testout/x50line_def.ppm"), "save to testout"); - cmpimg($img1, "xtestimg/x50line_def.png"); + cmpimg($img1, "xtestimg/x50line_def.png", 60_000); } { # no outline @@ -73,7 +73,7 @@ print "# Font type: ",ref $font,"\n"; ok($img2->write(file => "testout/x50line_noout.ppm"), "save to testout"); - cmpimg($img2, "xtestimg/x50line_noout.png"); + cmpimg($img2, "xtestimg/x50line_noout.png", 60_000); my $img3 = $vert->draw ( @@ -129,7 +129,7 @@ print "# Font type: ",ref $font,"\n"; ok($img6, "make chart with dashed outline of graph area"); ok($img6->write(file => "testout/x50line_dashout.ppm"), "save it"); - cmpimg($img6, "xtestimg/x50line_dashout.png"); + cmpimg($img6, "xtestimg/x50line_dashout.png", 80_000); } { # no outline, styled fill @@ -148,7 +148,7 @@ print "# Font type: ",ref $font,"\n"; ok($img7, "made the image"); ok($img7->write(file => "testout/x50line_fill.ppm"), "save it"); - cmpimg($img7, "xtestimg/x50line_fill.png"); + cmpimg($img7, "xtestimg/x50line_fill.png", 80_000); } { # gridlines @@ -164,7 +164,7 @@ print "# Font type: ",ref $font,"\n"; ok($img8, "made the gridline image"); ok($img8->write(file => "testout/x50line_grid.ppm"), "save it"); - cmpimg($img8, "xtestimg/x50line_grid.png"); + cmpimg($img8, "xtestimg/x50line_grid.png", 60_000); # default horizontal gridlines my $imgb = $vert->draw @@ -178,7 +178,7 @@ print "# Font type: ",ref $font,"\n"; ok($imgb, "made the gridline image"); ok($imgb->write(file => "testout/x50line_griddef.ppm"), "save it"); - cmpimg($imgb, "xtestimg/x50line_griddef.png"); + cmpimg($imgb, "xtestimg/x50line_griddef.png", 60_000); } @@ -204,7 +204,7 @@ print "# Font type: ",ref $font,"\n"; ok($img9, "made the gridline image (set by methods)"); ok($img9->write(file => "testout/x50line_gridm.ppm"), "save it"); - cmpimg($img9, "xtestimg/x50line_grid.png"); + cmpimg($img9, "xtestimg/x50line_grid.png", 60_000); } } diff --git a/t/x51hstyle.t b/t/x51hstyle.t index d1f103f..cee81ce 100644 --- a/t/x51hstyle.t +++ b/t/x51hstyle.t @@ -53,7 +53,7 @@ print "# Font type: ",ref $font,"\n"; ok($img1->write(file => "testout/x51col_def.ppm"), "save to testout"); - cmpimg($img1, "xtestimg/x51col_def.png"); + cmpimg($img1, "xtestimg/x51col_def.png", 80_000); } { # no outline @@ -73,7 +73,7 @@ print "# Font type: ",ref $font,"\n"; ok($img2->write(file => "testout/x51col_noout.ppm"), "save to testout"); - cmpimg($img2, "xtestimg/x51col_noout.png"); + cmpimg($img2, "xtestimg/x51col_noout.png", 80_000); } { @@ -107,7 +107,7 @@ print "# Font type: ",ref $font,"\n"; ok($img6, "make chart with dashed outline of graph area"); ok($img6->write(file => "testout/x51col_dashout.ppm"), "save it"); - cmpimg($img6, "xtestimg/x51col_dashout.png"); + cmpimg($img6, "xtestimg/x51col_dashout.png", 80_000); } { # no outline, styled fill @@ -126,7 +126,7 @@ print "# Font type: ",ref $font,"\n"; ok($img7, "made the image"); ok($img7->write(file => "testout/x51col_fill.ppm"), "save it"); - cmpimg($img7, "xtestimg/x51col_fill.png"); + cmpimg($img7, "xtestimg/x51col_fill.png", 120_000); } { # gridlines @@ -142,7 +142,7 @@ print "# Font type: ",ref $font,"\n"; ok($img8, "made the gridline image"); ok($img8->write(file => "testout/x51col_grid.ppm"), "save it"); - cmpimg($img8, "xtestimg/x51col_grid.png"); + cmpimg($img8, "xtestimg/x51col_grid.png", 80_000); } { # gridlines (set by method) @@ -167,7 +167,7 @@ print "# Font type: ",ref $font,"\n"; ok($img9, "made the gridline image (set by methods)"); ok($img9->write(file => "testout/x51col_gridm.ppm"), "save it"); - cmpimg($img9, "xtestimg/x51col_grid.png"); + cmpimg($img9, "xtestimg/x51col_grid.png", 80_000); } } -- 2.30.2