From be84cfa32729c251ed5350c9f226809369d34b66 Mon Sep 17 00:00:00 2001 From: andy wharmby Date: Thu, 22 Jan 2009 13:27:32 +0000 Subject: [PATCH] New image tests. Tested on Windows, LInux and Linux 64 bit --- .../image_type_to_mime_type_variation3.phpt | 76 +++++ .../image_type_to_mime_type_variation4.phpt | 29 ++ ext/gd/tests/imagecolorallocate_basic.phpt | 35 +++ ext/gd/tests/imagecolorallocate_error.phpt | 49 ++++ .../tests/imagecolorallocate_variation1.phpt | 267 ++++++++++++++++++ .../tests/imagecolorallocate_variation2.phpt | 214 ++++++++++++++ .../tests/imagecolorallocate_variation3.phpt | 214 ++++++++++++++ .../tests/imagecolorallocate_variation4.phpt | 213 ++++++++++++++ .../tests/imagecolorallocate_variation5.phpt | 90 ++++++ .../tests/imagecolorallocate_variation6.phpt | 56 ++++ ext/gd/tests/imagecolorstotal_basic.phpt | 36 +++ ext/gd/tests/imagecolorstotal_error.phpt | 54 ++++ ext/gd/tests/php.gif | Bin 0 -> 2523 bytes 13 files changed, 1333 insertions(+) create mode 100644 ext/gd/tests/image_type_to_mime_type_variation3.phpt create mode 100644 ext/gd/tests/image_type_to_mime_type_variation4.phpt create mode 100644 ext/gd/tests/imagecolorallocate_basic.phpt create mode 100644 ext/gd/tests/imagecolorallocate_error.phpt create mode 100644 ext/gd/tests/imagecolorallocate_variation1.phpt create mode 100644 ext/gd/tests/imagecolorallocate_variation2.phpt create mode 100644 ext/gd/tests/imagecolorallocate_variation3.phpt create mode 100644 ext/gd/tests/imagecolorallocate_variation4.phpt create mode 100644 ext/gd/tests/imagecolorallocate_variation5.phpt create mode 100644 ext/gd/tests/imagecolorallocate_variation6.phpt create mode 100644 ext/gd/tests/imagecolorstotal_basic.phpt create mode 100644 ext/gd/tests/imagecolorstotal_error.phpt create mode 100644 ext/gd/tests/php.gif 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..a1c042a060 --- /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 -- +string\(9\) "image\/gif" + +-- Iteration 2 -- +string\(10\) "image\/jpeg" + +-- Iteration 3 -- +string\(9\) "image\/png" + +-- Iteration 4 -- +string\(29\) "application\/x-shockwave-flash" + +-- Iteration 5 -- +string\(9\) "image\/psd" + +-- Iteration 6 -- +string\(9\) "image\/bmp" + +-- Iteration 7 -- +string\(10\) "image\/tiff" + +-- Iteration 8 -- +string\(10\) "image\/tiff" + +-- Iteration 9 -- +string\(24\) "application\/octet-stream" + +-- Iteration 10 -- +string\(9\) "image\/jp2" + +-- Iteration 11 -- +string\(24\) "application\/octet-stream" + +-- Iteration 12 -- +string\(24\) "application\/octet-stream" + +-- Iteration 13 -- +string\(2[49]\) "application\/(x-shockwave-flash|octet-stream)" + +-- Iteration 14 -- +string\(9\) "image\/iff" + +-- Iteration 15 -- +string\(18\) "image\/vnd.wap.wbmp" + +-- Iteration 16 -- +string\(9\) "image\/xbm" + +-- Iteration 17 -- +string\(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..a67bb86a69 --- /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 *** +string(24) "image/vnd.microsoft.icon" +string(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..552a0fc084 --- /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, string given in %s on line %d +NULL + +-- empty string SQ -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- string DQ -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- string SQ -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- mixed case string -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- heredoc -- + +Warning: imagecolorallocate() expects parameter 1 to be resource, 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..bd9dc984d1 --- /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, string given in %s on line %d +NULL + +--empty string SQ-- + +Warning: imagecolorallocate() expects parameter 2 to be long, string given in %s on line %d +NULL + +--string DQ-- + +Warning: imagecolorallocate() expects parameter 2 to be long, string given in %s on line %d +NULL + +--string SQ-- + +Warning: imagecolorallocate() expects parameter 2 to be long, string given in %s on line %d +NULL + +--mixed case string-- + +Warning: imagecolorallocate() expects parameter 2 to be long, string given in %s on line %d +NULL + +--heredoc-- + +Warning: imagecolorallocate() expects parameter 2 to be long, 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..c48dc29cf5 --- /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.1234567e5' => 10.1234567e5, + 'float 10.7654321E-5' => 10.7654321E-5, + '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=== +--EXPECTF-- +*** Testing imagecolorallocate() : usage variations *** + +--float 10.5-- +int(657930) + +--float -10.5-- +int(652810) + +--float 10.1234567e5-- +int(259815690) + +--float 10.7654321E-5-- +int(655370) + +--float .5-- +int(655370) + +--empty array-- + +Warning: imagecolorallocate() expects parameter 3 to be long, array given in %s on line %d +NULL + +--int indexed array-- + +Warning: imagecolorallocate() expects parameter 3 to be long, array given in %s on line %d +NULL + +--associative array-- + +Warning: imagecolorallocate() expects parameter 3 to be long, array given in %s on line %d +NULL + +--nested arrays-- + +Warning: imagecolorallocate() expects parameter 3 to be long, array given in %s 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, string given in %s on line %d +NULL + +--empty string SQ-- + +Warning: imagecolorallocate() expects parameter 3 to be long, string given in %s on line %d +NULL + +--string DQ-- + +Warning: imagecolorallocate() expects parameter 3 to be long, string given in %s on line %d +NULL + +--string SQ-- + +Warning: imagecolorallocate() expects parameter 3 to be long, string given in %s on line %d +NULL + +--mixed case string-- + +Warning: imagecolorallocate() expects parameter 3 to be long, string given in %s on line %d +NULL + +--heredoc-- + +Warning: imagecolorallocate() expects parameter 3 to be long, string given in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: imagecolorallocate() expects parameter 3 to be long, object given in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: imagecolorallocate() expects parameter 3 to be long, object given in %s 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 %s 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..328a4cd3b2 --- /dev/null +++ b/ext/gd/tests/imagecolorallocate_variation4.phpt @@ -0,0 +1,213 @@ +--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, string given in %s on line %d +NULL + +--empty string SQ-- + +Warning: imagecolorallocate() expects parameter 4 to be long, string given in %s on line %d +NULL + +--string DQ-- + +Warning: imagecolorallocate() expects parameter 4 to be long, string given in %s on line %d +NULL + +--string SQ-- + +Warning: imagecolorallocate() expects parameter 4 to be long, string given in %s on line %d +NULL + +--mixed case string-- + +Warning: imagecolorallocate() expects parameter 4 to be long, string given in %s on line %d +NULL + +--heredoc-- + +Warning: imagecolorallocate() expects parameter 4 to be long, 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=== \ No newline at end of file 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..a7f3b95719 --- /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=== diff --git a/ext/gd/tests/php.gif b/ext/gd/tests/php.gif new file mode 100644 index 0000000000000000000000000000000000000000..f352c7308fee4c5cb1ab4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