From: andy wharmby Date: Thu, 22 Jan 2009 13:27:33 +0000 (+0000) Subject: New image tests. Tested on Windows, LInux and Linux 64 bit X-Git-Tag: php-5.4.0alpha1~191^2~4429 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9539c830958f9f323164489d758ae3966d939f9a;p=php New image tests. Tested on Windows, LInux and Linux 64 bit --- diff --git a/ext/gd/tests/image_type_to_mime_type_variation3.phpt b/ext/gd/tests/image_type_to_mime_type_variation3.phpt new file mode 100644 index 0000000000..167e7eefea --- /dev/null +++ b/ext/gd/tests/image_type_to_mime_type_variation3.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test image_type_to_mime_type() function : usage variations - Pass equivalent imagetype constant integer values +--FILE-- + +===DONE=== +--EXPECTREGEX-- +\*\*\* Testing image_type_to_mime_type\(\) : usage variations \*\*\* + +-- Iteration 1 -- +unicode\(9\) "image\/gif" + +-- Iteration 2 -- +unicode\(10\) "image\/jpeg" + +-- Iteration 3 -- +unicode\(9\) "image\/png" + +-- Iteration 4 -- +unicode\(29\) "application\/x-shockwave-flash" + +-- Iteration 5 -- +unicode\(9\) "image\/psd" + +-- Iteration 6 -- +unicode\(9\) "image\/bmp" + +-- Iteration 7 -- +unicode\(10\) "image\/tiff" + +-- Iteration 8 -- +unicode\(10\) "image\/tiff" + +-- Iteration 9 -- +unicode\(24\) "application\/octet-stream" + +-- Iteration 10 -- +unicode\(9\) "image\/jp2" + +-- Iteration 11 -- +unicode\(24\) "application\/octet-stream" + +-- Iteration 12 -- +unicode\(24\) "application\/octet-stream" + +-- Iteration 13 -- +unicode\(2[49]\) "application\/(x-shockwave-flash|octet-stream)" + +-- Iteration 14 -- +unicode\(9\) "image\/iff" + +-- Iteration 15 -- +unicode\(18\) "image\/vnd.wap.wbmp" + +-- Iteration 16 -- +unicode\(9\) "image\/xbm" + +-- Iteration 17 -- +unicode\(24\) "image\/vnd.microsoft.icon" +===DONE=== diff --git a/ext/gd/tests/image_type_to_mime_type_variation4.phpt b/ext/gd/tests/image_type_to_mime_type_variation4.phpt new file mode 100644 index 0000000000..6bced92291 --- /dev/null +++ b/ext/gd/tests/image_type_to_mime_type_variation4.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test image_type_to_mime_type() function : usage variations - Passing IMAGETYPE_ICO and IMAGETYPE_SWC +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing image_type_to_mime_type() : usage variations *** +unicode(24) "image/vnd.microsoft.icon" +unicode(29) "application/x-shockwave-flash" +===DONE=== diff --git a/ext/gd/tests/imagecolorallocate_basic.phpt b/ext/gd/tests/imagecolorallocate_basic.phpt new file mode 100644 index 0000000000..25b2821485 --- /dev/null +++ b/ext/gd/tests/imagecolorallocate_basic.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test imagecolorallocate() function : basic functionality +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing imagecolorallocate() : basic functionality *** +int(16711680) +int(65280) +int(255) +int(16777215) +===DONE=== \ No newline at end of file diff --git a/ext/gd/tests/imagecolorallocate_error.phpt b/ext/gd/tests/imagecolorallocate_error.phpt new file mode 100644 index 0000000000..6c685b2c98 --- /dev/null +++ b/ext/gd/tests/imagecolorallocate_error.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test imagecolorallocate() function : error conditions +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing imagecolorallocate() : error conditions *** + +-- Testing imagecolorallocate() function with more than expected no. of arguments -- + +Warning: imagecolorallocate() expects exactly 4 parameters, 5 given in %s on line %d +NULL + +-- Testing imagecolorallocate() function with less than expected no. of arguments -- + +Warning: imagecolorallocate() expects exactly 4 parameters, 0 given in %s on line %d +NULL + +Warning: imagecolorallocate() expects exactly 4 parameters, 3 given in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/gd/tests/imagecolorallocate_variation1.phpt b/ext/gd/tests/imagecolorallocate_variation1.phpt new file mode 100644 index 0000000000..fa3c37b4c3 --- /dev/null +++ b/ext/gd/tests/imagecolorallocate_variation1.phpt @@ -0,0 +1,267 @@ +--TEST-- +Test imagecolorallocate() function : usage variations - passing different data types to first argument +--SKIPIF-- + +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$values = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 10.1234567e10' => 10.1234567e10, + 'float 10.7654321E-10' => 10.7654321E-10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + //resource + "file resource" => $fp +); + +// loop through each element of the array for im +foreach($values as $key => $value) { + echo "\n-- $key --\n"; + var_dump( imagecolorallocate($value, $red, $green, $blue) ); +}; +?> +===DONE=== +--EXPECTF-- +*** Testing imagecolorallocate() : usage variations *** + +-- int 0 -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- int 1 -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- int 12345 -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- int -12345 -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- float 10.5 -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- float -10.5 -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- float 10.1234567e10 -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- float 10.7654321E-10 -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- float .5 -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- empty array -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, array given in %s on line %d +NULL + +-- int indexed array -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, array given in %s on line %d +NULL + +-- associative array -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, array given in %s on line %d +NULL + +-- nested arrays -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, array given in %s on line %d +NULL + +-- uppercase NULL -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- lowercase null -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- lowercase true -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- lowercase false -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- uppercase TRUE -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- uppercase FALSE -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- empty string DQ -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, Unicode string given in %s on line %d +NULL + +-- empty string SQ -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, Unicode string given in %s on line %d +NULL + +-- string DQ -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, Unicode string given in %s on line %d +NULL + +-- string SQ -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, Unicode string given in %s on line %d +NULL + +-- mixed case string -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, Unicode string given in %s on line %d +NULL + +-- heredoc -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, Unicode string given in %s on line %d +NULL + +-- instance of classWithToString -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, object given in %s on line %d +NULL + +-- instance of classWithoutToString -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, object given in %s on line %d +NULL + +-- undefined var -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- unset var -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- file resource -- + +Warning: imagecolorallocate(): supplied resource is not a valid Image resource in %s on line %d +bool(false) +===DONE=== diff --git a/ext/gd/tests/imagecolorallocate_variation2.phpt b/ext/gd/tests/imagecolorallocate_variation2.phpt new file mode 100644 index 0000000000..9bb8fa769e --- /dev/null +++ b/ext/gd/tests/imagecolorallocate_variation2.phpt @@ -0,0 +1,214 @@ +--TEST-- +Test imagecolorallocate() function : usage variations - passing different data types to second argument +--SKIPIF-- + +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$values = array( + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 10.1234567e10' => 10.1234567e10, + 'float 10.7654321E-10' => 10.7654321E-10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + //resource + "file resource" => $fp +); +// loop through each element of the array for red +foreach($values as $key => $value) { + echo "\n--$key--\n"; + var_dump( imagecolorallocate($im, $value, $green, $blue) ); +}; +?> +===DONE=== +--EXPECTF-- +*** Testing imagecolorallocate() : usage variations *** + +--float 10.5-- +int(657930) + +--float -10.5-- +bool(false) + +--float 10.1234567e10-- +bool(false) + +--float 10.7654321E-10-- +int(2570) + +--float .5-- +int(2570) + +--empty array-- + +Warning: imagecolorallocate() expects parameter 2 to be long, array given in %s on line %d +NULL + +--int indexed array-- + +Warning: imagecolorallocate() expects parameter 2 to be long, array given in %s on line %d +NULL + +--associative array-- + +Warning: imagecolorallocate() expects parameter 2 to be long, array given in %s on line %d +NULL + +--nested arrays-- + +Warning: imagecolorallocate() expects parameter 2 to be long, array given in %s on line %d +NULL + +--uppercase NULL-- +int(2570) + +--lowercase null-- +int(2570) + +--lowercase true-- +int(68106) + +--lowercase false-- +int(2570) + +--uppercase TRUE-- +int(68106) + +--uppercase FALSE-- +int(2570) + +--empty string DQ-- + +Warning: imagecolorallocate() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL + +--empty string SQ-- + +Warning: imagecolorallocate() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL + +--string DQ-- + +Warning: imagecolorallocate() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL + +--string SQ-- + +Warning: imagecolorallocate() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL + +--mixed case string-- + +Warning: imagecolorallocate() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL + +--heredoc-- + +Warning: imagecolorallocate() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: imagecolorallocate() expects parameter 2 to be long, object given in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: imagecolorallocate() expects parameter 2 to be long, object given in %s on line %d +NULL + +--undefined var-- +int(2570) + +--unset var-- +int(2570) + +--file resource-- + +Warning: imagecolorallocate() expects parameter 2 to be long, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/gd/tests/imagecolorallocate_variation3.phpt b/ext/gd/tests/imagecolorallocate_variation3.phpt new file mode 100644 index 0000000000..83aa246e63 --- /dev/null +++ b/ext/gd/tests/imagecolorallocate_variation3.phpt @@ -0,0 +1,214 @@ +--TEST-- +Test imagecolorallocate() function : usage variations - passing different data types to third argument +--SKIPIF-- + +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$values = array( + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 10.1234567e10' => 10.1234567e10, + 'float 10.7654321E-10' => 10.7654321E-10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + //resource + "file resource" => $fp +); +// loop through each element of the array for red +foreach($values as $key => $value) { + echo "\n--$key--\n"; + var_dump( imagecolorallocate($im, $red, $value, $blue) ); +}; +?> +===DONE=== +--EXPECTREGEX-- +\*\*\* Testing imagecolorallocate\(\) : usage variations \*\*\* + +--float 10.5-- +int\(657930\) + +--float -10.5-- +int\(652810\) + +--float 10.1234567e10-- +int\(655114\)|int\(217143306\) + +--float 10.7654321E-10-- +int\(655370\) + +--float .5-- +int\(655370\) + +--empty array-- + +Warning: imagecolorallocate\(\) expects parameter 3 to be long, array given in (\w*|\/|\.)* on line \d+ +NULL + +--int indexed array-- + +Warning: imagecolorallocate\(\) expects parameter 3 to be long, array given in (\w*|\/|\.)* on line \d+ +NULL + +--associative array-- + +Warning: imagecolorallocate\(\) expects parameter 3 to be long, array given in (\w*|\/|\.)* on line \d+ +NULL + +--nested arrays-- + +Warning: imagecolorallocate\(\) expects parameter 3 to be long, array given in (\w*|\/|\.)* on line \d+ +NULL + +--uppercase NULL-- +int\(655370\) + +--lowercase null-- +int\(655370\) + +--lowercase true-- +int\(655626\) + +--lowercase false-- +int\(655370\) + +--uppercase TRUE-- +int\(655626\) + +--uppercase FALSE-- +int\(655370\) + +--empty string DQ-- + +Warning: imagecolorallocate\(\) expects parameter 3 to be long, Unicode string given in (\w*|\/|\.)* on line \d+ +NULL + +--empty string SQ-- + +Warning: imagecolorallocate\(\) expects parameter 3 to be long, Unicode string given in (\w*|\/|\.)* on line \d+ +NULL + +--string DQ-- + +Warning: imagecolorallocate\(\) expects parameter 3 to be long, Unicode string given in (\w*|\/|\.)* on line \d+ +NULL + +--string SQ-- + +Warning: imagecolorallocate\(\) expects parameter 3 to be long, Unicode string given in (\w*|\/|\.)* on line \d+ +NULL + +--mixed case string-- + +Warning: imagecolorallocate\(\) expects parameter 3 to be long, Unicode string given in (\w*|\/|\.)* on line \d+ +NULL + +--heredoc-- + +Warning: imagecolorallocate\(\) expects parameter 3 to be long, Unicode string given in (\w*|\/|\.)* on line \d+ +NULL + +--instance of classWithToString-- + +Warning: imagecolorallocate\(\) expects parameter 3 to be long, object given in (\w*|\/|\.)* on line \d+ +NULL + +--instance of classWithoutToString-- + +Warning: imagecolorallocate\(\) expects parameter 3 to be long, object given in (\w*|\/|\.)* on line \d+ +NULL + +--undefined var-- +int\(655370\) + +--unset var-- +int\(655370\) + +--file resource-- + +Warning: imagecolorallocate\(\) expects parameter 3 to be long, resource given in (\w*|\/|\.)* on line \d+ +NULL +===DONE=== \ No newline at end of file diff --git a/ext/gd/tests/imagecolorallocate_variation4.phpt b/ext/gd/tests/imagecolorallocate_variation4.phpt new file mode 100644 index 0000000000..70fee404ee --- /dev/null +++ b/ext/gd/tests/imagecolorallocate_variation4.phpt @@ -0,0 +1,214 @@ +--TEST-- +Test imagecolorallocate() function : usage variations - passing different data types to fourth argument +--SKIPIF-- + +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$values = array( + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 10.1234567e10' => 10.1234567e10, + 'float 10.7654321E-10' => 10.7654321E-10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + //resource + "file resource" => $fp +); +// loop through each element of the array for red +foreach($values as $key => $value) { + echo "\n--$key--\n"; + var_dump( imagecolorallocate($im, $red, $green, $value) ); +}; +?> +===DONE=== +--EXPECTF-- +*** Testing imagecolorallocate() : usage variations *** + +--float 10.5-- +int(657930) + +--float -10.5-- +int(657910) + +--float 10.1234567e10-- +bool(false) + +--float 10.7654321E-10-- +int(657920) + +--float .5-- +int(657920) + +--empty array-- + +Warning: imagecolorallocate() expects parameter 4 to be long, array given in %s on line %d +NULL + +--int indexed array-- + +Warning: imagecolorallocate() expects parameter 4 to be long, array given in %s on line %d +NULL + +--associative array-- + +Warning: imagecolorallocate() expects parameter 4 to be long, array given in %s on line %d +NULL + +--nested arrays-- + +Warning: imagecolorallocate() expects parameter 4 to be long, array given in %s on line %d +NULL + +--uppercase NULL-- +int(657920) + +--lowercase null-- +int(657920) + +--lowercase true-- +int(657921) + +--lowercase false-- +int(657920) + +--uppercase TRUE-- +int(657921) + +--uppercase FALSE-- +int(657920) + +--empty string DQ-- + +Warning: imagecolorallocate() expects parameter 4 to be long, Unicode string given in %s on line %d +NULL + +--empty string SQ-- + +Warning: imagecolorallocate() expects parameter 4 to be long, Unicode string given in %s on line %d +NULL + +--string DQ-- + +Warning: imagecolorallocate() expects parameter 4 to be long, Unicode string given in %s on line %d +NULL + +--string SQ-- + +Warning: imagecolorallocate() expects parameter 4 to be long, Unicode string given in %s on line %d +NULL + +--mixed case string-- + +Warning: imagecolorallocate() expects parameter 4 to be long, Unicode string given in %s on line %d +NULL + +--heredoc-- + +Warning: imagecolorallocate() expects parameter 4 to be long, Unicode string given in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: imagecolorallocate() expects parameter 4 to be long, object given in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: imagecolorallocate() expects parameter 4 to be long, object given in %s on line %d +NULL + +--undefined var-- +int(657920) + +--unset var-- +int(657920) + +--file resource-- + +Warning: imagecolorallocate() expects parameter 4 to be long, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/gd/tests/imagecolorallocate_variation5.phpt b/ext/gd/tests/imagecolorallocate_variation5.phpt new file mode 100644 index 0000000000..794abb3d71 --- /dev/null +++ b/ext/gd/tests/imagecolorallocate_variation5.phpt @@ -0,0 +1,90 @@ +--TEST-- +Test imagecolorallocate() function : usage variations - passing octal and hexa-decimal values +--SKIPIF-- + +--FILE-- + 000, + "Octal 012" => 012, + "Octal -012" => -012, + "Octal 0377" => 0377, + + // hexa-decimal integer data + "Hexa-decimal 0x0" => 0x0, + "Hexa-decimal 0xA" => 0xA, + "Hexa-decimal -0xA" => -0xA, + "Hexa-decimal 0xFF" => 0xFF, +); + +// loop through each element of the array for blue +foreach($values as $key => $value) { + echo "\n--$key--\n"; + var_dump( imagecolorallocate($im, $value, $green, $blue) ); + var_dump( imagecolorallocate($im, $red, $value, $blue) ); + var_dump( imagecolorallocate($im, $red, $green, $value) ); +}; +?> +===DONE=== +--EXPECTF-- +*** Testing imagecolorallocate() : usage variations *** + +--Octal 000-- +int(2570) +int(655370) +int(657920) + +--Octal 012-- +int(657930) +int(657930) +int(657930) + +--Octal -012-- +bool(false) +int(652810) +int(657910) + +--Octal 0377-- +int(16714250) +int(720650) +int(658175) + +--Hexa-decimal 0x0-- +int(2570) +int(655370) +int(657920) + +--Hexa-decimal 0xA-- +int(657930) +int(657930) +int(657930) + +--Hexa-decimal -0xA-- +bool(false) +int(652810) +int(657910) + +--Hexa-decimal 0xFF-- +int(16714250) +int(720650) +int(658175) +===DONE=== diff --git a/ext/gd/tests/imagecolorallocate_variation6.phpt b/ext/gd/tests/imagecolorallocate_variation6.phpt new file mode 100644 index 0000000000..bc939c9799 --- /dev/null +++ b/ext/gd/tests/imagecolorallocate_variation6.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test imagecolorallocate() function : usage variations - passing RED, GREEN, BLUE values more than 255 +--SKIPIF-- + +--FILE-- + 256, + + // octal integer data + "Octal 0400" => 0400, + + // hexa-decimal integer data + "Hexa-decimal 0x100" => 0x100 +); + +// loop through each element of the array for blue +foreach($values as $key => $value) { + echo "\n--$key--\n"; + //Need to be created every time to get expected return value + $im_palette = imagecreate(200, 200); + $im_true_color = imagecreatetruecolor(200, 200); + var_dump( imagecolorallocate($im_palette, $value, $value, $value) ); + var_dump( imagecolorallocate($im_true_color, $value, $value, $value) ); +}; +?> +===DONE=== +--EXPECTF-- +*** Testing imagecolorallocate() : usage variations *** + +--Decimal 256-- +int(0) +int(16843008) + +--Octal 0400-- +int(0) +int(16843008) + +--Hexa-decimal 0x100-- +int(0) +int(16843008) +===DONE=== diff --git a/ext/gd/tests/imagecolorstotal_basic.phpt b/ext/gd/tests/imagecolorstotal_basic.phpt new file mode 100644 index 0000000000..472a10d864 --- /dev/null +++ b/ext/gd/tests/imagecolorstotal_basic.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test imagecolorstotal() function : basic functionality +--SKIPIF-- + +--FILE-- + + +===DONE=== +--EXPECTF-- +*** Testing imagecolorstotal() : basic functionality *** +Total colors in image: 128 +===DONE=== \ No newline at end of file diff --git a/ext/gd/tests/imagecolorstotal_error.phpt b/ext/gd/tests/imagecolorstotal_error.phpt new file mode 100644 index 0000000000..c3a0b2d2fb --- /dev/null +++ b/ext/gd/tests/imagecolorstotal_error.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test imagecolorstotal() function : error conditions - Pass incorrect number of arguments +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing imagecolorstotal() : error conditions *** + +-- Testing imagecolorstotal() function with Zero arguments -- + +Warning: imagecolorstotal() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing imagecolorstotal() function with more than expected no. of arguments -- + +Warning: imagecolorstotal() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +-- Testing imagecolorstotal() function with a invalid resource + +Warning: imagecolorstotal(): supplied resource is not a valid Image resource in %s on line %d +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/gd/tests/php.gif b/ext/gd/tests/php.gif new file mode 100644 index 0000000000..f352c7308f Binary files /dev/null and b/ext/gd/tests/php.gif differ