Skip to content

Commit 1bdcfd6

Browse files
committed
update imagewebp/imagepng test
1 parent 0cca369 commit 1bdcfd6

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

ext/gd/tests/pngcomp.phpt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,20 @@ gd
1212
<?php
1313
$cwd = __DIR__;
1414

15-
echo "PNG compression test: ";
1615

1716
$im = imagecreatetruecolor(20,20);
1817
imagefilledrectangle($im, 5,5, 10,10, 0xffffff);
18+
try {
19+
imagepng($im, $cwd . '/test_pngcomp.png', -2);
20+
} catch (\ValueError $e) {
21+
echo $e->getMessage() . PHP_EOL;
22+
}
23+
try {
24+
imagepng($im, $cwd . '/test_pngcomp.png', 10);
25+
} catch (\ValueError $e) {
26+
echo $e->getMessage() . PHP_EOL;
27+
}
28+
echo "PNG compression test: ";
1929
imagepng($im, $cwd . '/test_pngcomp.png', 9);
2030

2131
$im2 = imagecreatefrompng($cwd . '/test_pngcomp.png');
@@ -27,4 +37,6 @@ gd
2737
@unlink($cwd . "/test_pngcomp.png");
2838
?>
2939
--EXPECT--
40+
imagepng(): Argument #3 ($quality) must be between -1 and 9
41+
imagepng(): Argument #3 ($quality) must be between -1 and 9
3042
PNG compression test: ok

ext/gd/tests/webp_basic.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ $im_lossless = imagecreatefromwebp($filename);
3737
echo 'Does lossless conversion work? ';
3838
var_dump(calc_image_dissimilarity($im1, $im_lossless) == 0);
3939

40+
try {
41+
imagewebp($im1, $filename, -10);
42+
} catch (\ValueError $e) {
43+
echo $e->getMessage();
44+
}
45+
4046
?>
4147
--CLEAN--
4248
<?php
@@ -45,3 +51,4 @@ var_dump(calc_image_dissimilarity($im1, $im_lossless) == 0);
4551
--EXPECT--
4652
Is lossy conversion close enough? bool(true)
4753
Does lossless conversion work? bool(true)
54+
imagewebp(): Argument #3 ($quality) must be at least -1

0 commit comments

Comments
 (0)