]> granicus.if.org Git - php/commitdiff
- MFH: New tests (SaoPaulo UG testfest)
authorFelipe Pena <felipe@php.net>
Wed, 1 Jul 2009 00:56:01 +0000 (00:56 +0000)
committerFelipe Pena <felipe@php.net>
Wed, 1 Jul 2009 00:56:01 +0000 (00:56 +0000)
119 files changed:
ext/gd/tests/imageantialias_error1.phpt [new file with mode: 0755]
ext/gd/tests/imageantialias_error2.phpt [new file with mode: 0755]
ext/gd/tests/imagearc_basic.phpt [new file with mode: 0755]
ext/gd/tests/imagearc_error1.phpt [new file with mode: 0755]
ext/gd/tests/imagearc_variation1.phpt [new file with mode: 0755]
ext/gd/tests/imagearc_variation2.phpt [new file with mode: 0755]
ext/gd/tests/imagechar_basic.phpt [new file with mode: 0644]
ext/gd/tests/imagechar_error1.phpt [new file with mode: 0644]
ext/gd/tests/imagechar_error2.phpt [new file with mode: 0644]
ext/gd/tests/imagechar_error3.phpt [new file with mode: 0644]
ext/gd/tests/imagechar_error4.phpt [new file with mode: 0644]
ext/gd/tests/imagechar_error5.phpt [new file with mode: 0644]
ext/gd/tests/imagechar_error6.phpt [new file with mode: 0644]
ext/gd/tests/imagechar_error7.phpt [new file with mode: 0644]
ext/gd/tests/imagecharup_basic.phpt [new file with mode: 0644]
ext/gd/tests/imagecharup_error1.phpt [new file with mode: 0644]
ext/gd/tests/imagecharup_error2.phpt [new file with mode: 0644]
ext/gd/tests/imagecharup_error3.phpt [new file with mode: 0644]
ext/gd/tests/imagecharup_error4.phpt [new file with mode: 0644]
ext/gd/tests/imagecharup_error5.phpt [new file with mode: 0644]
ext/gd/tests/imagecharup_error6.phpt [new file with mode: 0644]
ext/gd/tests/imagecharup_error7.phpt [new file with mode: 0644]
ext/gd/tests/imagecolordeallocate_basic.phpt [new file with mode: 0644]
ext/gd/tests/imagecolordeallocate_error1.phpt [new file with mode: 0644]
ext/gd/tests/imagecolordeallocate_error2.phpt [new file with mode: 0644]
ext/gd/tests/imagecolordeallocate_error3.phpt [new file with mode: 0644]
ext/gd/tests/imagecolordeallocate_error4.phpt [new file with mode: 0644]
ext/gd/tests/imagecolormatch_basic.phpt [new file with mode: 0755]
ext/gd/tests/imagecolormatch_error1.phpt [new file with mode: 0755]
ext/gd/tests/imagecolormatch_error2.phpt [new file with mode: 0755]
ext/gd/tests/imagecolormatch_error3.phpt [new file with mode: 0755]
ext/gd/tests/imagecolormatch_error4.phpt [new file with mode: 0755]
ext/gd/tests/imagecolorset_basic.phpt [new file with mode: 0755]
ext/gd/tests/imageconvolution_basic.phpt [new file with mode: 0755]
ext/gd/tests/imageconvolution_error1.phpt [new file with mode: 0755]
ext/gd/tests/imageconvolution_error2.phpt [new file with mode: 0755]
ext/gd/tests/imageconvolution_error3.phpt [new file with mode: 0755]
ext/gd/tests/imagecopymerge_basic.phpt [new file with mode: 0755]
ext/gd/tests/imagecopymerge_error.phpt [new file with mode: 0755]
ext/gd/tests/imageellipse_basic.phpt [new file with mode: 0755]
ext/gd/tests/imageellipse_error1.phpt [new file with mode: 0755]
ext/gd/tests/imageellipse_error2.phpt [new file with mode: 0755]
ext/gd/tests/imageellipse_error3.phpt [new file with mode: 0755]
ext/gd/tests/imageellipse_error4.phpt [new file with mode: 0755]
ext/gd/tests/imageellipse_error5.phpt [new file with mode: 0755]
ext/gd/tests/imageellipse_error6.phpt [new file with mode: 0755]
ext/gd/tests/imageellipse_error7.phpt [new file with mode: 0755]
ext/gd/tests/imagefilledarc_basic.phpt [new file with mode: 0755]
ext/gd/tests/imagefilledarc_error1.phpt [new file with mode: 0755]
ext/gd/tests/imagefilledarc_variation1.phpt [new file with mode: 0755]
ext/gd/tests/imagefilledarc_variation2.phpt [new file with mode: 0755]
ext/gd/tests/imagefilltoborder_basic.phpt [new file with mode: 0755]
ext/gd/tests/imagefilltoborder_error1.phpt [new file with mode: 0755]
ext/gd/tests/imagefilltoborder_error2.phpt [new file with mode: 0755]
ext/gd/tests/imagefilltoborder_error3.phpt [new file with mode: 0755]
ext/gd/tests/imagefilltoborder_error4.phpt [new file with mode: 0755]
ext/gd/tests/imagefilltoborder_error5.phpt [new file with mode: 0755]
ext/gd/tests/imagefilltoborder_error6.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error1.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error10.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error11.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error12.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error13.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error14.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error15.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error16.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error17.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error18.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error19.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error2.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error20.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error3.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error4.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error5.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error6.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error7.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error8.phpt [new file with mode: 0755]
ext/gd/tests/imagefilter_error9.phpt [new file with mode: 0755]
ext/gd/tests/imagefontheight_basic.phpt [new file with mode: 0644]
ext/gd/tests/imagefontheight_error1.phpt [new file with mode: 0644]
ext/gd/tests/imagefontwidth_basic.phpt [new file with mode: 0644]
ext/gd/tests/imagefontwidth_error1.phpt [new file with mode: 0644]
ext/gd/tests/imagegammacorrect_basic.phpt [new file with mode: 0644]
ext/gd/tests/imagegammacorrect_error1.phpt [new file with mode: 0644]
ext/gd/tests/imagegammacorrect_error2.phpt [new file with mode: 0644]
ext/gd/tests/imagegammacorrect_error3.phpt [new file with mode: 0644]
ext/gd/tests/imagegammacorrect_error4.phpt [new file with mode: 0644]
ext/gd/tests/imageinterlace_basic.phpt [new file with mode: 0755]
ext/gd/tests/imageinterlace_error1.phpt [new file with mode: 0755]
ext/gd/tests/imageinterlace_error2.phpt [new file with mode: 0755]
ext/gd/tests/imageinterlace_variation1.phpt [new file with mode: 0755]
ext/gd/tests/imageinterlace_variation2.phpt [new file with mode: 0755]
ext/gd/tests/imagelayereffect_basic.phpt [new file with mode: 0644]
ext/gd/tests/imagelayereffect_error1.phpt [new file with mode: 0644]
ext/gd/tests/imagelayereffect_error2.phpt [new file with mode: 0644]
ext/gd/tests/imagelayereffect_error3.phpt [new file with mode: 0644]
ext/gd/tests/imagesetbrush_basic.phpt [new file with mode: 0755]
ext/gd/tests/imagestring_basic.phpt [new file with mode: 0644]
ext/gd/tests/imagestring_error1.phpt [new file with mode: 0644]
ext/gd/tests/imagestring_error2.phpt [new file with mode: 0644]
ext/gd/tests/imagestring_error3.phpt [new file with mode: 0644]
ext/gd/tests/imagestring_error4.phpt [new file with mode: 0644]
ext/gd/tests/imagestring_error5.phpt [new file with mode: 0644]
ext/gd/tests/imagestring_error6.phpt [new file with mode: 0644]
ext/gd/tests/imagestring_error7.phpt [new file with mode: 0644]
ext/gd/tests/imagestringup_basic.phpt [new file with mode: 0644]
ext/gd/tests/imagestringup_error1.phpt [new file with mode: 0644]
ext/gd/tests/imagestringup_error2.phpt [new file with mode: 0644]
ext/gd/tests/imagestringup_error3.phpt [new file with mode: 0644]
ext/gd/tests/imagestringup_error4.phpt [new file with mode: 0644]
ext/gd/tests/imagestringup_error5.phpt [new file with mode: 0644]
ext/gd/tests/imagestringup_error6.phpt [new file with mode: 0644]
ext/gd/tests/imagestringup_error7.phpt [new file with mode: 0644]
ext/gd/tests/jpeg2wbmp_error1.phpt [new file with mode: 0755]
ext/gd/tests/jpeg2wbmp_error2.phpt [new file with mode: 0755]
ext/gd/tests/jpeg2wbmp_error3.phpt [new file with mode: 0755]
ext/gd/tests/png2wbmp_error1.phpt [new file with mode: 0755]
ext/gd/tests/png2wbmp_error2.phpt [new file with mode: 0755]
ext/gd/tests/png2wbmp_error3.phpt [new file with mode: 0755]

