cvs: php-src /ext/gd/tests pngcomp.phpt
| From: | Pierre-Alain Joye | Date: | Fri, 09 Dec 2005 18:14:12 +0000 |
| Subject: | cvs: php-src /ext/gd/tests pngcomp.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-35844@lists.php.net to get a copy of this message | ||
pajoye Fri Dec 9 13:14:12 2005 EDT
Modified files:
/php-src/ext/gd/tests pngcomp.phpt
Log:
- MFB: test for compression mode in imagepng
http://cvs.php.net/diff.php/php-src/ext/gd/tests/pngcomp.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/gd/tests/pngcomp.phpt
diff -u /dev/null php-src/ext/gd/tests/pngcomp.phpt:1.2
--- /dev/null Fri Dec 9 13:14:12 2005
+++ php-src/ext/gd/tests/pngcomp.phpt Fri Dec 9 13:14:12 2005
@@ -0,0 +1,37 @@
+--TEST--
+png compression test
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) {
+ die("skip gd extension not available.");
+ }
+ if (!GD_BUNDLED) {
+ die("skip external GD libraries always fail");
+ }
+ if (!function_exists("imagecreatefrompng") || !function_exists("imagepng")) {
+ die("skip png support unavailable");
+ }
+ if (!function_exists("imagecreatefromjpeg") || !function_exists("imagejpeg"))
{
+ die("skip jpeg support unavailable");
+ }
+?>
+--FILE--
+<?php
+ $cwd = dirname(__FILE__);
+
+ echo "PNG compression test: ";
+
+ $im = imagecreatetruecolor(20,20);
+ imagefilledrectangle($im, 5,5, 10,10, 0xffffff);
+ imagepng($im, $cwd . '/test_pngcomp.png', 9);
+
+ $im2 = imagecreatefrompng($cwd . '/test_pngcomp.png');
+ $col = imagecolorat($im2, 8,8);
+ if ($col == 0xffffff) {
+ echo "ok\n";
+ }
+
+ @unlink($cwd . "/test_pngcomp.png");
+?>
+--EXPECT--
+PNG compression test: ok