From f150ee9ab5187f273091905b8071f1c2c7a319af Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Mon, 25 Apr 2005 11:36:24 +0000 Subject: [PATCH] - do not use md5, png signature can change between libpng version some floating points issue can end to different colors (+/- 1/255) tests should work again now. --- ext/gd/tests/bug24155.phpt | 10 ++++++++-- ext/gd/tests/bug27582_1.phpt | 10 +++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ext/gd/tests/bug24155.phpt b/ext/gd/tests/bug24155.phpt index 3bcc8974a7..a7cf9ef73a 100644 --- a/ext/gd/tests/bug24155.phpt +++ b/ext/gd/tests/bug24155.phpt @@ -19,8 +19,14 @@ Bug #24155 (gdImageRotate270 rotation problem). $im = imagerotate($im, 270, 255); imagepng($im, $dest); - echo md5_file($dest) . "\n"; + $im2 = imagecreatefrompng($dest); + + // Uniform fill + n x 90degrees rotation , the color value does not change + $col = imagecolorat($im2, 20, 20); + // 16777215 - 255 = 16776960 + echo "$col\n"; + @unlink($dest); ?> --EXPECT-- -cc867fd65c30883463ce58d0341f0997 +16776960 diff --git a/ext/gd/tests/bug27582_1.phpt b/ext/gd/tests/bug27582_1.phpt index f6dbda0ced..b85f7457e0 100644 --- a/ext/gd/tests/bug27582_1.phpt +++ b/ext/gd/tests/bug27582_1.phpt @@ -12,13 +12,17 @@ $dest = dirname(realpath(__FILE__)) . '/bug27582.png'; @unlink($dest); $im = ImageCreateTrueColor(10, 10); imagealphablending($im, true); -imagesavealpha($im, false); +imagesavealpha($im, true); $bordercolor=ImageColorAllocateAlpha($im, 0, 0, 0, 2); $color = ImageColorAllocateAlpha($im, 0, 0, 0, 1); ImageFillToBorder($im, 5, 5, $bordercolor, $color); imagepng($im, $dest); -echo md5_file($dest) . "\n"; + +$im2 = imagecreatefrompng($dest); +$col = imagecolorat($im2, 5, 5); +$color = imagecolorsforindex($im2, $col); +echo $color['alpha']; @unlink($dest); ?> --EXPECT-- -08287f8f5d406946009df5f04ca83dc0 +1 -- 2.40.0