summaryrefslogtreecommitdiff
path: root/ext/gd/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gd/tests')
-rw-r--r--[-rwxr-xr-x]ext/gd/tests/Tuffy.ttfbin18444 -> 18444 bytes
-rw-r--r--ext/gd/tests/bug73291.phpt35
-rw-r--r--ext/gd/tests/imagecolorallocate_variation1.phpt267
-rw-r--r--ext/gd/tests/imagecolorallocate_variation2.phpt215
-rw-r--r--ext/gd/tests/imagecolorallocate_variation3.phpt214
-rw-r--r--ext/gd/tests/imagecolorallocate_variation4.phpt214
-rw-r--r--ext/gd/tests/imagecrop_auto-ext.phpt85
-rw-r--r--ext/gd/tests/imagecrop_auto.phpt9
-rw-r--r--ext/gd/tests/imageloadfont_end_of_file_while_reading_header.phpt35
-rw-r--r--ext/gd/tests/imagescale_preserve_ratio.phpt55
-rw-r--r--ext/gd/tests/simpletext私はガラスを食べられます.jpgbin1514 -> 0 bytes
-rw-r--r--ext/gd/tests/src.pngbin9 -> 0 bytes
12 files changed, 129 insertions, 1000 deletions
diff --git a/ext/gd/tests/Tuffy.ttf b/ext/gd/tests/Tuffy.ttf
index 8ea647090f..8ea647090f 100755..100644
--- a/ext/gd/tests/Tuffy.ttf
+++ b/ext/gd/tests/Tuffy.ttf
Binary files differ
diff --git a/ext/gd/tests/bug73291.phpt b/ext/gd/tests/bug73291.phpt
new file mode 100644
index 0000000000..ffa2fe7e4c
--- /dev/null
+++ b/ext/gd/tests/bug73291.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Bug #73291 (imagecropauto() $threshold differs from external libgd)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+
+$src = imagecreatetruecolor(255, 255);
+$white = imagecolorallocate($src, 255, 255, 255);
+imagefilledrectangle($src, 0, 0, 254, 254, $white);
+
+for ($i = 254; $i > 0; $i--) {
+ $color = imagecolorallocate($src, $i, $i, $i);
+ imagefilledellipse($src, 127, 127, $i, $i, $color);
+}
+
+foreach ([0.1, 0.5, 1.0, 10.0] as $threshold) {
+ $dst = imagecropauto($src, IMG_CROP_THRESHOLD, $threshold, $white);
+ if ($dst !== false) {
+ printf("size: %d*%d\n", imagesx($dst), imagesy($dst));
+ } else {
+ echo "cropped to zero size\n";
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+size: 247*247
+size: 237*237
+size: 229*229
+size: 175*175
+===DONE===
diff --git a/ext/gd/tests/imagecolorallocate_variation1.phpt b/ext/gd/tests/imagecolorallocate_variation1.phpt
deleted file mode 100644
index 37d9f95a89..0000000000
--- a/ext/gd/tests/imagecolorallocate_variation1.phpt
+++ /dev/null
@@ -1,267 +0,0 @@
---TEST--
-Test imagecolorallocate() function : usage variations - passing different data types to first argument
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-?>
---FILE--
-<?php
-/* Prototype : int imagecolorallocate(resource im, int red, int green, int blue)
- * Description: Allocate a color for an image
- * Source code: ext/gd/gd.c
- */
-
-echo "*** Testing imagecolorallocate() : usage variations ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$red = 10;
-$green = 10;
-$blue = 10;
-
-$fp = tmpfile();
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 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, int given in %s on line %d
-NULL
-
--- int 1 --
-
-Warning: imagecolorallocate() expects parameter 1 to be resource, int given in %s on line %d
-NULL
-
--- int 12345 --
-
-Warning: imagecolorallocate() expects parameter 1 to be resource, int given in %s on line %d
-NULL
-
--- int -12345 --
-
-Warning: imagecolorallocate() expects parameter 1 to be resource, int given in %s on line %d
-NULL
-
--- float 10.5 --
-
-Warning: imagecolorallocate() expects parameter 1 to be resource, float given in %s on line %d
-NULL
-
--- float -10.5 --
-
-Warning: imagecolorallocate() expects parameter 1 to be resource, float given in %s on line %d
-NULL
-
--- float 10.1234567e10 --
-
-Warning: imagecolorallocate() expects parameter 1 to be resource, float given in %s on line %d
-NULL
-
--- float 10.7654321E-10 --
-
-Warning: imagecolorallocate() expects parameter 1 to be resource, float given in %s on line %d
-NULL
-
--- float .5 --
-
-Warning: imagecolorallocate() expects parameter 1 to be resource, float 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, bool given in %s on line %d
-NULL
-
--- lowercase false --
-
-Warning: imagecolorallocate() expects parameter 1 to be resource, bool given in %s on line %d
-NULL
-
--- uppercase TRUE --
-
-Warning: imagecolorallocate() expects parameter 1 to be resource, bool given in %s on line %d
-NULL
-
--- uppercase FALSE --
-
-Warning: imagecolorallocate() expects parameter 1 to be resource, bool 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
deleted file mode 100644
index e46e0da960..0000000000
--- a/ext/gd/tests/imagecolorallocate_variation2.phpt
+++ /dev/null
@@ -1,215 +0,0 @@
---TEST--
-Test imagecolorallocate() function : usage variations - passing different data types to second argument
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('imagecreatetruecolor')) {
- die('skip imagecreatetruecolor function is not available');
-}
-if (PHP_INT_SIZE != 8) die('skip 64-bit only');
-?>
---FILE--
-<?php
-/* Prototype : int imagecolorallocate(resource im, int red, int green, int blue)
- * Description: Allocate a color for an image
- * Source code: ext/gd/gd.c
- */
-
-echo "*** Testing imagecolorallocate() : usage variations ***\n";
-
-$im = imagecreatetruecolor(200, 200);
-$green = 10;
-$blue = 10;
-
-$fp = tmpfile();
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 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 int, array given in %s on line %d
-NULL
-
---int indexed array--
-
-Warning: imagecolorallocate() expects parameter 2 to be int, array given in %s on line %d
-NULL
-
---associative array--
-
-Warning: imagecolorallocate() expects parameter 2 to be int, array given in %s on line %d
-NULL
-
---nested arrays--
-
-Warning: imagecolorallocate() expects parameter 2 to be int, 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 int, string given in %s on line %d
-NULL
-
---empty string SQ--
-
-Warning: imagecolorallocate() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
---string DQ--
-
-Warning: imagecolorallocate() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
---string SQ--
-
-Warning: imagecolorallocate() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
---mixed case string--
-
-Warning: imagecolorallocate() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
---heredoc--
-
-Warning: imagecolorallocate() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: imagecolorallocate() expects parameter 2 to be int, object given in %s on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: imagecolorallocate() expects parameter 2 to be int, 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 int, 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
deleted file mode 100644
index 8552f976c7..0000000000
--- a/ext/gd/tests/imagecolorallocate_variation3.phpt
+++ /dev/null
@@ -1,214 +0,0 @@
---TEST--
-Test imagecolorallocate() function : usage variations - passing different data types to third argument
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('imagecreatetruecolor')) {
- die('skip imagecreatetruecolor function is not available');
-}
-?>
---FILE--
-<?php
-/* Prototype : imagecolorallocate(resource im, int red, int green, int blue)
- * Description: Allocate a color for an image
- * Source code: ext/gd/gd.c
- */
-
-echo "*** Testing imagecolorallocate() : usage variations ***\n";
-
-$im = imagecreatetruecolor(200, 200);
-$red = 10;
-$blue = 10;
-
-$fp = tmpfile();
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 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 int, array given in %s on line %d
-NULL
-
---int indexed array--
-
-Warning: imagecolorallocate() expects parameter 3 to be int, array given in %s on line %d
-NULL
-
---associative array--
-
-Warning: imagecolorallocate() expects parameter 3 to be int, array given in %s on line %d
-NULL
-
---nested arrays--
-
-Warning: imagecolorallocate() expects parameter 3 to be int, 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 int, string given in %s on line %d
-NULL
-
---empty string SQ--
-
-Warning: imagecolorallocate() expects parameter 3 to be int, string given in %s on line %d
-NULL
-
---string DQ--
-
-Warning: imagecolorallocate() expects parameter 3 to be int, string given in %s on line %d
-NULL
-
---string SQ--
-
-Warning: imagecolorallocate() expects parameter 3 to be int, string given in %s on line %d
-NULL
-
---mixed case string--
-
-Warning: imagecolorallocate() expects parameter 3 to be int, string given in %s on line %d
-NULL
-
---heredoc--
-
-Warning: imagecolorallocate() expects parameter 3 to be int, string given in %s on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: imagecolorallocate() expects parameter 3 to be int, object given in %s on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: imagecolorallocate() expects parameter 3 to be int, 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 int, resource given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/gd/tests/imagecolorallocate_variation4.phpt b/ext/gd/tests/imagecolorallocate_variation4.phpt
deleted file mode 100644
index ad8908eeea..0000000000
--- a/ext/gd/tests/imagecolorallocate_variation4.phpt
+++ /dev/null
@@ -1,214 +0,0 @@
---TEST--
-Test imagecolorallocate() function : usage variations - passing different data types to fourth argument
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('imagecreatetruecolor')) {
- die('skip imagecreatetruecolor function is not available');
-}
-if (PHP_INT_SIZE != 8) die('skip 64-bit only');
-?>
---FILE--
-<?php
-/* Prototype : int imagecolorallocate(resource im, int red, int green, int blue)
- * Description: Allocate a color for an image
- * Source code: ext/gd/gd.c
- */
-echo "*** Testing imagecolorallocate() : usage variations ***\n";
-
-$im = imagecreatetruecolor(200, 200);
-$red = 10;
-$green = 10;
-
-$fp = tmpfile();
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 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 int, array given in %s on line %d
-NULL
-
---int indexed array--
-
-Warning: imagecolorallocate() expects parameter 4 to be int, array given in %s on line %d
-NULL
-
---associative array--
-
-Warning: imagecolorallocate() expects parameter 4 to be int, array given in %s on line %d
-NULL
-
---nested arrays--
-
-Warning: imagecolorallocate() expects parameter 4 to be int, 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 int, string given in %s on line %d
-NULL
-
---empty string SQ--
-
-Warning: imagecolorallocate() expects parameter 4 to be int, string given in %s on line %d
-NULL
-
---string DQ--
-
-Warning: imagecolorallocate() expects parameter 4 to be int, string given in %s on line %d
-NULL
-
---string SQ--
-
-Warning: imagecolorallocate() expects parameter 4 to be int, string given in %s on line %d
-NULL
-
---mixed case string--
-
-Warning: imagecolorallocate() expects parameter 4 to be int, string given in %s on line %d
-NULL
-
---heredoc--
-
-Warning: imagecolorallocate() expects parameter 4 to be int, string given in %s on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: imagecolorallocate() expects parameter 4 to be int, object given in %s on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: imagecolorallocate() expects parameter 4 to be int, 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 int, resource given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/gd/tests/imagecrop_auto-ext.phpt b/ext/gd/tests/imagecrop_auto-ext.phpt
deleted file mode 100644
index cc88e5d657..0000000000
--- a/ext/gd/tests/imagecrop_auto-ext.phpt
+++ /dev/null
@@ -1,85 +0,0 @@
---TEST--
-Testing imagecropauto()
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
-if (GD_BUNDLED) die('skip requires external libgd');
-?>
---FILE--
-<?php
-
-echo "TC IMG_CROP_DEFAULT\n";
-$im = imagecreatetruecolor(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "Palette IMG_CROP_DEFAULT\n";
-$im = imagecreate(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "TC IMG_CROP_SIDES\n";
-$im = imagecreatetruecolor(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_SIDES);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "Palette IMG_CROP_SIDES\n";
-$im = imagecreate(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_SIDES);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "TC IMG_CROP_BLACK\n";
-$im = imagecreatetruecolor(50, 50);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_BLACK);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "Palette IMG_CROP_BLACK\n";
-$im = imagecreate(50, 50);
-$bgd = imagecolorallocate($im, 0, 0, 0);
-$b = imagecolorallocate($im, 0, 0, 255);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_BLACK);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "IMG_CROP_THRESHOLD\n";
-$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
-$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
-imagepng($im_crop, __DIR__ . "/crop_threshold.png");
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-@unlink(__DIR__ . "/crop_threshold.png");
-?>
---EXPECT--
-TC IMG_CROP_DEFAULT
-int(99)
-int(99)
-Palette IMG_CROP_DEFAULT
-int(99)
-int(99)
-TC IMG_CROP_SIDES
-int(11)
-int(11)
-Palette IMG_CROP_SIDES
-int(11)
-int(11)
-TC IMG_CROP_BLACK
-int(11)
-int(11)
-Palette IMG_CROP_BLACK
-int(11)
-int(11)
-IMG_CROP_THRESHOLD
-int(240)
-int(134)
diff --git a/ext/gd/tests/imagecrop_auto.phpt b/ext/gd/tests/imagecrop_auto.phpt
index b12cc971ee..97cac3da01 100644
--- a/ext/gd/tests/imagecrop_auto.phpt
+++ b/ext/gd/tests/imagecrop_auto.phpt
@@ -3,7 +3,6 @@ Testing imagecropauto()
--SKIPIF--
<?php
if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
-if (!GD_BUNDLED) die('skip requires bundled libgd');
?>
--FILE--
<?php
@@ -63,11 +62,11 @@ var_dump(imagesy($im_crop));
?>
--EXPECT--
TC IMG_CROP_DEFAULT
-int(11)
-int(11)
+int(99)
+int(99)
Palette IMG_CROP_DEFAULT
-int(11)
-int(11)
+int(99)
+int(99)
TC IMG_CROP_SIDES
int(11)
int(11)
diff --git a/ext/gd/tests/imageloadfont_end_of_file_while_reading_header.phpt b/ext/gd/tests/imageloadfont_end_of_file_while_reading_header.phpt
new file mode 100644
index 0000000000..ef13bb179d
--- /dev/null
+++ b/ext/gd/tests/imageloadfont_end_of_file_while_reading_header.phpt
@@ -0,0 +1,35 @@
+--TEST--
+imageloadfont() "End of file while reading header"
+--CREDITS--
+Ike Devolder <ike.devolder@gmail.com>
+User Group: PHP-WVL & PHPGent #PHPTestFest
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die("skip gd extension not available\n");
+?>
+--FILE--
+<?php
+$filename = dirname(__FILE__) . '/font.gdf';
+
+// End of file while reading header
+$bin = "\x41\x41\x41\x41\x00\x00\x00\x00\x00\x00";
+$fp = fopen($filename, 'wb');
+fwrite($fp, $bin);
+fclose($fp);
+$font = imageloadfont($filename);
+
+// Error while reading header
+$bin = "\xe0\x00\x00\x00\x20\x00\x00\x00\x06\x00\x00\x00\x0a\x00\x00";
+$fp = fopen($filename, 'wb');
+fwrite($fp, $bin);
+fclose($fp);
+$font = imageloadfont($filename);
+?>
+--CLEAN--
+<?php
+unlink(__DIR__.'/font.gdf');
+?>
+--EXPECTF--
+Warning: imageloadfont(): End of file while reading header in %s on line %d
+
+Warning: imageloadfont(): End of file while reading header in %s on line %d
diff --git a/ext/gd/tests/imagescale_preserve_ratio.phpt b/ext/gd/tests/imagescale_preserve_ratio.phpt
new file mode 100644
index 0000000000..00076e431e
--- /dev/null
+++ b/ext/gd/tests/imagescale_preserve_ratio.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Scale images and preserve aspect ratio
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die("skip gd extension not available\n");
+?>
+--FILE--
+<?php
+
+$img = imagecreatetruecolor ( 256, 384);
+
+$thumbnail = imagescale($img, 64, -1, IMG_BICUBIC);
+var_dump(imagesx($thumbnail));
+var_dump(imagesy($thumbnail));
+
+$thumbnail = imagescale($img, -1, 64, IMG_BICUBIC);
+var_dump(imagesx($thumbnail));
+var_dump(imagesy($thumbnail));
+
+$img = imagecreatetruecolor ( 384, 256);
+
+$thumbnail = imagescale($img, 64, -1, IMG_BICUBIC);
+var_dump(imagesx($thumbnail));
+var_dump(imagesy($thumbnail));
+
+$thumbnail = imagescale($img, -1, 64, IMG_BICUBIC);
+var_dump(imagesx($thumbnail));
+var_dump(imagesy($thumbnail));
+
+$img = imagecreatetruecolor ( 256, 256);
+
+$thumbnail = imagescale($img, 64, -1, IMG_BICUBIC);
+var_dump(imagesx($thumbnail));
+var_dump(imagesy($thumbnail));
+
+$thumbnail = imagescale($img, -1, 64, IMG_BICUBIC);
+var_dump(imagesx($thumbnail));
+var_dump(imagesy($thumbnail));
+
+?>
+DONE
+--EXPECT--
+int(64)
+int(96)
+int(42)
+int(64)
+int(64)
+int(42)
+int(96)
+int(64)
+int(64)
+int(64)
+int(64)
+int(64)
+DONE
diff --git a/ext/gd/tests/simpletext私はガラスを食べられます.jpg b/ext/gd/tests/simpletext私はガラスを食べられます.jpg
deleted file mode 100644
index c527d7982f..0000000000
--- a/ext/gd/tests/simpletext私はガラスを食べられます.jpg
+++ /dev/null
Binary files differ
diff --git a/ext/gd/tests/src.png b/ext/gd/tests/src.png
deleted file mode 100644
index d38c74268a..0000000000
--- a/ext/gd/tests/src.png
+++ /dev/null
Binary files differ