rdohms          Mon, 20 Jul 2009 03:47:29 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=284409

Changed paths:
        A   
php/php-src/branches/PHP_5_2/ext/gd/tests/imageistruecolor_basic.phpt
        A   
php/php-src/branches/PHP_5_2/ext/gd/tests/imageistruecolor_error1.phpt
        A   
php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_basic.phpt
        A   
php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_error1.phpt
        A   
php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_error2.phpt
        A   
php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_error3.phpt
        A   
php/php-src/branches/PHP_5_3/ext/gd/tests/imageistruecolor_basic.phpt
        A   
php/php-src/branches/PHP_5_3/ext/gd/tests/imageistruecolor_error1.phpt
        A   
php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_basic.phpt
        A   
php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_error1.phpt
        A   
php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_error2.phpt
        A   
php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_error3.phpt
        A   php/php-src/trunk/ext/gd/tests/imageistruecolor_basic.phpt
        A   php/php-src/trunk/ext/gd/tests/imageistruecolor_error1.phpt
        A   php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_basic.phpt
        A   php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_error1.phpt
        A   php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_error2.phpt
        A   php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_error3.phpt

Log:
Separating and complementing imageistruecolor and imagetruecolortopalette tests

Added: php/php-src/branches/PHP_5_2/ext/gd/tests/imageistruecolor_basic.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/gd/tests/imageistruecolor_basic.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/gd/tests/imageistruecolor_basic.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,17 @@
+--TEST--
+Testing imageistruecolor() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imageistruecolor($image));
+?>
+--EXPECT--
+bool(true)
\ No newline at end of file

Added: php/php-src/branches/PHP_5_2/ext/gd/tests/imageistruecolor_error1.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/gd/tests/imageistruecolor_error1.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/gd/tests/imageistruecolor_error1.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,24 @@
+--TEST--
+Testing imageistruecolor(): wrong parameters
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$resource = tmpfile();
+
+imageistruecolor('string');
+imageistruecolor($resource);
+imageistruecolor(array());
+?>
+--EXPECTF--
+Warning: imageistruecolor(): supplied argument is not a valid Image resource in %s on line %d
+
+Warning: imageistruecolor(): supplied resource is not a valid Image resource in %s on line %d
+
+Warning: imageistruecolor(): supplied argument is not a valid Image resource in %s on line %d
\ No newline at end of file

Added: php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_basic.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_basic.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_basic.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,31 @@
+--TEST--
+Testing imagetruecolortopalette() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(150, 150);
+
+$a = imagecolorallocate($image,255,0,255);
+$b = imagecolorallocate($image,0,255,255);
+
+$half =  imagefilledarc ( $image, 75, 75, 70, 70, 0, 180, $a, IMG_ARC_PIE );
+$half2 =  imagefilledarc ( $image, 75, 55, 80, 70, 0, -180, $b, IMG_ARC_PIE );
+
+var_dump(imagetruecolortopalette($image, true, 2));
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+bool(true)
+0843f63ab2f9fddedd69b0b421686bc5
\ No newline at end of file

Added: php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_error1.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_error1.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_error1.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,26 @@
+--TEST--
+Testing imagetruecolortopalette(): wrong parameters for parameter 1
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$resource = tmpfile();
+
+imagetruecolortopalette($resource, true, 2);
+imagetruecolortopalette('string', true, 2);
+imagetruecolortopalette(array(), true, 2);
+imagetruecolortopalette(null, true, 2);
+?>
+--EXPECTF--
+Warning: imagetruecolortopalette(): supplied resource is not a valid Image resource in %s on line %d
+
+Warning: imagetruecolortopalette(): supplied argument is not a valid Image resource in %s on line %d
+
+Warning: imagetruecolortopalette(): supplied argument is not a valid Image resource in %s on line %d
+
+Warning: imagetruecolortopalette(): supplied argument is not a valid Image resource in %s on line %d
\ No newline at end of file

Added: php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_error2.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_error2.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_error2.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,23 @@
+--TEST--
+Testing imagetruecolortopalette(): wrong parameters for parameter 2
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(50, 50);
+$resource = tmpfile();
+
+$a = imagetruecolortopalette($image, $resource, 2);
+$b = imagetruecolortopalette($image, array(), 2);
+
+var_dump($a, $b);
+//Both will return true in 5.2.x due to lack of parameter validation
+?>
+--EXPECTF--
+bool(true)
+bool(true)
\ No newline at end of file

