diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2016-08-17 17:59:33 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2016-08-17 17:59:33 +0200 |
commit | a3159d29bb24d5c946c14b7aa33e96bebcd56e59 (patch) | |
tree | 771b0da28d52572069c9f964b371f1c33748beeb | |
parent | 48198e4c257825ab89ee027bff5a93fc2cd59601 (diff) | |
download | php-git-a3159d29bb24d5c946c14b7aa33e96bebcd56e59.tar.gz |
Make tests a little more resilient
PNG allows identical images to be stored differently what makes nearly all
tests checking the MD5 hash of the PNG representation fail with external
libgd. For now, we use the GD format instead, which doesn't allow for such
differences.
Of course, this md5() checking should be replaced by a image diffing feature
in the long run.
30 files changed, 60 insertions, 60 deletions
diff --git a/ext/gd/tests/bug22544.phpt b/ext/gd/tests/bug22544.phpt index 4c8f763a73..b18eef4332 100644 --- a/ext/gd/tests/bug22544.phpt +++ b/ext/gd/tests/bug22544.phpt @@ -15,9 +15,9 @@ Bug #22544 (TrueColor transparency in PNG images). $red = imageColorAllocate($image, 255, 50, 50); imageColorTransparent($image, $transparent); imageFilledRectangle($image, 0, 0, 640-1, 100-1, $transparent); - imagePng($image, $dest); + imagegd($image, $dest); echo md5_file($dest) . "\n"; @unlink($dest); ?> --EXPECT-- -10a57d09a2c63fad87b85b38d6b258d6 +7643ef115f642a79c2de6e411f485ddd diff --git a/ext/gd/tests/bug43828.phpt b/ext/gd/tests/bug43828.phpt index 05445608d3..c43a5c6c00 100644 --- a/ext/gd/tests/bug43828.phpt +++ b/ext/gd/tests/bug43828.phpt @@ -15,9 +15,9 @@ $color = imagecolorallocatealpha($im, 0, 255, 0, 100); imagefilledarc($im, 49, 49, 99,99, 0 , 360, $color, IMG_ARC_PIE); ob_start(); -imagepng($im); +imagegd($im); echo md5(ob_get_clean()); imagedestroy($im); ?> --EXPECT-- -3d82e4525f19790ae1055366e2a36917 +2400a58cd7570b5472c25264715321cd diff --git a/ext/gd/tests/bug72604.phpt b/ext/gd/tests/bug72604.phpt index b1dea5e403..edc3ce327f 100644 --- a/ext/gd/tests/bug72604.phpt +++ b/ext/gd/tests/bug72604.phpt @@ -11,9 +11,9 @@ $im = imagecreatetruecolor(100, 100); imagesetthickness($im, 5); imagearc($im, 50, 50, 90, 90, 0, 360, 0xffffff); ob_start(); -imagepng($im); +imagegd($im); $imagestring = ob_get_clean(); echo md5($imagestring); ?> --EXPECT-- -2ffa6afb915afbdf870cf6459477bc8a +4f5080080a774efe4fc8d55cd4a5849c diff --git a/ext/gd/tests/imagearc_basic.phpt b/ext/gd/tests/imagearc_basic.phpt index 4647dd1e3f..953428def9 100644 --- a/ext/gd/tests/imagearc_basic.phpt +++ b/ext/gd/tests/imagearc_basic.phpt @@ -18,11 +18,11 @@ $white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); imagearc($image, 50, 50, 30, 30, 0, 180, $white); ob_start(); -imagepng($image); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($img)); ?> --EXPECT-- -f18ad8001afefee2e9b8c08d6884425b +13149c3fd54a92a0d43cd5083a19b1d7 diff --git a/ext/gd/tests/imagearc_error1.phpt b/ext/gd/tests/imagearc_error1.phpt index 423f0356af..05d1cd8186 100644 --- a/ext/gd/tests/imagearc_error1.phpt +++ b/ext/gd/tests/imagearc_error1.phpt @@ -18,7 +18,7 @@ $white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); imagearc($image, 50, 50, 30, 30, 0, 180); ob_start(); -imagepng($image); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); @@ -26,4 +26,4 @@ echo md5(base64_encode($img)); ?> --EXPECTF-- Warning: imagearc() expects exactly 8 parameters, 7 given in %s on line %d -abebb25b5a2813cfbf92f1f24365786a +c5b7013900f5466aebfc42499a7ec8ec diff --git a/ext/gd/tests/imagearc_variation1.phpt b/ext/gd/tests/imagearc_variation1.phpt index 568d3a6d47..aaf6103b43 100644 --- a/ext/gd/tests/imagearc_variation1.phpt +++ b/ext/gd/tests/imagearc_variation1.phpt @@ -18,11 +18,11 @@ $white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); imagearc($image, 50, 50, 30, 30, 0, -90, $white); ob_start(); -imagepng($image); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($img)); ?> --EXPECT-- -ed2c8427a9922dfd8a105f10a88a0d20 +fe662ebe7488057c43e38c5de43b1727 diff --git a/ext/gd/tests/imagearc_variation2.phpt b/ext/gd/tests/imagearc_variation2.phpt index 045c68e61c..0c1c6466e1 100644 --- a/ext/gd/tests/imagearc_variation2.phpt +++ b/ext/gd/tests/imagearc_variation2.phpt @@ -18,11 +18,11 @@ $white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); imagearc($image, 50, 50, 30, 30, -90, 0, $white); ob_start(); -imagepng($image); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($img)); ?> --EXPECT-- -463b4aea9d9acfab30016ee92613c779 +8bd78aa775b5f29e7227eaeebaa84889 diff --git a/ext/gd/tests/imagechar_basic.phpt b/ext/gd/tests/imagechar_basic.phpt index 7e5fa931bc..fa6dd4d935 100644 --- a/ext/gd/tests/imagechar_basic.phpt +++ b/ext/gd/tests/imagechar_basic.phpt @@ -15,11 +15,11 @@ $white = imagecolorallocate($image, 255,255,255); $result = imagechar($image, 1, 5, 5, 'C', $white); ob_start(); -imagepng($image, null, 9); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($img)); ?> --EXPECT-- -e94962ac28ad03bd4142cb1abe9ef98b +f0291252e7ac2fadda25e63287e6860c diff --git a/ext/gd/tests/imagecharup_basic.phpt b/ext/gd/tests/imagecharup_basic.phpt index 54c8dfaa4a..194c32564d 100644 --- a/ext/gd/tests/imagecharup_basic.phpt +++ b/ext/gd/tests/imagecharup_basic.phpt @@ -15,11 +15,11 @@ $white = imagecolorallocate($image, 255,255,255); $result = imagecharup($image, 1, 5, 5, 'C', $white); ob_start(); -imagepng($image, null, 9); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($img)); ?> --EXPECT-- -79b48d5cef6d489bb68573df0296d775 +c65aad5d78f934dee2a844e7978eabd5 diff --git a/ext/gd/tests/imagecolorallocatealpha_basic.phpt b/ext/gd/tests/imagecolorallocatealpha_basic.phpt index bb2e5a7f4f..a42c51d483 100644 --- a/ext/gd/tests/imagecolorallocatealpha_basic.phpt +++ b/ext/gd/tests/imagecolorallocatealpha_basic.phpt @@ -18,7 +18,7 @@ $half = imagefilledarc ( $img, 75, 75, 70, 70, 0, 180, $cor, IMG_ARC_PIE ); $half2 = imagefilledarc ( $img, 75, 75, 70, 70, 180, 360, $corA, IMG_ARC_PIE ); ob_start(); -imagepng($img, null, 9); +imagegd($img); $imgsrc = ob_get_contents(); ob_end_clean(); @@ -26,5 +26,5 @@ var_dump(md5(base64_encode($imgsrc))); var_dump($corA); ?> --EXPECT-- -string(32) "f95489d97f4f1a5c4dc265388922d1ec" +string(32) "0981ef94ee2209a8dccb59aa8ad07e18" int(842163455)
\ No newline at end of file diff --git a/ext/gd/tests/imagecolorset_basic.phpt b/ext/gd/tests/imagecolorset_basic.phpt index a1776ff50f..01e5f7bfd5 100644 --- a/ext/gd/tests/imagecolorset_basic.phpt +++ b/ext/gd/tests/imagecolorset_basic.phpt @@ -25,11 +25,11 @@ imagecolorset($im, $bg, 0, 0, 255); // Get output and generate md5 hash ob_start(); -imagepng($im, null, 9); +imagegd($im); $result_image = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($result_image)); imagedestroy($im); ?> --EXPECT-- -6f2002aafb57b2d275fad6a6258d7476 +85e406abd0a975c97b3403cad5d078c9 diff --git a/ext/gd/tests/imageconvolution_basic.phpt b/ext/gd/tests/imageconvolution_basic.phpt index 5a9aa8f95b..9e629ac0e6 100644 --- a/ext/gd/tests/imageconvolution_basic.phpt +++ b/ext/gd/tests/imageconvolution_basic.phpt @@ -23,11 +23,11 @@ $gaussian = array( imageconvolution($image, $gaussian, 16, 0); ob_start(); -imagepng($image, null, 9); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($img)); ?> --EXPECT-- -594576a2a2a689447ffc07eb5a73f09b +20979b45f8772cdbd78262af4e332638 diff --git a/ext/gd/tests/imagecreatetruecolor_basic.phpt b/ext/gd/tests/imagecreatetruecolor_basic.phpt index 5c85f52380..a6eced15b3 100644 --- a/ext/gd/tests/imagecreatetruecolor_basic.phpt +++ b/ext/gd/tests/imagecreatetruecolor_basic.phpt @@ -12,11 +12,11 @@ Rafael Dohms <rdohms [at] gmail [dot] com> $image = imagecreatetruecolor(180, 30); ob_start(); -imagepng($image, null, 9); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($img)); ?> --EXPECT-- -5a8fe9864cbd20e5dbe730c77f30db95 +da884f488a851e0267a316ad232aee86 diff --git a/ext/gd/tests/imageellipse_basic.phpt b/ext/gd/tests/imageellipse_basic.phpt index bfd0b79f58..759e42ab72 100644 --- a/ext/gd/tests/imageellipse_basic.phpt +++ b/ext/gd/tests/imageellipse_basic.phpt @@ -17,11 +17,11 @@ $image = imagecreatetruecolor(400, 300); imageellipse($image, 200, 150, 300, 200, 16777215); ob_start(); -imagepng($image, null, 9); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($img)); ?> --EXPECT-- -d8b9bc2ca224bd68569413f4617f8e1f +49c1544b012c3460c74cd04f1332d4ad diff --git a/ext/gd/tests/imagefilledarc_basic.phpt b/ext/gd/tests/imagefilledarc_basic.phpt index 3357dd75aa..4e3bf29137 100644 --- a/ext/gd/tests/imagefilledarc_basic.phpt +++ b/ext/gd/tests/imagefilledarc_basic.phpt @@ -18,11 +18,11 @@ $white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); imagefilledarc($image, 50, 50, 30, 30, 0, 90, $white, IMG_ARC_PIE); ob_start(); -imagepng($image); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($img)); ?> --EXPECT-- -beffeaf5231adaaff1f21a2108fb6f7e +87637c60ac0ceea48dbcaa4d98319f90 diff --git a/ext/gd/tests/imagefilledarc_error1.phpt b/ext/gd/tests/imagefilledarc_error1.phpt index b2bc4172de..46d51ba34b 100644 --- a/ext/gd/tests/imagefilledarc_error1.phpt +++ b/ext/gd/tests/imagefilledarc_error1.phpt @@ -18,7 +18,7 @@ $white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); imagefilledarc($image, 50, 50, 30, 30, 0, 90, $white); ob_start(); -imagepng($image); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); @@ -26,4 +26,4 @@ echo md5(base64_encode($img)); ?> --EXPECTF-- Warning: imagefilledarc() expects exactly 9 parameters, 8 given in %s on line %d -abebb25b5a2813cfbf92f1f24365786a +c5b7013900f5466aebfc42499a7ec8ec diff --git a/ext/gd/tests/imagefilledarc_variation1.phpt b/ext/gd/tests/imagefilledarc_variation1.phpt index 2254b0910f..257c898abd 100644 --- a/ext/gd/tests/imagefilledarc_variation1.phpt +++ b/ext/gd/tests/imagefilledarc_variation1.phpt @@ -18,11 +18,11 @@ $white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); imagefilledarc($image, 50, 50, 30, 30, 0, -25, $white, IMG_ARC_PIE); ob_start(); -imagepng($image); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($img)); ?> --EXPECT-- -b467492b806001c3720b3f18cfbde5b0 +f25f589b5c5fa7deead7242652919bcf diff --git a/ext/gd/tests/imagefilledarc_variation2.phpt b/ext/gd/tests/imagefilledarc_variation2.phpt index 57686ab64c..c6ccca4b17 100644 --- a/ext/gd/tests/imagefilledarc_variation2.phpt +++ b/ext/gd/tests/imagefilledarc_variation2.phpt @@ -18,11 +18,11 @@ $white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); imagefilledarc($image, 50, 50, 30, 30, -25, 25, $white, IMG_ARC_PIE); ob_start(); -imagepng($image); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($img)); ?> --EXPECT-- -cfad369fc6d863785d3c95b4b4788225 +43c2973eb4872903eb6f5464c7965a93 diff --git a/ext/gd/tests/imagefilledellipse_basic.phpt b/ext/gd/tests/imagefilledellipse_basic.phpt index a1a578ad43..8b3682bfa8 100644 --- a/ext/gd/tests/imagefilledellipse_basic.phpt +++ b/ext/gd/tests/imagefilledellipse_basic.phpt @@ -15,11 +15,11 @@ $white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); imagefilledellipse($image, 50, 50, 40, 30, $white); ob_start(); -imagepng($image); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($img)); ?> --EXPECT-- -9ba540bba1b78c9f08efaa6fa0afd93b +233beffe003a41d3c9e788039e3191dd diff --git a/ext/gd/tests/imagefilltoborder_basic.phpt b/ext/gd/tests/imagefilltoborder_basic.phpt index 80b84d2c69..524022a15d 100644 --- a/ext/gd/tests/imagefilltoborder_basic.phpt +++ b/ext/gd/tests/imagefilltoborder_basic.phpt @@ -22,7 +22,7 @@ imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) ); imagefilltoborder( $image, 50, 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) ); ob_start(); -imagepng( $image, null, 9 ); +imagegd( $image); $img = ob_get_contents(); ob_end_clean(); @@ -30,4 +30,4 @@ echo md5(base64_encode($img)); ?> --EXPECT-- -847ec236f1c4d14c465306c8408550fc +8185a06ccff03c2abeb99d5e3ed60e45 diff --git a/ext/gd/tests/imagegammacorrect_basic.phpt b/ext/gd/tests/imagegammacorrect_basic.phpt index 33d6b1ad6c..0f4a9fdc67 100644 --- a/ext/gd/tests/imagegammacorrect_basic.phpt +++ b/ext/gd/tests/imagegammacorrect_basic.phpt @@ -21,7 +21,7 @@ $gamma = imagegammacorrect($image, 1, 5); if ($gamma){ ob_start(); - imagepng($image, null, 9); + imagegd($image); $img = ob_get_contents(); ob_end_clean(); } @@ -29,4 +29,4 @@ if ($gamma){ echo md5(base64_encode($img)); ?> --EXPECT-- -e79553115df689ea5df18a4636380569 +1f625723f9d27251a1f15b83a6a4bf55
\ No newline at end of file diff --git a/ext/gd/tests/imagegammacorrect_variation1.phpt b/ext/gd/tests/imagegammacorrect_variation1.phpt index 7a321f89d8..f022d1d559 100644 --- a/ext/gd/tests/imagegammacorrect_variation1.phpt +++ b/ext/gd/tests/imagegammacorrect_variation1.phpt @@ -21,7 +21,7 @@ $gamma = imagegammacorrect($image, 1, 5); if ($gamma){ ob_start(); - imagepng($image, null, 9); + imagegd($image); $img = ob_get_contents(); ob_end_clean(); } @@ -29,4 +29,4 @@ if ($gamma){ echo md5(base64_encode($img)); ?> --EXPECT-- -b017b1ddc8bda00e82aa8cbfb54c35d4 +32fdb7b3675e4a9fd601c6a0645c88b3 diff --git a/ext/gd/tests/imagelayereffect_basic.phpt b/ext/gd/tests/imagelayereffect_basic.phpt index a34e05e02f..2f1ee47aaf 100644 --- a/ext/gd/tests/imagelayereffect_basic.phpt +++ b/ext/gd/tests/imagelayereffect_basic.phpt @@ -16,7 +16,7 @@ $layer = imagelayereffect($image, IMG_EFFECT_REPLACE); if ($layer){ ob_start(); - imagepng($image, null, 9); + imagegd($image); $img = ob_get_contents(); ob_end_clean(); } @@ -24,4 +24,4 @@ if ($layer){ echo md5(base64_encode($img)); ?> --EXPECT-- -5a8fe9864cbd20e5dbe730c77f30db95 +da884f488a851e0267a316ad232aee86 diff --git a/ext/gd/tests/imagerectangle_basic.phpt b/ext/gd/tests/imagerectangle_basic.phpt index f706ee7ab6..eaa1566f7f 100644 --- a/ext/gd/tests/imagerectangle_basic.phpt +++ b/ext/gd/tests/imagerectangle_basic.phpt @@ -16,7 +16,7 @@ $image = imagecreatetruecolor( 100, 100 ); imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
ob_start();
-imagepng( $image, null, 9 );
+imagegd( $image );
$img = ob_get_contents();
ob_end_clean();
@@ -24,4 +24,4 @@ echo md5(base64_encode($img)); ?>
--EXPECT--
-282aaecfdd50091821d63093d9bb1bb9
\ No newline at end of file +e7f8ca8c63fb08b248f3ed6435983aed
\ No newline at end of file diff --git a/ext/gd/tests/imagesetbrush_basic.phpt b/ext/gd/tests/imagesetbrush_basic.phpt index 790184ddc2..763a4c414d 100644 --- a/ext/gd/tests/imagesetbrush_basic.phpt +++ b/ext/gd/tests/imagesetbrush_basic.phpt @@ -28,10 +28,10 @@ imageline($mainimg, 50, 50, 50, 60, IMG_COLOR_BRUSHED); // Get output and generate md5 hash ob_start(); -imagepng($mainimg, null, 9); +imagegd($mainimg); $result_image = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($result_image)); ?> --EXPECT-- -8168577c0d1fe6d9d11397cb15263d82 +2bb294c388d826cc9bba6c6fd31f265a diff --git a/ext/gd/tests/imagesetthickness_basic.phpt b/ext/gd/tests/imagesetthickness_basic.phpt index a8b079bede..205fe7e59e 100644 --- a/ext/gd/tests/imagesetthickness_basic.phpt +++ b/ext/gd/tests/imagesetthickness_basic.phpt @@ -24,11 +24,11 @@ imagesetthickness($image, 5); imagerectangle($image, 14, 14, 185, 85, $black); ob_start(); -imagepng($image, null, 9); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($img)); ?> --EXPECT-- -93c3077f1bdc372cd0b0db96db282985
\ No newline at end of file +1a6bc882772310d2e9b32cca2574236c
\ No newline at end of file diff --git a/ext/gd/tests/imagestring_basic.phpt b/ext/gd/tests/imagestring_basic.phpt index adc68a67fe..f56a2d3226 100644 --- a/ext/gd/tests/imagestring_basic.phpt +++ b/ext/gd/tests/imagestring_basic.phpt @@ -15,11 +15,11 @@ $white = imagecolorallocate($image, 255,255,255); $result = imagestring($image, 1, 5, 5, 'String Text', $white); ob_start(); -imagepng($image, null, 9); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($img)); ?> --EXPECT-- -d0d2fe757400cb7846b36a8c34b41e4a +7f146e3cdcaf89c6b9d68ccbb44cf94e diff --git a/ext/gd/tests/imagestringup_basic.phpt b/ext/gd/tests/imagestringup_basic.phpt index 0c748b6aa9..144dfc0d8d 100644 --- a/ext/gd/tests/imagestringup_basic.phpt +++ b/ext/gd/tests/imagestringup_basic.phpt @@ -15,11 +15,11 @@ $white = imagecolorallocate($image, 255,255,255); $result = imagestringup($image, 1, 5, 25, 'Str', $white); ob_start(); -imagepng($image, null, 9); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); echo md5(base64_encode($img)); ?> --EXPECT-- -7c28016adcf620b772af2a8655b87bd2 +7c55836800702bdd43b4c25d8ebcfcd0 diff --git a/ext/gd/tests/imagetruecolortopalette_basic.phpt b/ext/gd/tests/imagetruecolortopalette_basic.phpt index 3bd0d3102e..bbc1277112 100644 --- a/ext/gd/tests/imagetruecolortopalette_basic.phpt +++ b/ext/gd/tests/imagetruecolortopalette_basic.phpt @@ -20,7 +20,7 @@ $half2 = imagefilledarc ( $image, 75, 55, 80, 70, 0, -180, $b, IMG_ARC_PIE ); var_dump(imagetruecolortopalette($image, true, 2)); ob_start(); -imagepng($image, null, 9); +imagegd($image); $img = ob_get_contents(); ob_end_clean(); @@ -28,4 +28,4 @@ echo md5(base64_encode($img)); ?> --EXPECT-- bool(true) -1d41787ff70aa0c7eea5ee9304afa36b
\ No newline at end of file +17c901cb2217eb7647deed1c79d445de
\ No newline at end of file diff --git a/ext/gd/tests/libgd00100.phpt b/ext/gd/tests/libgd00100.phpt index abf4ee3339..49716d7107 100644 --- a/ext/gd/tests/libgd00100.phpt +++ b/ext/gd/tests/libgd00100.phpt @@ -107,7 +107,7 @@ $points = array( imagefilledpolygon($im, $points, 5, $black); ob_start(); -imagepng($im); +imagegd($im); $png = ob_get_contents(); ob_end_clean(); @@ -116,4 +116,4 @@ echo md5($png); imagedestroy($im); ?> --EXPECTF-- -2e6cf558bb4dadf60c8b608d5f8cda4e +df7253c765280396f303166f10ba9283 |