diff options
| author | Zoe Slattery <zoe@php.net> | 2009-08-26 17:17:58 +0000 |
|---|---|---|
| committer | Zoe Slattery <zoe@php.net> | 2009-08-26 17:17:58 +0000 |
| commit | 1c98e49afd36a73c01edf1124fc69bc38370c7e4 (patch) | |
| tree | c92d8655bff4a3e09850b0cacd1113ff7d3daa0e /ext/gd | |
| parent | c7167ced0bc5da4703c29f03a586988a97bff299 (diff) | |
| download | php-git-1c98e49afd36a73c01edf1124fc69bc38370c7e4.tar.gz | |
Test from 2009 testfest
Diffstat (limited to 'ext/gd')
| -rw-r--r-- | ext/gd/tests/imagegammacorrect_variation1.phpt | 32 | ||||
| -rwxr-xr-x | ext/gd/tests/imagerectangle_basic.phpt | 27 | ||||
| -rwxr-xr-x | ext/gd/tests/imagerectangle_error2.phpt | 19 |
3 files changed, 78 insertions, 0 deletions
diff --git a/ext/gd/tests/imagegammacorrect_variation1.phpt b/ext/gd/tests/imagegammacorrect_variation1.phpt new file mode 100644 index 0000000000..cda96c6287 --- /dev/null +++ b/ext/gd/tests/imagegammacorrect_variation1.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing imagegammacorrect() of GD library with non TrueColor image +--CREDITS-- +Rafael Dohms <rdohms [at] gmail [dot] com> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php + if (!extension_loaded("gd")) die("skip GD not present"); +?> +--FILE-- +<?php +$image = imagecreate(150, 150); + +$grey = imagecolorallocate($image,6,6,6); +$gray = imagecolorallocate($image,15,15,15); + +$half = imagefilledarc ( $image, 75, 75, 70, 70, 0, 180, $grey, IMG_ARC_PIE ); +$half2 = imagefilledarc ( $image, 75, 75, 70, 70, 0, -180, $gray, IMG_ARC_PIE ); + +$gamma = imagegammacorrect($image, 1, 5); + +if ($gamma){ + ob_start(); + imagepng($image, null, 9); + $img = ob_get_contents(); + ob_end_clean(); +} + +echo md5(base64_encode($img)); +?> +--EXPECT-- +7716c0905ae08bd84b4d6cba8969a42e diff --git a/ext/gd/tests/imagerectangle_basic.phpt b/ext/gd/tests/imagerectangle_basic.phpt new file mode 100755 index 0000000000..0574ad35cb --- /dev/null +++ b/ext/gd/tests/imagerectangle_basic.phpt @@ -0,0 +1,27 @@ +--TEST--
+Testing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
+
+ob_start();
+imagepng( $image, null, 9 );
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+
+?>
+--EXPECT--
+282aaecfdd50091821d63093d9bb1bb9
\ No newline at end of file diff --git a/ext/gd/tests/imagerectangle_error2.phpt b/ext/gd/tests/imagerectangle_error2.phpt new file mode 100755 index 0000000000..c6e740214a --- /dev/null +++ b/ext/gd/tests/imagerectangle_error2.phpt @@ -0,0 +1,19 @@ +--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a resource
+$image = tmpfile();
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50, 2 );
+?>
+--EXPECTF--
+Warning: imagerectangle(): supplied resource is not a valid Image resource in %s on line %d
\ No newline at end of file |
