]> granicus.if.org Git - php/commitdiff
- add test
authorPierre Joye <pierre.php@gmail.com>
Wed, 27 Feb 2013 19:22:45 +0000 (20:22 +0100)
committerPierre Joye <pierre.php@gmail.com>
Wed, 27 Feb 2013 19:22:45 +0000 (20:22 +0100)
ext/gd/tests/imageflip.phpt [new file with mode: 0644]

diff --git a/ext/gd/tests/imageflip.phpt b/ext/gd/tests/imageflip.phpt
new file mode 100644 (file)
index 0000000..a1922c2
--- /dev/null
@@ -0,0 +1,31 @@
+--TEST-- \r
+Testing imageflip() of GD library \r
+--SKIPIF-- \r
+<?php  \r
+if ( ! extension_loaded('gd') || !function_exists('imageflip')) die( 'skip GD not present; skipping test' ); \r
+?> \r
+--FILE--\r
+<?php\r
+\r
+$im = imagecreatetruecolor( 99, 99 ); \r
+\r
+imagesetpixel($im, 0, 0, 0xFF);\r
+imagesetpixel($im, 0, 98, 0x00FF00);\r
+imagesetpixel($im, 98, 0, 0xFF0000);\r
+imagesetpixel($im, 98, 98, 0x0000FF);\r
+\r
+imageflip($im, IMG_FLIP_HORINZONTAL);\r
+imageflip($im, IMG_FLIP_VERTICAL);\r
+imageflip($im, IMG_FLIP_BOTH);\r
+\r
+\r
+var_dump(dechex(imagecolorat($im, 0, 0)));\r
+var_dump(dechex(imagecolorat($im, 0, 98)));\r
+var_dump(dechex(imagecolorat($im, 98, 0)));\r
+var_dump(dechex(imagecolorat($im, 98, 98)));\r
+?> \r
+--EXPECT-- \r
+string(2) "ff"\r
+string(4) "ff00"\r
+string(6) "ff0000"\r
+string(2) "ff"
\ No newline at end of file