diff options
author | Rafael Machado Dohms <rdohms@php.net> | 2009-08-24 02:50:19 +0000 |
---|---|---|
committer | Rafael Machado Dohms <rdohms@php.net> | 2009-08-24 02:50:19 +0000 |
commit | 609a573b23ccbb2d8684579c18765857430804f0 (patch) | |
tree | 9eb82ea34e0f1f379508ffbedf91b11163457904 /ext/gd | |
parent | e4c11010f16a0643d0c3c0280314a5589096f632 (diff) | |
download | php-git-609a573b23ccbb2d8684579c18765857430804f0.tar.gz |
Adding tests for imagecolorallocatealpha
Diffstat (limited to 'ext/gd')
-rw-r--r-- | ext/gd/tests/imagecolorallocatealpha_basic.phpt | 30 | ||||
-rw-r--r-- | ext/gd/tests/imagecolorallocatealpha_error1.phpt | 25 | ||||
-rw-r--r-- | ext/gd/tests/imagecolorallocatealpha_error2.phpt | 22 | ||||
-rw-r--r-- | ext/gd/tests/imagecolorallocatealpha_error3.phpt | 22 | ||||
-rw-r--r-- | ext/gd/tests/imagecolorallocatealpha_error4.phpt | 22 | ||||
-rw-r--r-- | ext/gd/tests/imagecolorallocatealpha_error5.phpt | 22 |
6 files changed, 143 insertions, 0 deletions
diff --git a/ext/gd/tests/imagecolorallocatealpha_basic.phpt b/ext/gd/tests/imagecolorallocatealpha_basic.phpt new file mode 100644 index 0000000000..720c50098a --- /dev/null +++ b/ext/gd/tests/imagecolorallocatealpha_basic.phpt @@ -0,0 +1,30 @@ +--TEST-- +Testing imagecolorallocatealpha() +--CREDITS-- +Rafael Dohms <rdohms [at] gmail [dot] com> +--SKIPIF-- +<?php + if (!extension_loaded("gd")) die("skip GD not present"); +?> +--FILE-- +<?php +$img = imagecreatetruecolor(150, 150); + +$cor = imagecolorallocate($img, 50, 100, 255); +$corA = imagecolorallocatealpha($img, 50, 100, 255, 50); +//$whiteA = imagecolorallocatealpha($img, 255, 255, 255, 127); + +$half = imagefilledarc ( $img, 75, 75, 70, 70, 0, 180, $cor, IMG_ARC_PIE ); +$half2 = imagefilledarc ( $img, 75, 75, 70, 70, 180, 360, $corA, IMG_ARC_PIE ); + +ob_start(); +imagepng($img, null, 9); +$imgsrc = ob_get_contents(); +ob_end_clean(); + +var_dump(md5(base64_encode($imgsrc))); +var_dump($corA); +?> +--EXPECT-- +string(32) "b856a0b1a15efe0f79551ebbb5651fe8" +int(842163455)
\ No newline at end of file diff --git a/ext/gd/tests/imagecolorallocatealpha_error1.phpt b/ext/gd/tests/imagecolorallocatealpha_error1.phpt new file mode 100644 index 0000000000..a9030248bb --- /dev/null +++ b/ext/gd/tests/imagecolorallocatealpha_error1.phpt @@ -0,0 +1,25 @@ +--TEST-- +Testing imagecolorallocatealpha(): Wrong types for parameter 1 +--CREDITS-- +Rafael Dohms <rdohms [at] gmail [dot] com> +--SKIPIF-- +<?php + if (!extension_loaded("gd")) die("skip GD not present"); +?> +--FILE-- +<?php +$resource = tmpfile(); + +imagecolorallocatealpha($resource, 255, 255, 255, 50); +imagecolorallocatealpha('string', 255, 255, 255, 50); +imagecolorallocatealpha(array(), 255, 255, 255, 50); +imagecolorallocatealpha(null, 255, 255, 255, 50); +?> +--EXPECTF-- +Warning: imagecolorallocatealpha(): supplied resource is not a valid Image resource in %s on line %d + +Warning: imagecolorallocatealpha() expects parameter 1 to be resource, %s given in %s on line %d + +Warning: imagecolorallocatealpha() expects parameter 1 to be resource, array given in %s on line %d + +Warning: imagecolorallocatealpha() expects parameter 1 to be resource, null given in %s on line %d
\ No newline at end of file diff --git a/ext/gd/tests/imagecolorallocatealpha_error2.phpt b/ext/gd/tests/imagecolorallocatealpha_error2.phpt new file mode 100644 index 0000000000..ba9e5de699 --- /dev/null +++ b/ext/gd/tests/imagecolorallocatealpha_error2.phpt @@ -0,0 +1,22 @@ +--TEST-- +Testing imagecolorallocatealpha(): Wrong types for parameter 2 +--CREDITS-- +Rafael Dohms <rdohms [at] gmail [dot] com> +--SKIPIF-- +<?php + if (!extension_loaded("gd")) die("skip GD not present"); +?> +--FILE-- +<?php +$img = imagecreatetruecolor(200, 200); + +imagecolorallocatealpha($img, 'string-non-numeric', 255, 255, 50); +imagecolorallocatealpha($img, array(), 255, 255, 50); +imagecolorallocatealpha($img, tmpfile(), 255, 255, 50); +?> +--EXPECTF-- +Warning: imagecolorallocatealpha() expects parameter 2 to be long, %s given in %s on line %d + +Warning: imagecolorallocatealpha() expects parameter 2 to be long, array given in %s on line %d + +Warning: imagecolorallocatealpha() expects parameter 2 to be long, resource given in %s on line %d
\ No newline at end of file diff --git a/ext/gd/tests/imagecolorallocatealpha_error3.phpt b/ext/gd/tests/imagecolorallocatealpha_error3.phpt new file mode 100644 index 0000000000..ee8f646e78 --- /dev/null +++ b/ext/gd/tests/imagecolorallocatealpha_error3.phpt @@ -0,0 +1,22 @@ +--TEST-- +Testing imagecolorallocatealpha(): Wrong types for parameter 3 +--CREDITS-- +Rafael Dohms <rdohms [at] gmail [dot] com> +--SKIPIF-- +<?php + if (!extension_loaded("gd")) die("skip GD not present"); +?> +--FILE-- +<?php +$img = imagecreatetruecolor(200, 200); + +imagecolorallocatealpha($img, 255, 'string-non-numeric', 255, 50); +imagecolorallocatealpha($img, 255, array(), 255, 50); +imagecolorallocatealpha($img, 255, tmpfile(), 255, 50); +?> +--EXPECTF-- +Warning: imagecolorallocatealpha() expects parameter 3 to be long, %s given in %s on line %d + +Warning: imagecolorallocatealpha() expects parameter 3 to be long, array given in %s on line %d + +Warning: imagecolorallocatealpha() expects parameter 3 to be long, resource given in %s on line %d
\ No newline at end of file diff --git a/ext/gd/tests/imagecolorallocatealpha_error4.phpt b/ext/gd/tests/imagecolorallocatealpha_error4.phpt new file mode 100644 index 0000000000..2b5b471890 --- /dev/null +++ b/ext/gd/tests/imagecolorallocatealpha_error4.phpt @@ -0,0 +1,22 @@ +--TEST-- +Testing imagecolorallocatealpha(): Wrong types for parameter 4 +--CREDITS-- +Rafael Dohms <rdohms [at] gmail [dot] com> +--SKIPIF-- +<?php + if (!extension_loaded("gd")) die("skip GD not present"); +?> +--FILE-- +<?php +$img = imagecreatetruecolor(200, 200); + +imagecolorallocatealpha($img, 255, 255, 'string-non-numeric', 50); +imagecolorallocatealpha($img, 255, 255, array(), 50); +imagecolorallocatealpha($img, 255, 255, tmpfile(), 50); +?> +--EXPECTF-- +Warning: imagecolorallocatealpha() expects parameter 4 to be long, %s given in %s on line %d + +Warning: imagecolorallocatealpha() expects parameter 4 to be long, array given in %s on line %d + +Warning: imagecolorallocatealpha() expects parameter 4 to be long, resource given in %s on line %d
\ No newline at end of file diff --git a/ext/gd/tests/imagecolorallocatealpha_error5.phpt b/ext/gd/tests/imagecolorallocatealpha_error5.phpt new file mode 100644 index 0000000000..2d77833e9c --- /dev/null +++ b/ext/gd/tests/imagecolorallocatealpha_error5.phpt @@ -0,0 +1,22 @@ +--TEST-- +Testing imagecolorallocatealpha(): Wrong types for parameter 5 +--CREDITS-- +Rafael Dohms <rdohms [at] gmail [dot] com> +--SKIPIF-- +<?php + if (!extension_loaded("gd")) die("skip GD not present"); +?> +--FILE-- +<?php +$img = imagecreatetruecolor(200, 200); + +imagecolorallocatealpha($img, 255, 255, 255, 'string-non-numeric'); +imagecolorallocatealpha($img, 255, 255, 255, array()); +imagecolorallocatealpha($img, 255, 255, 255, tmpfile()); +?> +--EXPECTF-- +Warning: imagecolorallocatealpha() expects parameter 5 to be long, %s given in %s on line %d + +Warning: imagecolorallocatealpha() expects parameter 5 to be long, array given in %s on line %d + +Warning: imagecolorallocatealpha() expects parameter 5 to be long, resource given in %s on line %d
\ No newline at end of file |