mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Make imagebmp_basic.phpt more resilient (GH-17265)
Checking for the exact output of most image formats is brittle; even an otherwise change to some header field causes the output to change, even if the image would be visually identical. Checking for an (MD5) hash is even worse, since if the tests fails, we have no clue for what reason. Thus we compare the generated image against an pre-generated PNG, using a test helper which will output a simple image diff in case of test failure.
This commit is contained in:
committed by
GitHub
parent
1331444822
commit
c1c6520c4f
@@ -14,10 +14,8 @@ imagecolorallocate($im, 0, 0, 0);
|
||||
$white = imagecolorallocate($im, 255, 255, 255);
|
||||
imageline($im, 10,10, 89,89, $white);
|
||||
|
||||
// write the md5 hash of its BMP representation
|
||||
ob_start();
|
||||
imagebmp($im);
|
||||
echo md5(ob_get_clean());
|
||||
require __DIR__ . "/func.inc";
|
||||
test_image_equals_file(__DIR__ . "/imagebmp_basic.png", $im);
|
||||
?>
|
||||
--EXPECT--
|
||||
d49124076771822b09fa72e168c0de56
|
||||
The images are equal.
|
||||
|
||||
BIN
ext/gd/tests/imagebmp_basic.png
Normal file
BIN
ext/gd/tests/imagebmp_basic.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 141 B |
Reference in New Issue
Block a user