]> granicus.if.org Git - php/commitdiff
- do not use md5, png signature can change between libpng version
authorPierre Joye <pajoye@php.net>
Mon, 25 Apr 2005 11:36:24 +0000 (11:36 +0000)
committerPierre Joye <pajoye@php.net>
Mon, 25 Apr 2005 11:36:24 +0000 (11:36 +0000)
   some floating points issue can end to different colors (+/- 1/255)
   tests should work again now.

ext/gd/tests/bug24155.phpt
ext/gd/tests/bug27582_1.phpt

index 3bcc8974a7f6807f80b118da8a2e5c9275ea8238..a7cf9ef73a8b22971736e707bb0e5900ca2249d2 100644 (file)
@@ -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
index f6dbda0cedfe2fee3f39f58d94a6ff2f2f30bdde..b85f7457e01b89c151cbd7aa0cd728934f069b47 100644 (file)
@@ -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