diff options
Diffstat (limited to 'ext/gd/tests')
-rw-r--r-- | ext/gd/tests/bug47946.phpt | 102 | ||||
-rw-r--r-- | ext/gd/tests/bug52070.phpt | 50 | ||||
-rw-r--r-- | ext/gd/tests/bug73968.phpt | 30 |
3 files changed, 91 insertions, 91 deletions
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/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=== |