summaryrefslogtreecommitdiff
path: root/ext/gd/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gd/tests')
-rw-r--r--ext/gd/tests/bug42434.phpt52
-rw-r--r--ext/gd/tests/bug47946.phpt102
-rw-r--r--ext/gd/tests/bug52070.phpt50
-rw-r--r--ext/gd/tests/bug53156.phpt120
-rw-r--r--ext/gd/tests/bug72494.phpt30
-rw-r--r--ext/gd/tests/bug73272.phpt48
-rw-r--r--ext/gd/tests/bug73279.phpt40
-rw-r--r--ext/gd/tests/bug73279_old.phpt44
-rw-r--r--ext/gd/tests/bug73968.phpt30
-rw-r--r--ext/gd/tests/func.inc296
-rw-r--r--ext/gd/tests/imagecrop_auto-ext.phpt170
-rw-r--r--ext/gd/tests/imagecrop_auto.phpt170
-rw-r--r--ext/gd/tests/imageellipse_error8.phpt40
-rw-r--r--ext/gd/tests/imagefilltoborder_error7.phpt50
-rw-r--r--ext/gd/tests/imageflip.phpt58
-rw-r--r--ext/gd/tests/imagerectangle_basic.phpt44
-rw-r--r--ext/gd/tests/imagerectangle_error1.phpt36
-rw-r--r--ext/gd/tests/imagerectangle_error2.phpt36
-rw-r--r--ext/gd/tests/imagerectangle_error3.phpt36
-rw-r--r--ext/gd/tests/imagerectangle_error4.phpt36
-rw-r--r--ext/gd/tests/imagerectangle_error5.phpt36
-rw-r--r--ext/gd/tests/imagerectangle_error6.phpt36
-rw-r--r--ext/gd/tests/imagerectangle_error7.phpt36
-rw-r--r--ext/gd/tests/imagerectangle_error8.phpt36
-rw-r--r--ext/gd/tests/test_image_equals_file_palette.phpt84
-rw-r--r--ext/gd/tests/webp_basic.phpt76
26 files changed, 896 insertions, 896 deletions
diff --git a/ext/gd/tests/bug42434.phpt b/ext/gd/tests/bug42434.phpt
index bc0790ede4..9067500090 100644
--- a/ext/gd/tests/bug42434.phpt
+++ b/ext/gd/tests/bug42434.phpt
@@ -1,27 +1,27 @@
---TEST--
-Bug #42434 (ImageLine w/ antialias = 1px shorter)
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) {
- die('skip gd extension not available');
-}
-if (!GD_BUNDLED) die("skip requires bundled GD library\n");
-?>
---FILE--
-<?php
-$im = imagecreatetruecolor(10, 2);
-imagefilledrectangle($im, 0, 0, 10, 2, 0xFFFFFF);
-
-imageantialias($im, true);
-imageline($im, 0, 0, 10, 0, 0x000000);
-
-if (imagecolorat($im, 9, 0) == 0x000000) {
- echo 'DONE';
-} else {
- echo 'Bugged';
-}
-
-imagedestroy($im);
-?>
---EXPECTF--
+--TEST--
+Bug #42434 (ImageLine w/ antialias = 1px shorter)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) {
+ die('skip gd extension not available');
+}
+if (!GD_BUNDLED) die("skip requires bundled GD library\n");
+?>
+--FILE--
+<?php
+$im = imagecreatetruecolor(10, 2);
+imagefilledrectangle($im, 0, 0, 10, 2, 0xFFFFFF);
+
+imageantialias($im, true);
+imageline($im, 0, 0, 10, 0, 0x000000);
+
+if (imagecolorat($im, 9, 0) == 0x000000) {
+ echo 'DONE';
+} else {
+ echo 'Bugged';
+}
+
+imagedestroy($im);
+?>
+--EXPECTF--
DONE \ No newline at end of file
diff --git a/ext/gd/tests/bug47946.phpt b/ext/gd/tests/bug47946.phpt
index c84508509c..aeea7fb324 100644
--- a/ext/gd/tests/bug47946.phpt
+++ b/ext/gd/tests/bug47946.phpt
@@ -1,51 +1,51 @@
---TEST--
-Bug #47946 (ImageConvolution overwrites background)
---DESCRIPTION--
-The expected image has black pixel artifacts, what is another issue, though
-(perhaps #40158).
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-function array_flatten($array)
-{
- $tempArray = array();
-
- foreach ($array as $value) {
- if (is_array($value)) {
- $tempArray = array_merge($tempArray, array_flatten($value));
- } else {
- $tempArray[] = $value;
- }
- }
-
- return $tempArray;
-}
-
-function makeFilter($resource, $matrix, $offset = 1.0)
-{
- $divisor = array_sum(array_flatten($matrix));
- if ($divisor == 0) {
- $divisor = .01;
- }
- return imageconvolution($resource, $matrix, $divisor, $offset);
-}
-
-$edgeMatrix = array(array(1, 0, 1), array(0, 5, 0), array(1, 0, 1));
-
-$im = imagecreatetruecolor(40, 40);
-imagealphablending($im, false);
-imagefilledrectangle($im, 0, 0, 39, 39, 0x7fffffff);
-imagefilledellipse($im, 19, 19, 20, 20, 0x00ff00);
-imagesavealpha($im, true);
-makeFilter($im, $edgeMatrix);
-
-require_once __DIR__ . '/func.inc';
-test_image_equals_file(__DIR__ . '/bug47946_exp.png', $im);
-?>
-===DONE===
---EXPECT--
-The images are equal.
-===DONE===
+--TEST--
+Bug #47946 (ImageConvolution overwrites background)
+--DESCRIPTION--
+The expected image has black pixel artifacts, what is another issue, though
+(perhaps #40158).
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+function array_flatten($array)
+{
+ $tempArray = array();
+
+ foreach ($array as $value) {
+ if (is_array($value)) {
+ $tempArray = array_merge($tempArray, array_flatten($value));
+ } else {
+ $tempArray[] = $value;
+ }
+ }
+
+ return $tempArray;
+}
+
+function makeFilter($resource, $matrix, $offset = 1.0)
+{
+ $divisor = array_sum(array_flatten($matrix));
+ if ($divisor == 0) {
+ $divisor = .01;
+ }
+ return imageconvolution($resource, $matrix, $divisor, $offset);
+}
+
+$edgeMatrix = array(array(1, 0, 1), array(0, 5, 0), array(1, 0, 1));
+
+$im = imagecreatetruecolor(40, 40);
+imagealphablending($im, false);
+imagefilledrectangle($im, 0, 0, 39, 39, 0x7fffffff);
+imagefilledellipse($im, 19, 19, 20, 20, 0x00ff00);
+imagesavealpha($im, true);
+makeFilter($im, $edgeMatrix);
+
+require_once __DIR__ . '/func.inc';
+test_image_equals_file(__DIR__ . '/bug47946_exp.png', $im);
+?>
+===DONE===
+--EXPECT--
+The images are equal.
+===DONE===
diff --git a/ext/gd/tests/bug52070.phpt b/ext/gd/tests/bug52070.phpt
index acf56e6b5b..d44a527479 100644
--- a/ext/gd/tests/bug52070.phpt
+++ b/ext/gd/tests/bug52070.phpt
@@ -1,25 +1,25 @@
---TEST--
-Bug #52070 (imagedashedline() - dashed line sometimes is not visible)
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-$im = imagecreate(1200, 800);
-$background_color = imagecolorallocate($im, 40, 40, 40);
-$color = imagecolorallocate($im, 255, 255, 255);
-imagedashedline($im, 800, 400, 300, 400, $color);
-imagedashedline($im, 800, 400, 300, 800, $color);
-imagedashedline($im, 800, 400, 400, 800, $color);
-imagedashedline($im, 800, 400, 500, 800, $color);
-imagedashedline($im, 800, 400, 600, 800, $color);
-imagedashedline($im, 800, 400, 700, 800, $color);
-imagedashedline($im, 800, 400, 800, 800, $color);
-include_once __DIR__ . '/func.inc';
-test_image_equals_file(__DIR__ . '/bug52070.png', $im);
-?>
-===DONE===
---EXPECT--
-The images are equal.
-===DONE===
+--TEST--
+Bug #52070 (imagedashedline() - dashed line sometimes is not visible)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+$im = imagecreate(1200, 800);
+$background_color = imagecolorallocate($im, 40, 40, 40);
+$color = imagecolorallocate($im, 255, 255, 255);
+imagedashedline($im, 800, 400, 300, 400, $color);
+imagedashedline($im, 800, 400, 300, 800, $color);
+imagedashedline($im, 800, 400, 400, 800, $color);
+imagedashedline($im, 800, 400, 500, 800, $color);
+imagedashedline($im, 800, 400, 600, 800, $color);
+imagedashedline($im, 800, 400, 700, 800, $color);
+imagedashedline($im, 800, 400, 800, 800, $color);
+include_once __DIR__ . '/func.inc';
+test_image_equals_file(__DIR__ . '/bug52070.png', $im);
+?>
+===DONE===
+--EXPECT--
+The images are equal.
+===DONE===
diff --git a/ext/gd/tests/bug53156.phpt b/ext/gd/tests/bug53156.phpt
index 9e1fec8798..ceb37c13c4 100644
--- a/ext/gd/tests/bug53156.phpt
+++ b/ext/gd/tests/bug53156.phpt
@@ -1,60 +1,60 @@
---TEST--
-Bug #53156 (imagerectangle problem with point ordering)
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3', '<')) {
- die("skip test requires GD 2.3 or newer");
-}
-?>
---FILE--
-<?php
-function draw_and_check_pixel($x, $y)
-{
- global $img, $black, $red;
-
- echo (imagecolorat($img, $x, $y) === $black) ? '+' : '-';
- imagesetpixel($img, $x, $y, $red);
-}
-
-function draw_and_check_rectangle($x1, $y1, $x2, $y2)
-{
- global $img, $black;
-
- echo 'Rectangle: ';
- imagerectangle($img, $x1, $y1, $x2, $y2, $black);
- $x = ($x1 + $x2) / 2;
- $y = ($y1 + $y2) / 2;
- draw_and_check_pixel($x, $y1);
- draw_and_check_pixel($x1, $y);
- draw_and_check_pixel($x, $y2);
- draw_and_check_pixel($x2, $y);
- echo PHP_EOL;
-}
-
-$img = imagecreate(110, 210);
-$bgnd = imagecolorallocate($img, 255, 255, 255);
-$black = imagecolorallocate($img, 0, 0, 0);
-$red = imagecolorallocate($img, 255, 0, 0);
-
-draw_and_check_rectangle( 10, 10, 50, 50);
-draw_and_check_rectangle( 50, 60, 10, 100);
-draw_and_check_rectangle( 50, 150, 10, 110);
-draw_and_check_rectangle( 10, 200, 50, 160);
-imagesetthickness($img, 4);
-draw_and_check_rectangle( 60, 10, 100, 50);
-draw_and_check_rectangle(100, 60, 60, 100);
-draw_and_check_rectangle(100, 150, 60, 110);
-draw_and_check_rectangle( 60, 200, 100, 160);
-
-//imagepng($img, __DIR__ . '/bug53156.png'); // debug
-?>
---EXPECT--
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
+--TEST--
+Bug #53156 (imagerectangle problem with point ordering)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3', '<')) {
+ die("skip test requires GD 2.3 or newer");
+}
+?>
+--FILE--
+<?php
+function draw_and_check_pixel($x, $y)
+{
+ global $img, $black, $red;
+
+ echo (imagecolorat($img, $x, $y) === $black) ? '+' : '-';
+ imagesetpixel($img, $x, $y, $red);
+}
+
+function draw_and_check_rectangle($x1, $y1, $x2, $y2)
+{
+ global $img, $black;
+
+ echo 'Rectangle: ';
+ imagerectangle($img, $x1, $y1, $x2, $y2, $black);
+ $x = ($x1 + $x2) / 2;
+ $y = ($y1 + $y2) / 2;
+ draw_and_check_pixel($x, $y1);
+ draw_and_check_pixel($x1, $y);
+ draw_and_check_pixel($x, $y2);
+ draw_and_check_pixel($x2, $y);
+ echo PHP_EOL;
+}
+
+$img = imagecreate(110, 210);
+$bgnd = imagecolorallocate($img, 255, 255, 255);
+$black = imagecolorallocate($img, 0, 0, 0);
+$red = imagecolorallocate($img, 255, 0, 0);
+
+draw_and_check_rectangle( 10, 10, 50, 50);
+draw_and_check_rectangle( 50, 60, 10, 100);
+draw_and_check_rectangle( 50, 150, 10, 110);
+draw_and_check_rectangle( 10, 200, 50, 160);
+imagesetthickness($img, 4);
+draw_and_check_rectangle( 60, 10, 100, 50);
+draw_and_check_rectangle(100, 60, 60, 100);
+draw_and_check_rectangle(100, 150, 60, 110);
+draw_and_check_rectangle( 60, 200, 100, 160);
+
+//imagepng($img, __DIR__ . '/bug53156.png'); // debug
+?>
+--EXPECT--
+Rectangle: ++++
+Rectangle: ++++
+Rectangle: ++++
+Rectangle: ++++
+Rectangle: ++++
+Rectangle: ++++
+Rectangle: ++++
+Rectangle: ++++
diff --git a/ext/gd/tests/bug72494.phpt b/ext/gd/tests/bug72494.phpt
index f21de6ca3b..4cca9aec8e 100644
--- a/ext/gd/tests/bug72494.phpt
+++ b/ext/gd/tests/bug72494.phpt
@@ -1,15 +1,15 @@
---TEST--
-Bug #72494 (imagecropauto out-of-bounds access)
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-$im = imagecreate(10,10);
-imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337);
-?>
-===DONE===
---EXPECTF--
-Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d
-===DONE===
+--TEST--
+Bug #72494 (imagecropauto out-of-bounds access)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+$im = imagecreate(10,10);
+imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337);
+?>
+===DONE===
+--EXPECTF--
+Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d
+===DONE===
diff --git a/ext/gd/tests/bug73272.phpt b/ext/gd/tests/bug73272.phpt
index 3bb710cdc7..ccee8d6e67 100644
--- a/ext/gd/tests/bug73272.phpt
+++ b/ext/gd/tests/bug73272.phpt
@@ -1,24 +1,24 @@
---TEST--
-Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation())
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
-
-$src = imagecreatetruecolor(100, 100);
-imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF);
-imageellipse($src, 49,49, 40,40, 0x000000);
-
-imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR);
-imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
-$dst = imagerotate($src, 60, 0xFFFFFF);
-
-test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst);
-?>
-===DONE===
---EXPECT--
-The images are equal.
-===DONE===
+--TEST--
+Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation())
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
+
+$src = imagecreatetruecolor(100, 100);
+imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF);
+imageellipse($src, 49,49, 40,40, 0x000000);
+
+imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR);
+imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
+$dst = imagerotate($src, 60, 0xFFFFFF);
+
+test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst);
+?>
+===DONE===
+--EXPECT--
+The images are equal.
+===DONE===
diff --git a/ext/gd/tests/bug73279.phpt b/ext/gd/tests/bug73279.phpt
index e6c6709039..aba91f0d3a 100644
--- a/ext/gd/tests/bug73279.phpt
+++ b/ext/gd/tests/bug73279.phpt
@@ -1,20 +1,20 @@
---TEST--
-Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.4', '<')) {
- die('skip only for bundled libgd or external libgd >= 2.2.4');
-}
-?>
---FILE--
-<?php
-$src = imagecreate(100, 100);
-imagecolorallocate($src, 255, 255, 255);
-$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
-printf("color: %x\n", imagecolorat($dst, 99, 99));
-?>
-===DONE===
---EXPECT--
-color: ffffff
-===DONE===
+--TEST--
+Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.4', '<')) {
+ die('skip only for bundled libgd or external libgd >= 2.2.4');
+}
+?>
+--FILE--
+<?php
+$src = imagecreate(100, 100);
+imagecolorallocate($src, 255, 255, 255);
+$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
+printf("color: %x\n", imagecolorat($dst, 99, 99));
+?>
+===DONE===
+--EXPECT--
+color: ffffff
+===DONE===
diff --git a/ext/gd/tests/bug73279_old.phpt b/ext/gd/tests/bug73279_old.phpt
index 0cbbec34f2..810b15201f 100644
--- a/ext/gd/tests/bug73279_old.phpt
+++ b/ext/gd/tests/bug73279_old.phpt
@@ -1,22 +1,22 @@
---TEST--
-Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-if (GD_BUNDLED || version_compare(GD_VERSION, '2.2.4', '>=')) {
- die('skip only for external libgd < 2.2.4');
-}
-?>
---FILE--
-<?php
-$src = imagecreate(100, 100);
-imagecolorallocate($src, 255, 255, 255);
-$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
-printf("color: %x\n", imagecolorat($dst, 99, 99));
-?>
-===DONE===
---XFAIL--
-Bug #330 has not yet been fixed
---EXPECT--
-color: ffffff
-===DONE===
+--TEST--
+Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+if (GD_BUNDLED || version_compare(GD_VERSION, '2.2.4', '>=')) {
+ die('skip only for external libgd < 2.2.4');
+}
+?>
+--FILE--
+<?php
+$src = imagecreate(100, 100);
+imagecolorallocate($src, 255, 255, 255);
+$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
+printf("color: %x\n", imagecolorat($dst, 99, 99));
+?>
+===DONE===
+--XFAIL--
+Bug #330 has not yet been fixed
+--EXPECT--
+color: ffffff
+===DONE===
diff --git a/ext/gd/tests/bug73968.phpt b/ext/gd/tests/bug73968.phpt
index fd17fe26ba..2211840f58 100644
--- a/ext/gd/tests/bug73968.phpt
+++ b/ext/gd/tests/bug73968.phpt
@@ -1,15 +1,15 @@
---TEST--
-Bug #73968 (Premature failing of XBM reading)
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-$im = imagecreatefromxbm(__DIR__ . DIRECTORY_SEPARATOR . 'bug73968.xbm');
-var_dump($im);
-?>
-===DONE===
---EXPECTF--
-resource(%d) of type (gd)
-===DONE===
+--TEST--
+Bug #73968 (Premature failing of XBM reading)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+$im = imagecreatefromxbm(__DIR__ . DIRECTORY_SEPARATOR . 'bug73968.xbm');
+var_dump($im);
+?>
+===DONE===
+--EXPECTF--
+resource(%d) of type (gd)
+===DONE===
diff --git a/ext/gd/tests/func.inc b/ext/gd/tests/func.inc
index 708fccd3d1..1928ff696a 100644
--- a/ext/gd/tests/func.inc
+++ b/ext/gd/tests/func.inc
@@ -1,148 +1,148 @@
-<?php
-
-function get_gd_version()
-{
- return GD_VERSION;
-}
-
-function get_php_info()
-{
- ob_start();
- phpinfo();
- $info = ob_get_contents();
- ob_end_clean();
-
- return $info;
-}
-
-function get_freetype_version()
-{
- $version = 0;
-
- if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
- $version = $match[1];
- }
-
- return $version;
-}
-
-function get_libjpeg_version()
-{
- $version = 0;
-
- if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) {
- $version = $match[1];
- }
-
- return $version;
-}
-
-function get_libpng_version()
-{
- $version = 0;
-
- if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
- $version = $match[1];
- }
-
- return $version;
-}
-
-function get_libxpm_version()
-{
- $version = 0;
-
- if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) {
- $version = $match[1];
- }
-
- return $version;
-}
-
-/**
- * Tests that an in-memory image equals a PNG file.
- *
- * It checks for equal image sizes, and whether any pixels are different.
- * The textual result is printed, so the EXPECT section should contain the line
- * "The images are equal."
- *
- * If the PNG file does not exists, or the images are not equal, a diagnostic
- * message is printed, and the actual file is stored right beside the temporary
- * .php test file with the extension .out.png, to be able to manually inspect
- * the result.
- *
- * @param string $filename
- * @param resource $actual
- * @return void
- */
-function test_image_equals_file($filename, $actual)
-{
- if (!file_exists($filename)) {
- echo "The expected image does not exist.\n";
- save_actual_image($actual);
- return;
- }
- $actual = test_to_truecolor($actual);
- $expected = imagecreatefrompng($filename);
- $expected = test_to_truecolor($expected);
- $exp_x = imagesx($expected);
- $exp_y = imagesy($expected);
- $act_x = imagesx($actual);
- $act_y = imagesy($actual);
- if ($exp_x != $act_x || $exp_y != $act_y) {
- echo "The image size differs: expected {$exp_x}x{$exp_y}, got {$act_x}x{$act_y}.\n";
- save_actual_image($actual);
- return;
- }
- $pixels_changed = 0;
- for ($y = 0; $y < $exp_y; $y++) {
- for ($x = 0; $x < $exp_x; $x ++) {
- $exp_c = imagecolorat($expected, $x, $y);
- $act_c = imagecolorat($actual, $x, $y);
- if ($exp_c != $act_c) {
- $pixels_changed++;
- }
- }
- }
- if (!$pixels_changed) {
- echo "The images are equal.\n";
- } else {
- echo "The images differ in {$pixels_changed} pixels.\n";
- save_actual_image($actual);
- }
-}
-
-/**
- * Returns the truecolor version of an image.
- *
- * @param resource $image
- * @return resource
- */
-function test_to_truecolor($image)
-{
- if (imageistruecolor($image)) {
- return $image;
- } else {
- $width = imagesx($image);
- $height = imagesy($image);
- $result = imagecreatetruecolor($width, $height);
- imagecopy($result, $image, 0,0, 0,0, $width, $height);
- return $result;
- }
-}
-
-/**
- * Saves an actual image to disk.
- *
- * The image is saved right beside the temporary .php test file with the
- * extension .out.png.
- *
- * @param resource $image
- * @return void
- */
-function save_actual_image($image)
-{
- $pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']);
- $filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png";
- imagepng($image, $filename);
-}
+<?php
+
+function get_gd_version()
+{
+ return GD_VERSION;
+}
+
+function get_php_info()
+{
+ ob_start();
+ phpinfo();
+ $info = ob_get_contents();
+ ob_end_clean();
+
+ return $info;
+}
+
+function get_freetype_version()
+{
+ $version = 0;
+
+ if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
+ $version = $match[1];
+ }
+
+ return $version;
+}
+
+function get_libjpeg_version()
+{
+ $version = 0;
+
+ if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) {
+ $version = $match[1];
+ }
+
+ return $version;
+}
+
+function get_libpng_version()
+{
+ $version = 0;
+
+ if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
+ $version = $match[1];
+ }
+
+ return $version;
+}
+
+function get_libxpm_version()
+{
+ $version = 0;
+
+ if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) {
+ $version = $match[1];
+ }
+
+ return $version;
+}
+
+/**
+ * Tests that an in-memory image equals a PNG file.
+ *
+ * It checks for equal image sizes, and whether any pixels are different.
+ * The textual result is printed, so the EXPECT section should contain the line
+ * "The images are equal."
+ *
+ * If the PNG file does not exists, or the images are not equal, a diagnostic
+ * message is printed, and the actual file is stored right beside the temporary
+ * .php test file with the extension .out.png, to be able to manually inspect
+ * the result.
+ *
+ * @param string $filename
+ * @param resource $actual
+ * @return void
+ */
+function test_image_equals_file($filename, $actual)
+{
+ if (!file_exists($filename)) {
+ echo "The expected image does not exist.\n";
+ save_actual_image($actual);
+ return;
+ }
+ $actual = test_to_truecolor($actual);
+ $expected = imagecreatefrompng($filename);
+ $expected = test_to_truecolor($expected);
+ $exp_x = imagesx($expected);
+ $exp_y = imagesy($expected);
+ $act_x = imagesx($actual);
+ $act_y = imagesy($actual);
+ if ($exp_x != $act_x || $exp_y != $act_y) {
+ echo "The image size differs: expected {$exp_x}x{$exp_y}, got {$act_x}x{$act_y}.\n";
+ save_actual_image($actual);
+ return;
+ }
+ $pixels_changed = 0;
+ for ($y = 0; $y < $exp_y; $y++) {
+ for ($x = 0; $x < $exp_x; $x ++) {
+ $exp_c = imagecolorat($expected, $x, $y);
+ $act_c = imagecolorat($actual, $x, $y);
+ if ($exp_c != $act_c) {
+ $pixels_changed++;
+ }
+ }
+ }
+ if (!$pixels_changed) {
+ echo "The images are equal.\n";
+ } else {
+ echo "The images differ in {$pixels_changed} pixels.\n";
+ save_actual_image($actual);
+ }
+}
+
+/**
+ * Returns the truecolor version of an image.
+ *
+ * @param resource $image
+ * @return resource
+ */
+function test_to_truecolor($image)
+{
+ if (imageistruecolor($image)) {
+ return $image;
+ } else {
+ $width = imagesx($image);
+ $height = imagesy($image);
+ $result = imagecreatetruecolor($width, $height);
+ imagecopy($result, $image, 0,0, 0,0, $width, $height);
+ return $result;
+ }
+}
+
+/**
+ * Saves an actual image to disk.
+ *
+ * The image is saved right beside the temporary .php test file with the
+ * extension .out.png.
+ *
+ * @param resource $image
+ * @return void
+ */
+function save_actual_image($image)
+{
+ $pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']);
+ $filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png";
+ imagepng($image, $filename);
+}
diff --git a/ext/gd/tests/imagecrop_auto-ext.phpt b/ext/gd/tests/imagecrop_auto-ext.phpt
index 60291a69c0..f37b3ca8e2 100644
--- a/ext/gd/tests/imagecrop_auto-ext.phpt
+++ b/ext/gd/tests/imagecrop_auto-ext.phpt
@@ -1,85 +1,85 @@
---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)
+--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 8a0f79d324..07f6b8ae4c 100644
--- a/ext/gd/tests/imagecrop_auto.phpt
+++ b/ext/gd/tests/imagecrop_auto.phpt
@@ -1,85 +1,85 @@
---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 bundled 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(11)
-int(11)
-Palette IMG_CROP_DEFAULT
-int(11)
-int(11)
-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)
+--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 bundled 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(11)
+int(11)
+Palette IMG_CROP_DEFAULT
+int(11)
+int(11)
+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/imageellipse_error8.phpt b/ext/gd/tests/imageellipse_error8.phpt
index 3fefb56bde..d02b97eec3 100644
--- a/ext/gd/tests/imageellipse_error8.phpt
+++ b/ext/gd/tests/imageellipse_error8.phpt
@@ -1,21 +1,21 @@
---TEST--
-Testing wrong param passing imageellipse() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if ( ! extension_loaded("gd") ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-
-// Create a image
-$image = imagecreatetruecolor( 400, 300 );
-
-// try to draw a white ellipse
-imageellipse( $image, 200, 150, 300, 200 );
-
-?>
---EXPECTF--
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if ( ! extension_loaded("gd") ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor( 400, 300 );
+
+// try to draw a white ellipse
+imageellipse( $image, 200, 150, 300, 200 );
+
+?>
+--EXPECTF--
Warning: imageellipse() expects exactly 6 parameters, %d given in %s on line %d
diff --git a/ext/gd/tests/imagefilltoborder_error7.phpt b/ext/gd/tests/imagefilltoborder_error7.phpt
index aeb7d82620..f3313e11f4 100644
--- a/ext/gd/tests/imagefilltoborder_error7.phpt
+++ b/ext/gd/tests/imagefilltoborder_error7.phpt
@@ -1,26 +1,26 @@
---TEST--
-Testing wrong param passing imagefilltoborder() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded("gd")) die("skip GD not present; skipping test");
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
-
-// Draw an ellipse to fill with a black border
-imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
-
-// Try to fill border
-imagefilltoborder( $image, 50, 50 );
-
-?>
---EXPECTF--
+--TEST--
+Testing wrong param passing imagefilltoborder() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded("gd")) die("skip GD not present; skipping test");
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+imagefilltoborder( $image, 50, 50 );
+
+?>
+--EXPECTF--
Warning: imagefilltoborder() expects exactly 5 parameters, %d given in %s on line %d
diff --git a/ext/gd/tests/imageflip.phpt b/ext/gd/tests/imageflip.phpt
index a326e0a2ba..f4660940a2 100644
--- a/ext/gd/tests/imageflip.phpt
+++ b/ext/gd/tests/imageflip.phpt
@@ -1,30 +1,30 @@
---TEST--
-Testing imageflip() of GD library
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') || !function_exists('imageflip')) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-
-$im = imagecreatetruecolor( 99, 99 );
-
-imagesetpixel($im, 0, 0, 0xFF);
-imagesetpixel($im, 0, 98, 0x00FF00);
-imagesetpixel($im, 98, 0, 0xFF0000);
-imagesetpixel($im, 98, 98, 0x0000FF);
-
-imageflip($im, IMG_FLIP_HORIZONTAL);
-imageflip($im, IMG_FLIP_VERTICAL);
-imageflip($im, IMG_FLIP_BOTH);
-
-var_dump(dechex(imagecolorat($im, 0, 0)));
-var_dump(dechex(imagecolorat($im, 0, 98)));
-var_dump(dechex(imagecolorat($im, 98, 0)));
-var_dump(dechex(imagecolorat($im, 98, 98)));
-?>
---EXPECT--
-string(2) "ff"
-string(4) "ff00"
-string(6) "ff0000"
+--TEST--
+Testing imageflip() of GD library
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') || !function_exists('imageflip')) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+
+$im = imagecreatetruecolor( 99, 99 );
+
+imagesetpixel($im, 0, 0, 0xFF);
+imagesetpixel($im, 0, 98, 0x00FF00);
+imagesetpixel($im, 98, 0, 0xFF0000);
+imagesetpixel($im, 98, 98, 0x0000FF);
+
+imageflip($im, IMG_FLIP_HORIZONTAL);
+imageflip($im, IMG_FLIP_VERTICAL);
+imageflip($im, IMG_FLIP_BOTH);
+
+var_dump(dechex(imagecolorat($im, 0, 0)));
+var_dump(dechex(imagecolorat($im, 0, 98)));
+var_dump(dechex(imagecolorat($im, 98, 0)));
+var_dump(dechex(imagecolorat($im, 98, 98)));
+?>
+--EXPECT--
+string(2) "ff"
+string(4) "ff00"
+string(6) "ff0000"
string(2) "ff" \ No newline at end of file
diff --git a/ext/gd/tests/imagerectangle_basic.phpt b/ext/gd/tests/imagerectangle_basic.phpt
index 507d715326..d23cbdfe79 100644
--- a/ext/gd/tests/imagerectangle_basic.phpt
+++ b/ext/gd/tests/imagerectangle_basic.phpt
@@ -1,22 +1,22 @@
---TEST--
-Testing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
-
-include_once __DIR__ . '/func.inc';
-test_image_equals_file(__DIR__ . '/imagerectangle_basic.png', $image);
-?>
---EXPECT--
-The images are equal.
+--TEST--
+Testing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
+
+include_once __DIR__ . '/func.inc';
+test_image_equals_file(__DIR__ . '/imagerectangle_basic.png', $image);
+?>
+--EXPECT--
+The images are equal.
diff --git a/ext/gd/tests/imagerectangle_error1.phpt b/ext/gd/tests/imagerectangle_error1.phpt
index 2b4235e854..3b9e8d3f0c 100644
--- a/ext/gd/tests/imagerectangle_error1.phpt
+++ b/ext/gd/tests/imagerectangle_error1.phpt
@@ -1,19 +1,19 @@
---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
-?>
---EXPECTF--
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
Warning: imagerectangle() expects parameter 1 to be resource, %s given in %s on line %d
diff --git a/ext/gd/tests/imagerectangle_error2.phpt b/ext/gd/tests/imagerectangle_error2.phpt
index 5fc1914ad0..63525d2cb7 100644
--- a/ext/gd/tests/imagerectangle_error2.phpt
+++ b/ext/gd/tests/imagerectangle_error2.phpt
@@ -1,19 +1,19 @@
---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a resource
-$image = tmpfile();
-
-// Draw a rectangle
-imagerectangle( $image, 0, 0, 50, 50, 2 );
-?>
---EXPECTF--
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a resource
+$image = tmpfile();
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50, 2 );
+?>
+--EXPECTF--
Warning: imagerectangle(): supplied resource is not a valid Image resource in %s on line %d \ No newline at end of file
diff --git a/ext/gd/tests/imagerectangle_error3.phpt b/ext/gd/tests/imagerectangle_error3.phpt
index eceab1e99b..350ee1bf82 100644
--- a/ext/gd/tests/imagerectangle_error3.phpt
+++ b/ext/gd/tests/imagerectangle_error3.phpt
@@ -1,19 +1,19 @@
---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
-?>
---EXPECTF--
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
Warning: imagerectangle() expects parameter 2 to be integer, %s given in %s on line %d
diff --git a/ext/gd/tests/imagerectangle_error4.phpt b/ext/gd/tests/imagerectangle_error4.phpt
index 5d8e1cecac..4c448dc027 100644
--- a/ext/gd/tests/imagerectangle_error4.phpt
+++ b/ext/gd/tests/imagerectangle_error4.phpt
@@ -1,19 +1,19 @@
---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) );
-?>
---EXPECTF--
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
Warning: imagerectangle() expects parameter 3 to be integer, %s given in %s on line %d
diff --git a/ext/gd/tests/imagerectangle_error5.phpt b/ext/gd/tests/imagerectangle_error5.phpt
index df9c457d6f..fa9486e3de 100644
--- a/ext/gd/tests/imagerectangle_error5.phpt
+++ b/ext/gd/tests/imagerectangle_error5.phpt
@@ -1,19 +1,19 @@
---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) );
-?>
---EXPECTF--
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
Warning: imagerectangle() expects parameter 4 to be integer, %s given in %s on line %d
diff --git a/ext/gd/tests/imagerectangle_error6.phpt b/ext/gd/tests/imagerectangle_error6.phpt
index a91c6bbc0c..1523a9ec57 100644
--- a/ext/gd/tests/imagerectangle_error6.phpt
+++ b/ext/gd/tests/imagerectangle_error6.phpt
@@ -1,19 +1,19 @@
---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) );
-?>
---EXPECTF--
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
Warning: imagerectangle() expects parameter 5 to be integer, %s given in %s on line %d
diff --git a/ext/gd/tests/imagerectangle_error7.phpt b/ext/gd/tests/imagerectangle_error7.phpt
index f819da6e6c..ee6326feff 100644
--- a/ext/gd/tests/imagerectangle_error7.phpt
+++ b/ext/gd/tests/imagerectangle_error7.phpt
@@ -1,19 +1,19 @@
---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( $image, 0, 0, 50, 50, 'wrong param' );
-?>
---EXPECTF--
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50, 'wrong param' );
+?>
+--EXPECTF--
Warning: imagerectangle() expects parameter 6 to be integer, %s given in %s on line %d
diff --git a/ext/gd/tests/imagerectangle_error8.phpt b/ext/gd/tests/imagerectangle_error8.phpt
index 361de69cde..cb0746e492 100644
--- a/ext/gd/tests/imagerectangle_error8.phpt
+++ b/ext/gd/tests/imagerectangle_error8.phpt
@@ -1,19 +1,19 @@
---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( $image, 0, 0, 50, 50 );
-?>
---EXPECTF--
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50 );
+?>
+--EXPECTF--
Warning: imagerectangle() expects exactly 6 parameters, %d given in %s on line %d
diff --git a/ext/gd/tests/test_image_equals_file_palette.phpt b/ext/gd/tests/test_image_equals_file_palette.phpt
index 130fa43202..0cfea7f415 100644
--- a/ext/gd/tests/test_image_equals_file_palette.phpt
+++ b/ext/gd/tests/test_image_equals_file_palette.phpt
@@ -1,42 +1,42 @@
---TEST--
-test_image_equals_file(): comparing palette images
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
-
-$im = imagecreate(10, 10);
-imagecolorallocate($im, 255, 255, 255);
-$red = imagecolorallocate($im, 255, 0, 0);
-imagefilledrectangle($im, 3,3, 7,7, $red);
-
-$filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png';
-imagepng($im, $filename);
-
-$im = imagecreate(10, 10);
-imagecolorallocate($im, 255, 255, 255);
-$blue = imagecolorallocate($im, 0, 0, 255);
-imagefilledrectangle($im, 3,3, 7,7, $blue);
-
-test_image_equals_file($filename, $im);
-
-$im = imagecreate(10, 10);
-imagecolorallocate($im, 255, 255, 255);
-imagecolorallocate($im, 0, 0, 0);
-$red = imagecolorallocate($im, 255, 0, 0);
-imagefilledrectangle($im, 3,3, 7,7, $red);
-
-test_image_equals_file($filename, $im);
-?>
-===DONE===
---EXPECT--
-The images differ in 25 pixels.
-The images are equal.
-===DONE===
---CLEAN--
-<?php
-unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png');
-?>
+--TEST--
+test_image_equals_file(): comparing palette images
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
+
+$im = imagecreate(10, 10);
+imagecolorallocate($im, 255, 255, 255);
+$red = imagecolorallocate($im, 255, 0, 0);
+imagefilledrectangle($im, 3,3, 7,7, $red);
+
+$filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png';
+imagepng($im, $filename);
+
+$im = imagecreate(10, 10);
+imagecolorallocate($im, 255, 255, 255);
+$blue = imagecolorallocate($im, 0, 0, 255);
+imagefilledrectangle($im, 3,3, 7,7, $blue);
+
+test_image_equals_file($filename, $im);
+
+$im = imagecreate(10, 10);
+imagecolorallocate($im, 255, 255, 255);
+imagecolorallocate($im, 0, 0, 0);
+$red = imagecolorallocate($im, 255, 0, 0);
+imagefilledrectangle($im, 3,3, 7,7, $red);
+
+test_image_equals_file($filename, $im);
+?>
+===DONE===
+--EXPECT--
+The images differ in 25 pixels.
+The images are equal.
+===DONE===
+--CLEAN--
+<?php
+unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png');
+?>
diff --git a/ext/gd/tests/webp_basic.phpt b/ext/gd/tests/webp_basic.phpt
index 55436741db..593e43c807 100644
--- a/ext/gd/tests/webp_basic.phpt
+++ b/ext/gd/tests/webp_basic.phpt
@@ -1,38 +1,38 @@
---TEST--
-imagewebp() and imagecreatefromwebp() - basic test
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
- die("skip test requires GD 2.2.0 or higher");
-}
-if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))
- die('skip WebP support not available');
-?>
---FILE--
-<?php
-require_once __DIR__ . '/similarity.inc';
-
-$filename = __DIR__ . '/webp_basic.webp';
-
-$im1 = imagecreatetruecolor(75, 75);
-$white = imagecolorallocate($im1, 255, 255, 255);
-$red = imagecolorallocate($im1, 255, 0, 0);
-$green = imagecolorallocate($im1, 0, 255, 0);
-$blue = imagecolorallocate($im1, 0, 0, 255);
-imagefilledrectangle($im1, 0, 0, 74, 74, $white);
-imageline($im1, 3, 3, 71, 71, $red);
-imageellipse($im1, 18, 54, 36, 36, $green);
-imagerectangle($im1, 41, 3, 71, 33, $blue);
-imagewebp($im1, $filename);
-
-$im2 = imagecreatefromwebp($filename);
-imagewebp($im2, $filename);
-var_dump(calc_image_dissimilarity($im1, $im2) < 10e5);
-?>
---CLEAN--
-<?php
-@unlink(__DIR__ . '/webp_basic.webp');
-?>
---EXPECT--
-bool(true)
+--TEST--
+imagewebp() and imagecreatefromwebp() - basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
+ die("skip test requires GD 2.2.0 or higher");
+}
+if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))
+ die('skip WebP support not available');
+?>
+--FILE--
+<?php
+require_once __DIR__ . '/similarity.inc';
+
+$filename = __DIR__ . '/webp_basic.webp';
+
+$im1 = imagecreatetruecolor(75, 75);
+$white = imagecolorallocate($im1, 255, 255, 255);
+$red = imagecolorallocate($im1, 255, 0, 0);
+$green = imagecolorallocate($im1, 0, 255, 0);
+$blue = imagecolorallocate($im1, 0, 0, 255);
+imagefilledrectangle($im1, 0, 0, 74, 74, $white);
+imageline($im1, 3, 3, 71, 71, $red);
+imageellipse($im1, 18, 54, 36, 36, $green);
+imagerectangle($im1, 41, 3, 71, 33, $blue);
+imagewebp($im1, $filename);
+
+$im2 = imagecreatefromwebp($filename);
+imagewebp($im2, $filename);
+var_dump(calc_image_dissimilarity($im1, $im2) < 10e5);
+?>
+--CLEAN--
+<?php
+@unlink(__DIR__ . '/webp_basic.webp');
+?>
+--EXPECT--
+bool(true)