diff --git a/ext/gd/tests/imageantialias_error1.phpt b/ext/gd/tests/imageantialias_error1.phpt
new file mode 100755 (executable)
index 0000000..53fe0cc
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource in imageantialias() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imageantialias($image, true));
+?>
+--EXPECTF--
+Warning: imageantialias(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imageantialias_error2.phpt b/ext/gd/tests/imageantialias_error2.phpt
new file mode 100755 (executable)
index 0000000..8dad8bd
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+Testing wrong parameter passing in imageantialias() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+/*
+
+It seems the second argument passing is not being correclty checked.
+This test is failing due to this wrogn check
+
+*/
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imageantialias($image, 'wrong param')); // 'wrogn param' is converted to true
+?>
+--EXPECTF--
+bool(true)
diff --git a/ext/gd/tests/imagearc_basic.phpt b/ext/gd/tests/imagearc_basic.phpt
new file mode 100755 (executable)
index 0000000..4647dd1
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+Testing imagearc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc with white color    
+imagearc($image, 50, 50, 30, 30, 0, 180, $white);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+f18ad8001afefee2e9b8c08d6884425b
diff --git a/ext/gd/tests/imagearc_error1.phpt b/ext/gd/tests/imagearc_error1.phpt
new file mode 100755 (executable)
index 0000000..423f035
--- /dev/null
@@ -0,0 +1,29 @@
+--TEST--
+Testing wrong param passing imagearc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc with white color    
+imagearc($image, 50, 50, 30, 30, 0, 180);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECTF--
+Warning: imagearc() expects exactly 8 parameters, 7 given in %s on line %d
+abebb25b5a2813cfbf92f1f24365786a
diff --git a/ext/gd/tests/imagearc_variation1.phpt b/ext/gd/tests/imagearc_variation1.phpt
new file mode 100755 (executable)
index 0000000..568d3a6
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+Testing passing negative end angle to imagearc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc with white color    
+imagearc($image, 50, 50, 30, 30, 0, -90, $white);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+ed2c8427a9922dfd8a105f10a88a0d20
diff --git a/ext/gd/tests/imagearc_variation2.phpt b/ext/gd/tests/imagearc_variation2.phpt
new file mode 100755 (executable)
index 0000000..045c68e
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+Testing passing negative start angle to imagearc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc with white color    
+imagearc($image, 50, 50, 30, 30, -90, 0, $white);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+463b4aea9d9acfab30016ee92613c779
diff --git a/ext/gd/tests/imagechar_basic.phpt b/ext/gd/tests/imagechar_basic.phpt
new file mode 100644 (file)
index 0000000..7e5fa93
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+Testing imagechar() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$white = imagecolorallocate($image, 255,255,255);
+
+$result = imagechar($image, 1, 5, 5, 'C', $white);
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+e94962ac28ad03bd4142cb1abe9ef98b
diff --git a/ext/gd/tests/imagechar_error1.phpt b/ext/gd/tests/imagechar_error1.phpt
new file mode 100644 (file)
index 0000000..373d304
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-resource parameter 1 of imagechar() of GD library
+--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
+
+$result = imagechar('string', 1, 5, 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagechar() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagechar_error2.phpt b/ext/gd/tests/imagechar_error2.phpt
new file mode 100644 (file)
index 0000000..02a9599
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-image resource parameter 1 of imagechar() of GD library
+--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
+
+$result = imagechar(tmpfile(), 1, 5, 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagechar(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagechar_error3.phpt b/ext/gd/tests/imagechar_error3.phpt
new file mode 100644 (file)
index 0000000..aec65e9
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 2 of imagechar() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagechar($image, 'string', 5, 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagechar() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagechar_error4.phpt b/ext/gd/tests/imagechar_error4.phpt
new file mode 100644 (file)
index 0000000..a9485f7
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 3 of imagechar() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagechar($image, 1, 'string', 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagechar() expects parameter 3 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagechar_error5.phpt b/ext/gd/tests/imagechar_error5.phpt
new file mode 100644 (file)
index 0000000..8670d19
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 4 of imagechar() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagechar($image, 1, 5, 'string', 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagechar() expects parameter 4 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagechar_error6.phpt b/ext/gd/tests/imagechar_error6.phpt
new file mode 100644 (file)
index 0000000..eaef2f8
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-string parameter 5 of imagechar() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagechar($image, 1, 5, 5, $image, 1);
+
+?>
+--EXPECTF--
+Warning: imagechar() expects parameter 5 to be string%S, %s given in %s on line %d
diff --git a/ext/gd/tests/imagechar_error7.phpt b/ext/gd/tests/imagechar_error7.phpt
new file mode 100644 (file)
index 0000000..fae23a7
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 6 of imagechar() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagechar($image, 1, 5, 5, 'C', 'font');
+
+?>
+--EXPECTF--
+Warning: imagechar() expects parameter 6 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagecharup_basic.phpt b/ext/gd/tests/imagecharup_basic.phpt
new file mode 100644 (file)
index 0000000..54c8dfa
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+Testing imagecharup() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$white = imagecolorallocate($image, 255,255,255);
+
+$result = imagecharup($image, 1, 5, 5, 'C', $white);
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+79b48d5cef6d489bb68573df0296d775
diff --git a/ext/gd/tests/imagecharup_error1.phpt b/ext/gd/tests/imagecharup_error1.phpt
new file mode 100644 (file)
index 0000000..e0b3e31
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-resource parameter 1 of imagecharup() of GD library
+--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
+
+$result = imagecharup('string', 1, 5, 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagecharup() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagecharup_error2.phpt b/ext/gd/tests/imagecharup_error2.phpt
new file mode 100644 (file)
index 0000000..b78dc92
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-image resource parameter 1 of imagecharup() of GD library
+--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
+
+$result = imagecharup(tmpfile(), 1, 5, 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagecharup(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagecharup_error3.phpt b/ext/gd/tests/imagecharup_error3.phpt
new file mode 100644 (file)
index 0000000..7e811ba
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 2 of imagecharup() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagecharup($image, 'string', 5, 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagecharup() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagecharup_error4.phpt b/ext/gd/tests/imagecharup_error4.phpt
new file mode 100644 (file)
index 0000000..f76fdac
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 3 of imagecharup() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagecharup($image, 1, 'string', 5, 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagecharup() expects parameter 3 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagecharup_error5.phpt b/ext/gd/tests/imagecharup_error5.phpt
new file mode 100644 (file)
index 0000000..b565259
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 4 of imagecharup() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagecharup($image, 1, 5, 'string', 'C', 1);
+
+?>
+--EXPECTF--
+Warning: imagecharup() expects parameter 4 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagecharup_error6.phpt b/ext/gd/tests/imagecharup_error6.phpt
new file mode 100644 (file)
index 0000000..a1f12f1
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-string parameter 5 of imagecharup() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagecharup($image, 1, 5, 5, $image, 1);
+
+?>
+--EXPECTF--
+Warning: imagecharup() expects parameter 5 to be string%S, %s given in %s on line %d
diff --git a/ext/gd/tests/imagecharup_error7.phpt b/ext/gd/tests/imagecharup_error7.phpt
new file mode 100644 (file)
index 0000000..b61189a
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 6 of imagecharup() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagecharup($image, 1, 5, 5, 'C', 'font');
+
+?>
+--EXPECTF--
+Warning: imagecharup() expects parameter 6 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagecolordeallocate_basic.phpt b/ext/gd/tests/imagecolordeallocate_basic.phpt
new file mode 100644 (file)
index 0000000..3c80c69
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+Testing imagecolordeallocate() of GD library
+--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 = imagecreatetruecolor(180, 30);
+
+$white = imagecolorallocate($image, 255, 255, 255);
+$result = imagecolordeallocate($image, $white);
+
+var_dump($result);
+
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/gd/tests/imagecolordeallocate_error1.phpt b/ext/gd/tests/imagecolordeallocate_error1.phpt
new file mode 100644 (file)
index 0000000..6d642d4
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+Testing imagecolordeallocate() of GD library with invalid resource type
+--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 = imagecreatetruecolor(180, 30);
+$white = imagecolorallocate($image, 255, 255, 255);
+
+$resource = tmpfile();
+
+$result = imagecolordeallocate($resource, $white);
+
+?>
+--EXPECTF--
+Warning: imagecolordeallocate(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagecolordeallocate_error2.phpt b/ext/gd/tests/imagecolordeallocate_error2.phpt
new file mode 100644 (file)
index 0000000..989e0fd
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+Testing imagecolordeallocate() of GD library with no resource
+--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 = imagecreatetruecolor(180, 30);
+$white = imagecolorallocate($image, 255, 255, 255);
+$result = imagecolordeallocate('image', $white);
+
+?>
+--EXPECTF--
+Warning: imagecolordeallocate() expects parameter 1 to be resource, %s given %s on line %d
diff --git a/ext/gd/tests/imagecolordeallocate_error3.phpt b/ext/gd/tests/imagecolordeallocate_error3.phpt
new file mode 100644 (file)
index 0000000..8000218
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+Testing imagecolordeallocate() of GD library with Out of range intergers (Above)
+--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(180, 30);
+$white = imagecolorallocate($image, 255, 255, 255);
+
+$totalColors = imagecolorstotal($image);
+
+$result = imagecolordeallocate($image, $totalColors + 100);
+var_dump($result);
+?>
+--EXPECTF--
+Warning: imagecolordeallocate(): Color index 101 out of range in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagecolordeallocate_error4.phpt b/ext/gd/tests/imagecolordeallocate_error4.phpt
new file mode 100644 (file)
index 0000000..7aaeffe
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+Testing imagecolordeallocate() of GD library with Out of range intergers (Below)
+--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(180, 30);
+$white = imagecolorallocate($image, 255, 255, 255);
+
+$totalColors = imagecolorstotal($image);
+
+$result = imagecolordeallocate($image, -1.0);
+var_dump($result);
+?>
+--EXPECTF--
+Warning: imagecolordeallocate(): Color index -1 out of range in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagecolormatch_basic.phpt b/ext/gd/tests/imagecolormatch_basic.phpt
new file mode 100755 (executable)
index 0000000..1d18812
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+Basic test imagecolormatch() of GD library
+--CREDITS--
+Paulo Alves de Sousa Filho <pspalves [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$ima = imagecreatetruecolor(110, 20);
+$background_color = imagecolorallocate($ima, 0, 0, 0);
+$imb = imagecreate(110, 20);
+$background_color = imagecolorallocate($imb, 0, 0, 100);
+var_dump(imagecolormatch($ima, $imb));
+?>
+--EXPECTF--
+bool(true)
diff --git a/ext/gd/tests/imagecolormatch_error1.phpt b/ext/gd/tests/imagecolormatch_error1.phpt
new file mode 100755 (executable)
index 0000000..9750a8b
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Send only 1 parameter imagecolormatch() of GD library
+--CREDITS--
+Paulo Alves de Sousa Filho <pspalves [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$ima = imagecreatetruecolor(110, 20);
+$background_color = imagecolorallocate($ima, 0, 0, 0);
+var_dump(imagecolormatch($ima));
+?>
+--EXPECTF--
+Warning: imagecolormatch() expects exactly 2 parameters, %d given in %s on line %d
+NULL
diff --git a/ext/gd/tests/imagecolormatch_error2.phpt b/ext/gd/tests/imagecolormatch_error2.phpt
new file mode 100755 (executable)
index 0000000..bdb3c24
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+Send not TrueColor to Image 1 parameter imagecolormatch() of GD library
+--CREDITS--
+Paulo Alves de Sousa Filho <pspalves [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$ima = imagecreate(110, 20);
+$background_color = imagecolorallocate($ima, 0, 0, 0);
+$imb = imagecreate(110, 20);
+$background_color = imagecolorallocate($imb, 0, 0, 100);
+var_dump(imagecolormatch($ima, $imb));
+?>
+--EXPECTF--
+Warning: imagecolormatch(): Image1 must be TrueColor in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagecolormatch_error3.phpt b/ext/gd/tests/imagecolormatch_error3.phpt
new file mode 100755 (executable)
index 0000000..8793e15
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+Send not TrueColor to Image 1 parameter imagecolormatch() of GD library
+--CREDITS--
+Paulo Alves de Sousa Filho <pspalves [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$ima = imagecreatetruecolor(110, 20);
+$background_color = imagecolorallocate($ima, 0, 0, 0);
+$imb = imagecreatetruecolor(110, 20);
+$background_color = imagecolorallocate($imb, 0, 0, 100);
+var_dump(imagecolormatch($ima, $imb));
+?>
+--EXPECTF--
+Warning: imagecolormatch(): Image2 must be Palette in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagecolormatch_error4.phpt b/ext/gd/tests/imagecolormatch_error4.phpt
new file mode 100755 (executable)
index 0000000..0bfe767
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+using different image sizes imagecolormatch() of GD library
+--CREDITS--
+Paulo Alves de Sousa Filho <pspalves [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$ima = imagecreatetruecolor(110, 20);
+$background_color = imagecolorallocate($ima, 0, 0, 0);
+$imb = imagecreate(100, 20);
+$background_color = imagecolorallocate($imb, 0, 0, 100);
+var_dump(imagecolormatch($ima, $imb));
+?>
+--EXPECTF--
+Warning: imagecolormatch(): Image1 and Image2 must be the same size in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagecolorset_basic.phpt b/ext/gd/tests/imagecolorset_basic.phpt
new file mode 100755 (executable)
index 0000000..a1776ff
--- /dev/null
@@ -0,0 +1,35 @@
+--TEST--
+Test imagecolorset() function : basic functionality
+--CREDITS--
+Erick Belluci Tedeschi <erickbt86 [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) {
+       die('skip gd extension is not loaded');
+}
+?>
+--FILE--
+<?php
+// Create a 300x100 image
+$im = imagecreate(300, 100);
+
+// Set the background to be red
+imagecolorallocate($im, 255, 0, 0);
+
+// Get the color index for the background
+$bg = imagecolorat($im, 0, 0);
+
+// Set the backgrund to be blue
+imagecolorset($im, $bg, 0, 0, 255);
+
+// Get output and generate md5 hash
+ob_start();
+imagepng($im, null, 9);
+$result_image = ob_get_contents();
+ob_end_clean();
+echo md5(base64_encode($result_image));
+imagedestroy($im);
+?>
+--EXPECT--
+6f2002aafb57b2d275fad6a6258d7476
diff --git a/ext/gd/tests/imageconvolution_basic.phpt b/ext/gd/tests/imageconvolution_basic.phpt
new file mode 100755 (executable)
index 0000000..5a9aa8f
--- /dev/null
@@ -0,0 +1,33 @@
+--TEST--
+Testing imageconvolution() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+// Writes the text and apply a gaussian blur on the image
+imagestring($image, 5, 10, 8, 'Gaussian Blur Text', 0x00ff00);
+
+$gaussian = array(
+    array(1.0, 2.0, 1.0),
+    array(2.0, 4.0, 2.0),
+    array(1.0, 2.0, 1.0)
+);
+
+imageconvolution($image, $gaussian, 16, 0);
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+594576a2a2a689447ffc07eb5a73f09b
diff --git a/ext/gd/tests/imageconvolution_error1.phpt b/ext/gd/tests/imageconvolution_error1.phpt
new file mode 100755 (executable)
index 0000000..5dc250a
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+Testing wrong param passing imageconvolution() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+// Writes the text and apply a gaussian blur on the image
+imagestring($image, 5, 10, 8, 'Gaussian Blur Text', 0x00ff00);
+
+$gaussian = array(
+    array(1.0, 2.0, 1.0),
+    array(2.0, 4.0, 2.0),
+    array(1.0, 2.0, 1.0)
+);
+
+var_dump(imageconvolution($image, $gaussian, 16));
+?>
+--EXPECTF--
+Warning: imageconvolution() expects exactly 4 parameters, 3 given in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imageconvolution_error2.phpt b/ext/gd/tests/imageconvolution_error2.phpt
new file mode 100755 (executable)
index 0000000..5161c19
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST--
+Testing wrong array size 2x3 in imageconvolution() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+// Writes the text and apply a gaussian blur on the image
+imagestring($image, 5, 10, 8, 'Gaussian Blur Text', 0x00ff00);
+
+$gaussian = array(
+    array(1.0, 2.0, 1.0),
+    array(2.0, 4.0, 2.0)
+);
+
+var_dump(imageconvolution($image, $gaussian, 16, 0));
+?>
+--EXPECTF--
+Warning: imageconvolution(): You must have 3x3 array in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imageconvolution_error3.phpt b/ext/gd/tests/imageconvolution_error3.phpt
new file mode 100755 (executable)
index 0000000..df6b148
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+Testing wrong array size 3x2 in imageconvolution() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+// Writes the text and apply a gaussian blur on the image
+imagestring($image, 5, 10, 8, 'Gaussian Blur Text', 0x00ff00);
+
+$gaussian = array(
+    array(1.0, 2.0, 1.0),
+    array(2.0, 4.0, 2.0),
+    array(1.0, 2.0)
+);
+
+var_dump(imageconvolution($image, $gaussian, 16, 0));
+?>
+--EXPECTF--
+Warning: imageconvolution(): You must have 3x3 array in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagecopymerge_basic.phpt b/ext/gd/tests/imagecopymerge_basic.phpt
new file mode 100755 (executable)
index 0000000..85f1162
--- /dev/null
@@ -0,0 +1,30 @@
+--TEST--
+Testing imagecopymerge() of GD library
+--CREDITS--
+Cleston Viel Vieira de Sousa <cleston [dot] vs [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$des = imagecreate(120, 120);
+$src = imagecreate(100, 100);
+
+imagecolorallocate($des, 50, 50, 200);
+$colorTXT_des = imagecolorallocate($des, 255, 255, 255);
+
+imagecolorallocate($src, 255, 255, 255);
+$colorTXT_src = imagecolorallocate($src, 0, 255, 255);
+
+imagestring($src, 1, 5, 5,  "A Simple Text", $colorTXT_src);
+imagestring($des, 1, 5, 5,  "Another Simple Text", $colorTXT_des);
+
+var_dump(imagecopymerge($des, $src, 20, 20, 0, 0, 50, 50, 75));
+
+
+?>
+--EXPECTF--
+bool(true)
diff --git a/ext/gd/tests/imagecopymerge_error.phpt b/ext/gd/tests/imagecopymerge_error.phpt
new file mode 100755 (executable)
index 0000000..e43bf69
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing wrong parameter passing imagecopymerge() of GD library
+--CREDITS--
+Cleston Viel Vieira de Sousa <cleston [dot] vs [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+imagecopymerge();
+
+?>
+--EXPECTF--
+Warning: imagecopymerge() expects exactly 9 parameters, 0 given in %s on line %d
diff --git a/ext/gd/tests/imageellipse_basic.phpt b/ext/gd/tests/imageellipse_basic.phpt
new file mode 100755 (executable)
index 0000000..bfd0b79
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+Testing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor(400, 300);
+
+// Draw a white ellipse
+imageellipse($image, 200, 150, 300, 200, 16777215);
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+d8b9bc2ca224bd68569413f4617f8e1f
diff --git a/ext/gd/tests/imageellipse_error1.phpt b/ext/gd/tests/imageellipse_error1.phpt
new file mode 100755 (executable)
index 0000000..aa8ad78
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor(400, 300);
+
+// try to draw a white ellipse
+imageellipse('wrong param', 200, 150, 300, 200, 16777215);
+
+?>
+--EXPECTF--
+Warning: imageellipse() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imageellipse_error2.phpt b/ext/gd/tests/imageellipse_error2.phpt
new file mode 100755 (executable)
index 0000000..5b65bf8
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor(400, 300);
+
+// try to draw a white ellipse
+imageellipse($image, 'wrong param', 150, 300, 200, 16777215);
+
+?>
+--EXPECTF--
+Warning: imageellipse() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imageellipse_error3.phpt b/ext/gd/tests/imageellipse_error3.phpt
new file mode 100755 (executable)
index 0000000..cbac2f0
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor(400, 300);
+
+// try to draw a white ellipse
+imageellipse($image, 200, 'wrong param', 300, 200, 16777215);
+
+?>
+--EXPECTF--
+Warning: imageellipse() expects parameter 3 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imageellipse_error4.phpt b/ext/gd/tests/imageellipse_error4.phpt
new file mode 100755 (executable)
index 0000000..dec2e0f
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor(400, 300);
+
+// try to draw a white ellipse
+imageellipse($image, 200, 150, 'wrong param', 200, 16777215);
+
+?>
+--EXPECTF--
+Warning: imageellipse() expects parameter 4 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imageellipse_error5.phpt b/ext/gd/tests/imageellipse_error5.phpt
new file mode 100755 (executable)
index 0000000..4272470
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor(400, 300);
+
+// try to draw a white ellipse
+imageellipse($image, 200, 150, 300, 'wrong param', 16777215);
+
+?>
+--EXPECTF--
+Warning: imageellipse() expects parameter 5 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imageellipse_error6.phpt b/ext/gd/tests/imageellipse_error6.phpt
new file mode 100755 (executable)
index 0000000..8628525
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor(400, 300);
+
+// try to draw a white ellipse
+imageellipse($image, 200, 150, 300, 200, 'wrong param');
+
+?>
+--EXPECTF--
+Warning: imageellipse() expects parameter 6 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imageellipse_error7.phpt b/ext/gd/tests/imageellipse_error7.phpt
new file mode 100755 (executable)
index 0000000..23f1eee
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST-- 
+Testing wrong param passing imageellipse() of GD library 
+--CREDITS-- 
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> 
+#testfest PHPSP on 2009-06-20 
+--SKIPIF-- 
+<?php  
+if (!extension_loaded("gd")) die("skip GD not present"); 
+?> 
+--FILE-- 
+<?php 
+
+// Create a resource 
+$image = tmpfile(); 
+
+// try to draw a white ellipse 
+imageellipse($image, 200, 150, 300, 200, 16777215); 
+?> 
+--EXPECTF-- 
+Warning: imageellipse(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagefilledarc_basic.phpt b/ext/gd/tests/imagefilledarc_basic.phpt
new file mode 100755 (executable)
index 0000000..9ff9bd3
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+Testing imagefilledarc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc and fill it with white color    
+imagefilledarc($image, 50, 50, 30, 30, 0, 90, $white, IMG_ARC_PIE);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+894f394c7f2e2364642ef27fea6bfc33
diff --git a/ext/gd/tests/imagefilledarc_error1.phpt b/ext/gd/tests/imagefilledarc_error1.phpt
new file mode 100755 (executable)
index 0000000..b2bc417
--- /dev/null
@@ -0,0 +1,29 @@
+--TEST--
+Testing wrong param passing imagefilledarc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc and fill it with white color    
+imagefilledarc($image, 50, 50, 30, 30, 0, 90, $white);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECTF--
+Warning: imagefilledarc() expects exactly 9 parameters, 8 given in %s on line %d
+abebb25b5a2813cfbf92f1f24365786a
diff --git a/ext/gd/tests/imagefilledarc_variation1.phpt b/ext/gd/tests/imagefilledarc_variation1.phpt
new file mode 100755 (executable)
index 0000000..2dec1ea
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+Testing passing negative end angle to imagefilledarc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc and fill it with white color    
+imagefilledarc($image, 50, 50, 30, 30, 0, -25, $white, IMG_ARC_PIE);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+b77bbb8207e5adbebfcc8bd1c4074305
diff --git a/ext/gd/tests/imagefilledarc_variation2.phpt b/ext/gd/tests/imagefilledarc_variation2.phpt
new file mode 100755 (executable)
index 0000000..5c8ffba
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+Testing passing negative start angle to imagefilledarc() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an arc and fill it with white color    
+imagefilledarc($image, 50, 50, 30, 30, -25, 25, $white, IMG_ARC_PIE);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+b8b572812b3c85678f6c38c4ecca7619
diff --git a/ext/gd/tests/imagefilltoborder_basic.phpt b/ext/gd/tests/imagefilltoborder_basic.phpt
new file mode 100755 (executable)
index 0000000..80b84d2
--- /dev/null
@@ -0,0 +1,33 @@
+--TEST-- 
+Testing imagefilltoborder() of GD library 
+--CREDITS-- 
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> 
+#testfest PHPSP on 2009-06-30
+--SKIPIF-- 
+<?php  
+if (!extension_loaded("gd")) die("skip GD not present"); 
+?> 
+--FILE--
+<?php
+// Create a image 
+$image = imagecreatetruecolor( 100, 100 ); 
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Fill border
+imagefilltoborder( $image, 50, 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) );
+
+ob_start(); 
+imagepng( $image, null, 9 ); 
+$img = ob_get_contents(); 
+ob_end_clean();
+
+echo md5(base64_encode($img));
+
+?> 
+--EXPECT-- 
+847ec236f1c4d14c465306c8408550fc
diff --git a/ext/gd/tests/imagefilltoborder_error1.phpt b/ext/gd/tests/imagefilltoborder_error1.phpt
new file mode 100755 (executable)
index 0000000..9412da7
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST-- 
+Testing wrong param passing imagefilltoborder() of GD library 
+--CREDITS-- 
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> 
+#testfest PHPSP on 2009-06-30
+--SKIPIF-- 
+<?php  
+if (!extension_loaded("gd")) die("skip GD not present"); 
+?> 
+--FILE--
+<?php
+// Create a image 
+$image = imagecreatetruecolor( 100, 100 ); 
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+imagefilltoborder( 'wrong param', 50, 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) );
+
+?> 
+--EXPECTF--
+Warning: imagefilltoborder() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagefilltoborder_error2.phpt b/ext/gd/tests/imagefilltoborder_error2.phpt
new file mode 100755 (executable)
index 0000000..dcbf904
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST-- 
+Testing wrong param passing imagefilltoborder() of GD library 
+--CREDITS-- 
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> 
+#testfest PHPSP on 2009-06-30
+--SKIPIF-- 
+<?php  
+if (!extension_loaded("gd")) die("skip GD not present"); 
+?> 
+--FILE--
+<?php
+// Create a image 
+$image = imagecreatetruecolor( 100, 100 ); 
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+imagefilltoborder( $image, 'wrong param', 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) );
+
+?> 
+--EXPECTF--
+Warning: imagefilltoborder() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagefilltoborder_error3.phpt b/ext/gd/tests/imagefilltoborder_error3.phpt
new file mode 100755 (executable)
index 0000000..73f6cf7
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST-- 
+Testing wrong param passing imagefilltoborder() of GD library 
+--CREDITS-- 
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> 
+#testfest PHPSP on 2009-06-30
+--SKIPIF-- 
+<?php  
+if (!extension_loaded("gd")) die("skip GD not present"); 
+?> 
+--FILE--
+<?php
+// Create a image 
+$image = imagecreatetruecolor( 100, 100 ); 
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+imagefilltoborder( $image, 50, 'wrong param', imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) );
+
+?> 
+--EXPECTF--
+Warning: imagefilltoborder() expects parameter 3 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagefilltoborder_error4.phpt b/ext/gd/tests/imagefilltoborder_error4.phpt
new file mode 100755 (executable)
index 0000000..a5073d8
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST-- 
+Testing wrong param passing imagefilltoborder() of GD library 
+--CREDITS-- 
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> 
+#testfest PHPSP on 2009-06-30
+--SKIPIF-- 
+<?php  
+if (!extension_loaded("gd")) die("skip GD not present"); 
+?> 
+--FILE--
+<?php
+// Create a image 
+$image = imagecreatetruecolor( 100, 100 ); 
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+imagefilltoborder( $image, 50, 50, 'wrong param', imagecolorallocate( $image, 255, 0, 0 ) );
+
+?> 
+--EXPECTF--
+Warning: imagefilltoborder() expects parameter 4 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagefilltoborder_error5.phpt b/ext/gd/tests/imagefilltoborder_error5.phpt
new file mode 100755 (executable)
index 0000000..eff344a
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST-- 
+Testing wrong param passing imagefilltoborder() of GD library 
+--CREDITS-- 
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> 
+#testfest PHPSP on 2009-06-30
+--SKIPIF-- 
+<?php  
+if (!extension_loaded("gd")) die("skip GD not present"); 
+?> 
+--FILE--
+<?php
+// Create a image 
+$image = imagecreatetruecolor( 100, 100 ); 
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+imagefilltoborder( $image, 50, 50, imagecolorallocate( $image, 0, 0, 0 ), 'wrong param' );
+
+?> 
+--EXPECTF--
+Warning: imagefilltoborder() expects parameter 5 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagefilltoborder_error6.phpt b/ext/gd/tests/imagefilltoborder_error6.phpt
new file mode 100755 (executable)
index 0000000..b5ce53b
--- /dev/null
@@ -0,0 +1,29 @@
+--TEST-- 
+Testing wrong param passing imagefilltoborder() of GD library 
+--CREDITS-- 
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> 
+#testfest PHPSP on 2009-06-30
+--SKIPIF-- 
+<?php  
+if (!extension_loaded("gd")) die("skip GD not present"); 
+?> 
+--FILE--
+<?php
+// Create a image 
+$image = imagecreatetruecolor( 100, 100 ); 
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+$image_foo = tmpfile();
+imagefilltoborder( $image_foo, 50, 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) );
+
+?> 
+--EXPECTF--
+Warning: imagefilltoborder(): supplied resource is not a valid Image resource in %s on line %d
+
+
diff --git a/ext/gd/tests/imagefilter_error1.phpt b/ext/gd/tests/imagefilter_error1.phpt
new file mode 100755 (executable)
index 0000000..fb96ae3
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter passing in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image));
+?>
+--EXPECTF--
+Warning: Wrong parameter count for imagefilter() in %s on line %d
+NULL
diff --git a/ext/gd/tests/imagefilter_error10.phpt b/ext/gd/tests/imagefilter_error10.phpt
new file mode 100755 (executable)
index 0000000..8b41211
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of EMBOSS in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_EMBOSS));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error11.phpt b/ext/gd/tests/imagefilter_error11.phpt
new file mode 100755 (executable)
index 0000000..9b1cf4d
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource passing of EDGEDETECT in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_EDGEDETECT));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error12.phpt b/ext/gd/tests/imagefilter_error12.phpt
new file mode 100755 (executable)
index 0000000..33fee28
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of COLORIZE in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_COLORIZE, 255, 255, 255));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error13.phpt b/ext/gd/tests/imagefilter_error13.phpt
new file mode 100755 (executable)
index 0000000..687d148
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing wrong parameter value of COLORIZE in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image, IMG_FILTER_COLORIZE, 800, 255, 255)); // Wrong value is truncated to 255
+?>
+--EXPECTF--
+bool(true)
diff --git a/ext/gd/tests/imagefilter_error14.phpt b/ext/gd/tests/imagefilter_error14.phpt
new file mode 100755 (executable)
index 0000000..6410395
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter type of COLORIZE in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image, IMG_FILTER_COLORIZE, 'wrong parameter', 255, 255));
+?>
+--EXPECTF--
+Warning: imagefilter() expects parameter 3 to be long, %unicode_string_optional% given in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error15.phpt b/ext/gd/tests/imagefilter_error15.phpt
new file mode 100755 (executable)
index 0000000..87a412e
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of CONTRAST in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_CONTRAST, 2));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error16.phpt b/ext/gd/tests/imagefilter_error16.phpt
new file mode 100755 (executable)
index 0000000..2a84c2f
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter type of CONTRAST in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image, IMG_FILTER_CONTRAST, 'wrong parameter'));
+?>
+--EXPECTF--
+Warning: imagefilter() expects parameter 3 to be long, %unicode_string_optional% given in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error17.phpt b/ext/gd/tests/imagefilter_error17.phpt
new file mode 100755 (executable)
index 0000000..adafc3e
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of GRAYSCALE in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_GRAYSCALE));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error18.phpt b/ext/gd/tests/imagefilter_error18.phpt
new file mode 100755 (executable)
index 0000000..b636bfc
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of NEGATE in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_NEGATE));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error19.phpt b/ext/gd/tests/imagefilter_error19.phpt
new file mode 100755 (executable)
index 0000000..e36b817
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter type of BRIGHTNESS in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image, IMG_FILTER_BRIGHTNESS, 'wrong parameter'));
+?>
+--EXPECTF--
+Warning: imagefilter() expects parameter 3 to be long, %unicode_string_optional% given in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error2.phpt b/ext/gd/tests/imagefilter_error2.phpt
new file mode 100755 (executable)
index 0000000..62ac662
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter passing in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image, 'wrong parameter'));
+?>
+--EXPECTF--
+Warning: imagefilter() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
+NULL
diff --git a/ext/gd/tests/imagefilter_error20.phpt b/ext/gd/tests/imagefilter_error20.phpt
new file mode 100755 (executable)
index 0000000..f3db724
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of BRIGHTNESS in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_BRIGHTNESS, 1));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error3.phpt b/ext/gd/tests/imagefilter_error3.phpt
new file mode 100755 (executable)
index 0000000..67f6c19
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter passing of PIXELATE in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image, IMG_FILTER_PIXELATE, 'wrong parameter'));
+?>
+--EXPECTF--
+Warning: imagefilter() expects parameter 3 to be long, %unicode_string_optional% given in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error4.phpt b/ext/gd/tests/imagefilter_error4.phpt
new file mode 100755 (executable)
index 0000000..babb37e
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of PIXELATE in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_PIXELATE, 3));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error5.phpt b/ext/gd/tests/imagefilter_error5.phpt
new file mode 100755 (executable)
index 0000000..a7d9443
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter passing of SMOOTH in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imagefilter($image, IMG_FILTER_SMOOTH, 'wrong parameter'));
+?>
+--EXPECTF--
+Warning: imagefilter() expects parameter 3 to be double, %unicode_string_optional% given in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error6.phpt b/ext/gd/tests/imagefilter_error6.phpt
new file mode 100755 (executable)
index 0000000..05dd187
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of SMOOTH in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_SMOOTH, 3.0));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error7.phpt b/ext/gd/tests/imagefilter_error7.phpt
new file mode 100755 (executable)
index 0000000..6c08e5a
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of MEAN_REMOVAL in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_MEAN_REMOVAL));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error8.phpt b/ext/gd/tests/imagefilter_error8.phpt
new file mode 100755 (executable)
index 0000000..57c3168
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of SELECTIVE_BLUR in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_SELECTIVE_BLUR));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefilter_error9.phpt b/ext/gd/tests/imagefilter_error9.phpt
new file mode 100755 (executable)
index 0000000..a74ea64
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing wrong parameter resource of GAUSSIAN_BLUR in imagefilter() of GD library
+--CREDITS--
+Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = tmpfile();
+
+var_dump(imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR));
+?>
+--EXPECTF--
+Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imagefontheight_basic.phpt b/ext/gd/tests/imagefontheight_basic.phpt
new file mode 100644 (file)
index 0000000..bfcd0bb
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+Testing imagefontheight() of GD library
+--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
+var_dump(imagefontheight(1),imagefontheight(2),imagefontheight(3),imagefontheight(4),imagefontheight(5));
+?>
+--EXPECT--
+int(8)
+int(13)
+int(13)
+int(16)
+int(15)
diff --git a/ext/gd/tests/imagefontheight_error1.phpt b/ext/gd/tests/imagefontheight_error1.phpt
new file mode 100644 (file)
index 0000000..88d1771
--- /dev/null
@@ -0,0 +1,15 @@
+--TEST--
+Testing error on string parameter for imagefontheight() of GD library
+--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
+imagefontheight('string');
+?>
+--EXPECTF--
+Warning: imagefontheight() expects parameter 1 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagefontwidth_basic.phpt b/ext/gd/tests/imagefontwidth_basic.phpt
new file mode 100644 (file)
index 0000000..0a9df52
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+Testing imagefontwidth() of GD library
+--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
+var_dump(imagefontwidth(1),imagefontwidth(2),imagefontwidth(3),imagefontwidth(4),imagefontwidth(5));
+var_dump(imagefontwidth(1) < imagefontwidth(5));
+?>
+--EXPECT--
+int(5)
+int(6)
+int(7)
+int(8)
+int(9)
+bool(true)
diff --git a/ext/gd/tests/imagefontwidth_error1.phpt b/ext/gd/tests/imagefontwidth_error1.phpt
new file mode 100644 (file)
index 0000000..dd80034
--- /dev/null
@@ -0,0 +1,15 @@
+--TEST--
+Testing error on string parameter for imagefontwidth() of GD library
+--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
+imagefontwidth('string');
+?>
+--EXPECTF--
+Warning: imagefontwidth() expects parameter 1 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagegammacorrect_basic.phpt b/ext/gd/tests/imagegammacorrect_basic.phpt
new file mode 100644 (file)
index 0000000..b568728
--- /dev/null
@@ -0,0 +1,32 @@
+--TEST--
+Testing imagegammacorrect() of GD library
+--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 = imagecreatetruecolor(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--
+30639772903913594bc665743e1b9ab8
diff --git a/ext/gd/tests/imagegammacorrect_error1.phpt b/ext/gd/tests/imagegammacorrect_error1.phpt
new file mode 100644 (file)
index 0000000..fdcdec8
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error with non-resource paramenter of imagegammacorrect() of GD library, 
+--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
+
+$gamma = imagegammacorrect('string', 1, 5);
+
+?>
+--EXPECTF--
+Warning: imagegammacorrect() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagegammacorrect_error2.phpt b/ext/gd/tests/imagegammacorrect_error2.phpt
new file mode 100644 (file)
index 0000000..604d7da
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error with non-Image resource paramenter of imagegammacorrect() of GD library, 
+--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 = tmpfile();
+$gamma = imagegammacorrect($image, 1, 5);
+
+?>
+--EXPECTF--
+Warning: imagegammacorrect(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagegammacorrect_error3.phpt b/ext/gd/tests/imagegammacorrect_error3.phpt
new file mode 100644 (file)
index 0000000..fd680aa
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error with non-double first paramenter of imagegammacorrect() of GD library, 
+--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 = imagecreatetruecolor(180, 30);
+$gamma = imagegammacorrect($image, 'string', 5);
+
+?>
+--EXPECTF--
+Warning: imagegammacorrect() expects parameter 2 to be double, %s given in %s on line %d
diff --git a/ext/gd/tests/imagegammacorrect_error4.phpt b/ext/gd/tests/imagegammacorrect_error4.phpt
new file mode 100644 (file)
index 0000000..5476d4c
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error with non-double second paramenter of imagegammacorrect() of GD library, 
+--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 = imagecreatetruecolor(180, 30);
+$gamma = imagegammacorrect($image, 1, 'string');
+
+?>
+--EXPECTF--
+Warning: imagegammacorrect() expects parameter 3 to be double, %s given in %s on line %d
diff --git a/ext/gd/tests/imageinterlace_basic.phpt b/ext/gd/tests/imageinterlace_basic.phpt
new file mode 100755 (executable)
index 0000000..657b256
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing imageinterlace() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+var_dump(imageinterlace($image));
+?>
+--EXPECT--
+int(0)
diff --git a/ext/gd/tests/imageinterlace_error1.phpt b/ext/gd/tests/imageinterlace_error1.phpt
new file mode 100755 (executable)
index 0000000..5c871e7
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+Testing passing no parameters to imageinterlace() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+//calling with no parameters
+var_dump(imageinterlace());
+?>
+--EXPECTF--
+Warning: imageinterlace() expects at least 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/gd/tests/imageinterlace_error2.phpt b/ext/gd/tests/imageinterlace_error2.phpt
new file mode 100755 (executable)
index 0000000..808c88a
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing resource that is not a image to imageinterlace() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+$image = fopen('php://stdin', 'r');
+var_dump(imageinterlace($image));
+?>
+--EXPECTF--
+Warning: imageinterlace(): supplied resource is not a valid Image resource in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/imageinterlace_variation1.phpt b/ext/gd/tests/imageinterlace_variation1.phpt
new file mode 100755 (executable)
index 0000000..2c224ef
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+Testing setting the interlace bit on with imageinterlace() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+var_dump(imageinterlace($image, 1));
+var_dump(imageinterlace($image));
+?>
+--EXPECT--
+int(1)
+int(1)
diff --git a/ext/gd/tests/imageinterlace_variation2.phpt b/ext/gd/tests/imageinterlace_variation2.phpt
new file mode 100755 (executable)
index 0000000..b4735dc
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+Testing setting the interlace bit off with imageinterlace() of GD library
+--CREDITS--
+Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+//setting the interlace bit to on
+imageinterlace($image, 1);
+
+//setting de interlace bit to off
+var_dump(imageinterlace($image, 0));
+var_dump(imageinterlace($image));
+?>
+--EXPECT--
+int(0)
+int(0)
diff --git a/ext/gd/tests/imagelayereffect_basic.phpt b/ext/gd/tests/imagelayereffect_basic.phpt
new file mode 100644 (file)
index 0000000..6dbc860
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+Testing imagelayereffect() of GD library
+--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");
+       if (!GD_BUNDLED) die('function only available in bundled, external GD detected');
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+$layer = imagelayereffect($image, IMG_EFFECT_REPLACE);
+
+if ($layer){
+       ob_start();
+       imagepng($image, null, 9);
+       $img = ob_get_contents();
+       ob_end_clean();
+}
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+5a8fe9864cbd20e5dbe730c77f30db95
diff --git a/ext/gd/tests/imagelayereffect_error1.phpt b/ext/gd/tests/imagelayereffect_error1.phpt
new file mode 100644 (file)
index 0000000..ad45710
--- /dev/null
@@ -0,0 +1,16 @@
+--TEST--
+Testing imagelayereffect() with invalid resource of GD library
+--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");
+       if (!GD_BUNDLED) die('function only available in bundled, external GD detected');
+?>
+--FILE--
+<?php
+$layer = imagelayereffect('invalid_resource', IMG_EFFECT_REPLACE);
+?>
+--EXPECTF--
+Warning: imagelayereffect() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagelayereffect_error2.phpt b/ext/gd/tests/imagelayereffect_error2.phpt
new file mode 100644 (file)
index 0000000..7fb9939
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing imagelayereffect() wth invalid effect of GD library
+--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");
+       if (!GD_BUNDLED) die('function only available in bundled, external GD detected');
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+$layer = imagelayereffect($image, 'IMG_EFFECT_REPLACE');
+?>
+--EXPECTF--
+Warning: imagelayereffect() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagelayereffect_error3.phpt b/ext/gd/tests/imagelayereffect_error3.phpt
new file mode 100644 (file)
index 0000000..9f99186
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing imagelayereffect() with invalid resource of GD library
+--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");
+       if (!GD_BUNDLED) die('function only available in bundled, external GD detected');
+?>
+--FILE--
+<?php
+$resource = tmpfile();
+$layer = imagelayereffect($resource, IMG_EFFECT_REPLACE);
+?>
+--EXPECTF--
+Warning: imagelayereffect(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagesetbrush_basic.phpt b/ext/gd/tests/imagesetbrush_basic.phpt
new file mode 100755 (executable)
index 0000000..790184d
--- /dev/null
@@ -0,0 +1,37 @@
+--TEST--
+Test imagesetbrush() function : basic functionality
+--CREDITS--
+Erick Belluci Tedeschi <erickbt86 [at] gmail [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) {
+       die('skip gd extension is not loaded');
+}
+?>
+--FILE--
+<?php
+// Create the brush image
+$img = imagecreate(10, 10);
+// Create the main image, 100x100
+$mainimg = imagecreatetruecolor(100, 100);
+  
+$white = imagecolorallocate($img, 255, 0, 0);
+imagefilledrectangle($img, 0, 0, 299, 99, $white);
+
+// Set the brush
+imagesetbrush($mainimg, $img);
+   
+// Draw a couple of brushes, each overlaying each
+imageline($mainimg, 50, 50, 50, 60, IMG_COLOR_BRUSHED);
+
+// Get output and generate md5 hash
+ob_start();
+imagepng($mainimg, null, 9);
+$result_image = ob_get_contents();
+ob_end_clean();
+echo md5(base64_encode($result_image));
+?>
+--EXPECT--
+8168577c0d1fe6d9d11397cb15263d82
diff --git a/ext/gd/tests/imagestring_basic.phpt b/ext/gd/tests/imagestring_basic.phpt
new file mode 100644 (file)
index 0000000..adc68a6
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+Testing imagestring() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$white = imagecolorallocate($image, 255,255,255);
+
+$result = imagestring($image, 1, 5, 5, 'String Text', $white);
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+d0d2fe757400cb7846b36a8c34b41e4a
diff --git a/ext/gd/tests/imagestring_error1.phpt b/ext/gd/tests/imagestring_error1.phpt
new file mode 100644 (file)
index 0000000..b31f74e
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-resource parameter 1 of imagestring() of GD library
+--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
+
+$result = imagestring('string', 1, 5, 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestring() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestring_error2.phpt b/ext/gd/tests/imagestring_error2.phpt
new file mode 100644 (file)
index 0000000..d6146f7
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-image resource parameter 1 of imagestring() of GD library
+--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
+
+$result = imagestring(tmpfile(), 1, 5, 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestring(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagestring_error3.phpt b/ext/gd/tests/imagestring_error3.phpt
new file mode 100644 (file)
index 0000000..d9a9e47
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 2 of imagestring() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagestring($image, 'string', 5, 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestring() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestring_error4.phpt b/ext/gd/tests/imagestring_error4.phpt
new file mode 100644 (file)
index 0000000..40330b1
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 3 of imagestring() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagestring($image, 1, 'string', 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestring() expects parameter 3 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestring_error5.phpt b/ext/gd/tests/imagestring_error5.phpt
new file mode 100644 (file)
index 0000000..6f45c55
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 4 of imagestring() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagestring($image, 1, 5, 'string', 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestring() expects parameter 4 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestring_error6.phpt b/ext/gd/tests/imagestring_error6.phpt
new file mode 100644 (file)
index 0000000..29bc79d
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-string parameter 5 of imagestring() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagestring($image, 1, 5, 5, $image, 1);
+
+?>
+--EXPECTF--
+Warning: imagestring() expects parameter 5 to be string%S, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestring_error7.phpt b/ext/gd/tests/imagestring_error7.phpt
new file mode 100644 (file)
index 0000000..75ab2f6
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 6 of imagestring() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagestring($image, 1, 5, 5, 'String', 'font');
+
+?>
+--EXPECTF--
+Warning: imagestring() expects parameter 6 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestringup_basic.phpt b/ext/gd/tests/imagestringup_basic.phpt
new file mode 100644 (file)
index 0000000..0c748b6
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+Testing imagestringup() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$white = imagecolorallocate($image, 255,255,255);
+
+$result = imagestringup($image, 1, 5, 25, 'Str', $white);
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+7c28016adcf620b772af2a8655b87bd2
diff --git a/ext/gd/tests/imagestringup_error1.phpt b/ext/gd/tests/imagestringup_error1.phpt
new file mode 100644 (file)
index 0000000..1447727
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-resource parameter 1 of imagestringup() of GD library
+--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
+
+$result = imagestringup('string', 1, 5, 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestringup() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestringup_error2.phpt b/ext/gd/tests/imagestringup_error2.phpt
new file mode 100644 (file)
index 0000000..d1d5aa2
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-image resource parameter 1 of imagestringup() of GD library
+--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
+
+$result = imagestringup(tmpfile(), 1, 5, 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestringup(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagestringup_error3.phpt b/ext/gd/tests/imagestringup_error3.phpt
new file mode 100644 (file)
index 0000000..27e9007
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 2 of imagestringup() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagestringup($image, 'string', 5, 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestringup() expects parameter 2 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestringup_error4.phpt b/ext/gd/tests/imagestringup_error4.phpt
new file mode 100644 (file)
index 0000000..af2b8c0
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 3 of imagestringup() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagestringup($image, 1, 'string', 5, 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestringup() expects parameter 3 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestringup_error5.phpt b/ext/gd/tests/imagestringup_error5.phpt
new file mode 100644 (file)
index 0000000..6f45c55
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 4 of imagestring() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagestring($image, 1, 5, 'string', 'String', 1);
+
+?>
+--EXPECTF--
+Warning: imagestring() expects parameter 4 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestringup_error6.phpt b/ext/gd/tests/imagestringup_error6.phpt
new file mode 100644 (file)
index 0000000..ac6fe4a
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-string parameter 5 of imagestringup() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagestringup($image, 1, 5, 5, $image, 1);
+
+?>
+--EXPECTF--
+Warning: imagestringup() expects parameter 5 to be string%S, %s given in %s on line %d
diff --git a/ext/gd/tests/imagestringup_error7.phpt b/ext/gd/tests/imagestringup_error7.phpt
new file mode 100644 (file)
index 0000000..396f2dd
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Testing error on non-long parameter 6 of imagestringup() of GD library
+--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 = imagecreatetruecolor(180, 30);
+$result = imagestringup($image, 1, 5, 5, 'String', 'font');
+
+?>
+--EXPECTF--
+Warning: imagestringup() expects parameter 6 to be long, %s given in %s on line %d
diff --git a/ext/gd/tests/jpeg2wbmp_error1.phpt b/ext/gd/tests/jpeg2wbmp_error1.phpt
new file mode 100755 (executable)
index 0000000..6ab0b05
--- /dev/null
@@ -0,0 +1,38 @@
+--TEST--
+Test jpeg2wbmp() function : wrong threshold value param
+--CREDITS--
+Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if(!extension_loaded('gd')) {
+    die('skip gd extension is not loaded');
+}
+if(!function_exists('jpeg2wbmp')) {
+    die('skip jpeg2wbmp function is not available');
+}
+?>
+--FILE--
+<?php
+// Create a blank image and add some text
+$im = imagecreatetruecolor(120, 20);
+$text_color = imagecolorallocate($im, 255, 255, 255);
+imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);
+
+// Save the image as 'simpletext.jpg'
+imagejpeg($im, 'simpletext.jpg');
+
+// Free up memory
+imagedestroy($im);
+
+jpeg2wbmp('simpletext.jpg', 'simpletext.wbmp', 20, 120, 9);
+jpeg2wbmp('simpletext.jpg', 'simpletext.wbmp', 20, 120, -1);
+?>
+--EXPECTF--
+Warning: jpeg2wbmp(): Invalid threshold value '9' in %s on line %d
+
+Warning: jpeg2wbmp(): Invalid threshold value '-1' in %s on line %d
+--CLEAN--
+<?php
+unlink('simpletext.jpg');
+?>
\ No newline at end of file
diff --git a/ext/gd/tests/jpeg2wbmp_error2.phpt b/ext/gd/tests/jpeg2wbmp_error2.phpt
new file mode 100755 (executable)
index 0000000..23a4162
--- /dev/null
@@ -0,0 +1,30 @@
+--TEST--
+Test jpeg2wbmp() function : wrong origin filename param
+--CREDITS--
+Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if(!extension_loaded('gd')) {
+    die('skip gd extension is not loaded');
+}
+if(!function_exists('jpeg2wbmp')) {
+    die('skip jpeg2wbmp function is not available');
+}
+?>
+--FILE--
+<?php
+jpeg2wbmp('', 'simpletext.wbmp', 20, 120, 8);
+jpeg2wbmp(null, 'simpletext.wbmp', 20, 120, 8);
+jpeg2wbmp(false, 'simpletext.wbmp', 20, 120, 8);
+?>
+--EXPECTF--
+Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
+
+Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
+
+Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
+--CLEAN--
+<?php
+unlink('simpletext.jpg');
+?>
\ No newline at end of file
diff --git a/ext/gd/tests/jpeg2wbmp_error3.phpt b/ext/gd/tests/jpeg2wbmp_error3.phpt
new file mode 100755 (executable)
index 0000000..2cf0bec
--- /dev/null
@@ -0,0 +1,41 @@
+--TEST--
+Test jpeg2wbmp() function : wrong destination filename param
+--CREDITS--
+Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if(!extension_loaded('gd')) {
+    die('skip gd extension is not loaded');
+}
+if(!function_exists('jpeg2wbmp')) {
+    die('skip jpeg2wbmp function is not available');
+}
+?>
+--FILE--
+<?php
+// Create a blank image and add some text
+$im = imagecreatetruecolor(120, 20);
+$text_color = imagecolorallocate($im, 255, 255, 255);
+imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);
+
+// Save the image as 'simpletext.jpg'
+imagejpeg($im, 'simpletext.jpg');
+
+// Free up memory
+imagedestroy($im);
+
+jpeg2wbmp('simpletext.jpg', '', 20, 120, 8);
+jpeg2wbmp('simpletext.jpg', null, 20, 120, 8);
+jpeg2wbmp('simpletext.jpg', false, 20, 120, 8);
+?>
+--EXPECTF--
+Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d
+
+Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d
+
+Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d
+--CLEAN--
+<?php
+unlink('simpletext.jpg');
+?>
\ No newline at end of file
diff --git a/ext/gd/tests/png2wbmp_error1.phpt b/ext/gd/tests/png2wbmp_error1.phpt
new file mode 100755 (executable)
index 0000000..edb5b93
--- /dev/null
@@ -0,0 +1,38 @@
+--TEST--
+Test png2wbmp() function : wrong threshold value param
+--CREDITS--
+Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if(!extension_loaded('gd')) {
+    die('skip gd extension is not loaded');
+}
+if(!function_exists('png2wbmp')) {
+    die('skip png2wbmp function is not available');
+}
+?>
+--FILE--
+<?php
+// Create a blank image and add some text
+$im = imagecreatetruecolor(120, 20);
+$text_color = imagecolorallocate($im, 255, 255, 255);
+imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);
+
+// Save the image as 'simpletext.png'
+imagepng($im, 'simpletext.png');
+
+// Free up memory
+imagedestroy($im);
+
+png2wbmp('simpletext.png', 'simpletext.wbmp', 20, 120, 9);
+png2wbmp('simpletext.png', 'simpletext.wbmp', 20, 120, -1);
+?>
+--EXPECTF--
+Warning: png2wbmp(): Invalid threshold value '9' in %s on line %d
+
+Warning: png2wbmp(): Invalid threshold value '-1' in %s on line %d
+--CLEAN--
+<?php
+unlink('simpletext.png');
+?>
\ No newline at end of file
diff --git a/ext/gd/tests/png2wbmp_error2.phpt b/ext/gd/tests/png2wbmp_error2.phpt
new file mode 100755 (executable)
index 0000000..248ed6e
--- /dev/null
@@ -0,0 +1,30 @@
+--TEST--
+Test png2wbmp() function : wrong origin filename param
+--CREDITS--
+Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if(!extension_loaded('gd')) {
+    die('skip gd extension is not loaded');
+}
+if(!function_exists('png2wbmp')) {
+    die('skip png2wbmp function is not available');
+}
+?>
+--FILE--
+<?php
+png2wbmp('', 'simpletext.wbmp', 20, 120, 8);
+png2wbmp(null, 'simpletext.wbmp', 20, 120, 8);
+png2wbmp(false, 'simpletext.wbmp', 20, 120, 8);
+?>
+--EXPECTF--
+Warning: png2wbmp(): Unable to open '' for reading in %s on line %d
+
+Warning: png2wbmp(): Unable to open '' for reading in %s on line %d
+
+Warning: png2wbmp(): Unable to open '' for reading in %s on line %d
+--CLEAN--
+<?php
+unlink('simpletext.jpg');
+?>
\ No newline at end of file
diff --git a/ext/gd/tests/png2wbmp_error3.phpt b/ext/gd/tests/png2wbmp_error3.phpt
new file mode 100755 (executable)
index 0000000..45eb05b
--- /dev/null
@@ -0,0 +1,41 @@
+--TEST--
+Test png2wbmp() function : wrong destination filename param
+--CREDITS--
+Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php 
+if(!extension_loaded('gd')) {
+    die('skip gd extension is not loaded');
+}
+if(!function_exists('png2wbmp')) {
+    die('skip png2wbmp function is not available');
+}
+?>
+--FILE--
+<?php
+// Create a blank image and add some text
+$im = imagecreatetruecolor(120, 20);
+$text_color = imagecolorallocate($im, 255, 255, 255);
+imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);
+
+// Save the image as 'simpletext.png'
+imagepng($im, 'simpletext.png');
+
+// Free up memory
+imagedestroy($im);
+
+png2wbmp('simpletext.png', '', 20, 120, 8);
+png2wbmp('simpletext.png', null, 20, 120, 8);
+png2wbmp('simpletext.png', false, 20, 120, 8);
+?>
+--EXPECTF--
+Warning: png2wbmp(): Unable to open '' for writing in %s on line %d
+
+Warning: png2wbmp(): Unable to open '' for writing in %s on line %d
+
+Warning: png2wbmp(): Unable to open '' for writing in %s on line %d
+--CLEAN--
+<?php
+unlink('simpletext.png');
+?>
\ No newline at end of file