Added: php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_error3.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_error3.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/gd/tests/imagetruecolortopalette_error3.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,26 @@
+--TEST--
+Testing imagetruecolortopalette(): wrong parameters for parameter 3
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(50, 50);
+$resource = tmpfile();
+
+imagetruecolortopalette($image, true, 'string');
+imagetruecolortopalette($image, true, $resource);
+imagetruecolortopalette($image, true, array());
+imagetruecolortopalette($image, true, null);
+
+?>
+--EXPECTF--
+Warning: imagetruecolortopalette(): Number of colors has to be greater than zero in %s on line %d
+
+Warning: imagetruecolortopalette(): Number of colors has to be greater than zero in %s on line %d
+
+Warning: imagetruecolortopalette(): Number of colors has to be greater than zero in %s on line %d
\ No newline at end of file

Added: php/php-src/branches/PHP_5_3/ext/gd/tests/imageistruecolor_basic.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/gd/tests/imageistruecolor_basic.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/gd/tests/imageistruecolor_basic.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,17 @@
+--TEST--
+Testing imageistruecolor() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imageistruecolor($image));
+?>
+--EXPECT--
+bool(true)
\ No newline at end of file

Added: php/php-src/branches/PHP_5_3/ext/gd/tests/imageistruecolor_error1.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/gd/tests/imageistruecolor_error1.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/gd/tests/imageistruecolor_error1.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,24 @@
+--TEST--
+Testing imageistruecolor(): wrong parameters
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$resource = tmpfile();
+
+imageistruecolor('string');
+imageistruecolor($resource);
+imageistruecolor(array());
+?>
+--EXPECTF--
+Warning: imageistruecolor() expects parameter 1 to be resource, string given in %s on line %d
+
+Warning: imageistruecolor(): supplied resource is not a valid Image resource in %s on line %d
+
+Warning: imageistruecolor() expects parameter 1 to be resource, array given in %s on line %d
\ No newline at end of file

Added: php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_basic.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_basic.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_basic.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,31 @@
+--TEST--
+Testing imagetruecolortopalette() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(150, 150);
+
+$a = imagecolorallocate($image,255,0,255);
+$b = imagecolorallocate($image,0,255,255);
+
+$half =  imagefilledarc ( $image, 75, 75, 70, 70, 0, 180, $a, IMG_ARC_PIE );
+$half2 =  imagefilledarc ( $image, 75, 55, 80, 70, 0, -180, $b, IMG_ARC_PIE );
+
+var_dump(imagetruecolortopalette($image, true, 2));
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+bool(true)
+0843f63ab2f9fddedd69b0b421686bc5
\ No newline at end of file

Added: php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_error1.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_error1.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_error1.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,26 @@
+--TEST--
+Testing imagetruecolortopalette(): wrong parameters for parameter 1
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$resource = tmpfile();
+
+imagetruecolortopalette($resource, true, 2);
+imagetruecolortopalette('string', true, 2);
+imagetruecolortopalette(array(), true, 2);
+imagetruecolortopalette(null, true, 2);
+?>
+--EXPECTF--
+Warning: imagetruecolortopalette(): supplied resource is not a valid Image resource in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 1 to be resource, %s given in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 1 to be resource, array given in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 1 to be resource, null given in %s on line %d
\ No newline at end of file

Added: php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_error2.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_error2.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_error2.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,22 @@
+--TEST--
+Testing imagetruecolortopalette(): wrong parameters for parameter 2
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(50, 50);
+$resource = tmpfile();
+
+imagetruecolortopalette($image, $resource, 2);
+imagetruecolortopalette($image, array(), 2);
+
+?>
+--EXPECTF--
+Warning: imagetruecolortopalette() expects parameter 2 to be boolean, resource given in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 2 to be boolean, array given in %s on line %d
\ No newline at end of file

Added: php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_error3.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_error3.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/gd/tests/imagetruecolortopalette_error3.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,28 @@
+--TEST--
+Testing imagetruecolortopalette(): wrong parameters for parameter 3
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(50, 50);
+$resource = tmpfile();
+
+imagetruecolortopalette($image, true, 'string');
+imagetruecolortopalette($image, true, $resource);
+imagetruecolortopalette($image, true, array());
+imagetruecolortopalette($image, true, null);
+
+?>
+--EXPECTF--
+Warning: imagetruecolortopalette() expects parameter 3 to be long, string given in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 3 to be long, resource given in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 3 to be long, array given in %s on line %d
+
+Warning: imagetruecolortopalette(): Number of colors has to be greater than zero in %s on line %d
\ No newline at end of file

Added: php/php-src/trunk/ext/gd/tests/imageistruecolor_basic.phpt
===================================================================
--- php/php-src/trunk/ext/gd/tests/imageistruecolor_basic.phpt	                        (rev 0)
+++ php/php-src/trunk/ext/gd/tests/imageistruecolor_basic.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,17 @@
+--TEST--
+Testing imageistruecolor() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+
+var_dump(imageistruecolor($image));
+?>
+--EXPECT--
+bool(true)
\ No newline at end of file

Added: php/php-src/trunk/ext/gd/tests/imageistruecolor_error1.phpt
===================================================================
--- php/php-src/trunk/ext/gd/tests/imageistruecolor_error1.phpt	                        (rev 0)
+++ php/php-src/trunk/ext/gd/tests/imageistruecolor_error1.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,24 @@
+--TEST--
+Testing imageistruecolor(): wrong parameters
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(180, 30);
+$resource = tmpfile();
+
+imageistruecolor('string');
+imageistruecolor($resource);
+imageistruecolor(array());
+?>
+--EXPECTF--
+Warning: imageistruecolor() expects parameter 1 to be resource, Unicode string given in %s on line %d
+
+Warning: imageistruecolor(): supplied resource is not a valid Image resource in %s on line %d
+
+Warning: imageistruecolor() expects parameter 1 to be resource, array given in %s on line %d
\ No newline at end of file

Added: php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_basic.phpt
===================================================================
--- php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_basic.phpt	                        (rev 0)
+++ php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_basic.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,31 @@
+--TEST--
+Testing imagetruecolortopalette() of GD library
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(150, 150);
+
+$a = imagecolorallocate($image,255,0,255);
+$b = imagecolorallocate($image,0,255,255);
+
+$half =  imagefilledarc ( $image, 75, 75, 70, 70, 0, 180, $a, IMG_ARC_PIE );
+$half2 =  imagefilledarc ( $image, 75, 55, 80, 70, 0, -180, $b, IMG_ARC_PIE );
+
+var_dump(imagetruecolortopalette($image, true, 2));
+
+ob_start();
+imagepng($image, null, 9);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+bool(true)
+0843f63ab2f9fddedd69b0b421686bc5
\ No newline at end of file

Added: php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_error1.phpt
===================================================================
--- php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_error1.phpt	                        (rev 0)
+++ php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_error1.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,26 @@
+--TEST--
+Testing imagetruecolortopalette(): wrong parameters for parameter 1
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$resource = tmpfile();
+
+imagetruecolortopalette($resource, true, 2);
+imagetruecolortopalette('string', true, 2);
+imagetruecolortopalette(array(), true, 2);
+imagetruecolortopalette(null, true, 2);
+?>
+--EXPECTF--
+Warning: imagetruecolortopalette(): supplied resource is not a valid Image resource in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 1 to be resource, %s given in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 1 to be resource, array given in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 1 to be resource, null given in %s on line %d
\ No newline at end of file

Added: php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_error2.phpt
===================================================================
--- php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_error2.phpt	                        (rev 0)
+++ php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_error2.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,22 @@
+--TEST--
+Testing imagetruecolortopalette(): wrong parameters for parameter 2
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(50, 50);
+$resource = tmpfile();
+
+imagetruecolortopalette($image, $resource, 2);
+imagetruecolortopalette($image, array(), 2);
+
+?>
+--EXPECTF--
+Warning: imagetruecolortopalette() expects parameter 2 to be boolean, resource given in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 2 to be boolean, array given in %s on line %d
\ No newline at end of file

Added: php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_error3.phpt
===================================================================
--- php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_error3.phpt	                        (rev 0)
+++ php/php-src/trunk/ext/gd/tests/imagetruecolortopalette_error3.phpt	2009-07-20 03:47:29 UTC (rev 284409)
@@ -0,0 +1,28 @@
+--TEST--
+Testing imagetruecolortopalette(): wrong parameters for parameter 3
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--SKIPIF--
+<?php
+	if (!extension_loaded("gd")) die("skip GD not present");
+	if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+$image = imagecreatetruecolor(50, 50);
+$resource = tmpfile();
+
+imagetruecolortopalette($image, true, 'string');
+imagetruecolortopalette($image, true, $resource);
+imagetruecolortopalette($image, true, array());
+imagetruecolortopalette($image, true, null);
+
+?>
+--EXPECTF--
+Warning: imagetruecolortopalette() expects parameter 3 to be long, Unicode string given in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 3 to be long, resource given in %s on line %d
+
+Warning: imagetruecolortopalette() expects parameter 3 to be long, array given in %s on line %d
+
+Warning: imagetruecolortopalette(): Number of colors has to be greater than zero in %s on line %d
\ No newline at end of file
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to