From: Pierre Joye Date: Mon, 17 Jul 2006 12:54:09 +0000 (+0000) Subject: - sync tests with HEAD X-Git-Tag: php-5.2.0RC1~80 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cb41a19f2827774487964b5888b7a31641b08030;p=php - sync tests with HEAD --- diff --git a/ext/gd/tests/colorat.phpt b/ext/gd/tests/colorat.phpt new file mode 100644 index 0000000000..be14873886 --- /dev/null +++ b/ext/gd/tests/colorat.phpt @@ -0,0 +1,42 @@ +--TEST-- +imagecolorat +--SKIPIF-- + +--FILE-- + +--EXPECT-- +test colorat truecolor: ok +test colorat palette: ok diff --git a/ext/gd/tests/colorclosest.phpt b/ext/gd/tests/colorclosest.phpt new file mode 100644 index 0000000000..7ade09478e --- /dev/null +++ b/ext/gd/tests/colorclosest.phpt @@ -0,0 +1,127 @@ +--TEST-- +imageclosest +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +FF00FF + +Warning: imagecolorsforindex(): Color index -1 out of range in %s on line %d +Array +( + [red] => 255 + [green] => 0 + [blue] => 255 + [alpha] => 0 +) +Array +( + [red] => 254 + [green] => 0 + [blue] => 0 + [alpha] => 0 +) +Array +( + [red] => 246 + [green] => 10 + [blue] => 10 + [alpha] => 0 +) +64FF00FF + +Warning: imagecolorsforindex(): Color index -1 out of range in %s on line %d +Array +( + [red] => 255 + [green] => 0 + [blue] => 255 + [alpha] => 1 +) +Array +( + [red] => 254 + [green] => 0 + [blue] => 0 + [alpha] => 1 +) +Array +( + [red] => 246 + [green] => 10 + [blue] => 10 + [alpha] => 1 +) diff --git a/ext/gd/tests/colorexact.phpt b/ext/gd/tests/colorexact.phpt new file mode 100644 index 0000000000..e6983b7516 --- /dev/null +++ b/ext/gd/tests/colorexact.phpt @@ -0,0 +1,40 @@ +--TEST-- +imagecolorexact +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +FF00FF +64FF00FF +0 +1 +2 +-1 diff --git a/ext/gd/tests/colorresolve.phpt b/ext/gd/tests/colorresolve.phpt new file mode 100644 index 0000000000..9af0f18600 --- /dev/null +++ b/ext/gd/tests/colorresolve.phpt @@ -0,0 +1,113 @@ +--TEST-- +imagecolorresolve +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +FF00FF +Array +( + [red] => 255 + [green] => 0 + [blue] => 255 + [alpha] => 0 +) +Array +( + [red] => 255 + [green] => 0 + [blue] => 0 + [alpha] => 0 +) +Array +( + [red] => 246 + [green] => 10 + [blue] => 10 + [alpha] => 0 +) +64FF00FF +Array +( + [red] => 255 + [green] => 0 + [blue] => 255 + [alpha] => 100 +) +Array +( + [red] => 255 + [green] => 0 + [blue] => 0 + [alpha] => 1 +) +Array +( + [red] => 246 + [green] => 10 + [blue] => 10 + [alpha] => 1 +) diff --git a/ext/gd/tests/copy.phpt b/ext/gd/tests/copy.phpt new file mode 100644 index 0000000000..5aafc31e76 --- /dev/null +++ b/ext/gd/tests/copy.phpt @@ -0,0 +1,109 @@ +--TEST-- +imagecopy +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +TC/TC: ok +TC/P: ok +P/P: ok +P/TC: ok diff --git a/ext/gd/tests/copyresized.phpt b/ext/gd/tests/copyresized.phpt new file mode 100644 index 0000000000..fe98642dbb --- /dev/null +++ b/ext/gd/tests/copyresized.phpt @@ -0,0 +1,91 @@ +--TEST-- +imagecopyresized +--SKIPIF-- + +--FILE-- +TC: ok\n"; + +$src_tc = imagecreate(19,19); +$white = imagecolorallocate($src_tc, 255,255,255); +$red = imagecolorallocate($src_tc, 255,0,0); + +imagefilledrectangle($src_tc, 0,0,4,4, $red); +imagefilledrectangle($src_tc, 14,0,18,4, $red); +imagefilledrectangle($src_tc, 0,14,4,18, $red); +imagefilledrectangle($src_tc, 14,14,18,18, $red); +imagefilledrectangle($src_tc, 7,7,11,11, $red); + +$dst_tc = imagecreatetruecolor(38,38); +imagecopyresized($dst_tc, $src_tc, 0,0, 0,0, imagesx($dst_tc), imagesy($dst_tc), 19,19); + +if (!check_doublesize($dst_tc)) exit("2 failed\n"); +echo "P->TC: ok\n"; + +$src_tc = imagecreate(19,19); +$white = imagecolorallocate($src_tc, 255,255,255); +$red = imagecolorallocate($src_tc, 255,0,0); + +imagefilledrectangle($src_tc, 0,0,4,4, $red); +imagefilledrectangle($src_tc, 14,0,18,4, $red); +imagefilledrectangle($src_tc, 0,14,4,18, $red); +imagefilledrectangle($src_tc, 14,14,18,18, $red); +imagefilledrectangle($src_tc, 7,7,11,11, $red); + +$dst_tc = imagecreate(38,38); +$white = imagecolorallocate($src_tc, 255,255,255); +$red = imagecolorallocate($src_tc, 255,0,0); + +imagecopyresized($dst_tc, $src_tc, 0,0, 0,0, imagesx($dst_tc), imagesy($dst_tc), 19,19); + +if (!check_doublesize($dst_tc)) exit("3 failed\n"); +echo "P->P: ok\n"; +?> +--EXPECTF-- +TC->TC: ok +P->TC: ok +P->P: ok diff --git a/ext/gd/tests/createfromgd2.phpt b/ext/gd/tests/createfromgd2.phpt new file mode 100644 index 0000000000..98b078ea59 --- /dev/null +++ b/ext/gd/tests/createfromgd2.phpt @@ -0,0 +1,24 @@ +--TEST-- +imagecreatefromgd2 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +test create from gd2: ok +test create from gd2 part: ok diff --git a/ext/gd/tests/createfromwbmp.phpt b/ext/gd/tests/createfromwbmp.phpt new file mode 100644 index 0000000000..5e48f235e0 --- /dev/null +++ b/ext/gd/tests/createfromwbmp.phpt @@ -0,0 +1,18 @@ +--TEST-- +imagecreatefromwbmp +--SKIPIF-- + +--FILE-- + +--EXPECT-- +test create from wbmp: ok diff --git a/ext/gd/tests/dashedlines.phpt b/ext/gd/tests/dashedlines.phpt new file mode 100644 index 0000000000..30db8f1c71 --- /dev/null +++ b/ext/gd/tests/dashedlines.phpt @@ -0,0 +1,79 @@ +--TEST-- +imageline, dashed +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Horizontal: ok +Vertical: ok +Diagonal: ok diff --git a/ext/gd/tests/gif.phpt b/ext/gd/tests/gif.phpt new file mode 100644 index 0000000000..e798d87728 --- /dev/null +++ b/ext/gd/tests/gif.phpt @@ -0,0 +1,145 @@ +--TEST-- +gif in/out +--SKIPIF-- + +--FILE-- +0) { + $r_min = $r - $error; $r_max = $r + $error; + $g_min = $g - $error; $g_max = $g + $error; + $b_min = $b - $error; $b_max = $b + $error; + + if ( + ($c['red'] >= $r_min || $c['red'] <= $r_max) + && + ($c['green'] >= $g_min || $c['green'] <= $g_max) + && + ($c['blue'] >= $b_min || $c['blue'] <= $b_max) + ) { + return true; + } else { + return false; + } + } else { + if ($c['red']==$r && $c['green']==$g && $c['blue']==$b) { + return true; + } else { + return false; + } + } +} +$cwd = dirname(__FILE__); + +$im = imagecreate(10,10); +$c = imagecolorallocate($im, 255,255,255); +imagefilledrectangle($im, 5,5, 10,10, $c); +imagegif($im, $cwd . '/test_gif.gif'); +if (check_box(255,255,255)) { + echo "<4 cols: ok\n"; +} + +$im = imagecreate(10,10); +for ($i=0; $i<7; $i++) { + $c = imagecolorallocate($im, $i,$i,$i); +} +imagefilledrectangle($im, 5,5, 10,10, $c); +imagegif($im, $cwd . '/test_gif.gif'); +$i--; +if (check_box($i,$i,$i)) { + echo "<8 cols: ok\n"; +} + + +$im = imagecreate(10,10); +for ($i=0; $i<15; $i++) { + $c = imagecolorallocate($im, $i,$i,$i); +} +imagefilledrectangle($im, 5,5, 10,10, $c); +imagegif($im, $cwd . '/test_gif.gif'); +$i--; +if (check_box($i,$i,$i)) { + echo "<16 cols: ok\n"; +} + + +$im = imagecreate(10,10); +for ($i=0; $i<31; $i++) { + $c = imagecolorallocate($im, $i,$i,$i); +} +imagefilledrectangle($im, 5,5, 10,10, $c); +imagegif($im, $cwd . '/test_gif.gif'); +$i--; +if (check_box($i,$i,$i)) { + echo "<32 cols: ok\n"; +} + + +$im = imagecreate(10,10); +for ($i=0; $i<63; $i++) { + $c = imagecolorallocate($im, $i,$i,$i); +} +imagefilledrectangle($im, 5,5, 10,10, $c); +imagegif($im, $cwd . '/test_gif.gif'); +$i--; +if (check_box($i,$i,$i)) { + echo "<64 cols: ok\n"; +} + +$im = imagecreate(10,10); +for ($i=0; $i<127; $i++) { + $c = imagecolorallocate($im, $i,$i,$i); +} +imagefilledrectangle($im, 5,5, 10,10, $c); +imagegif($im, $cwd . '/test_gif.gif'); +$i--; +if (check_box($i,$i,$i)) { + echo "<128 cols: ok\n"; +} + +$im = imagecreate(10,10); +for ($i=0; $i<255; $i++) { + $c = imagecolorallocate($im, $i,$i,$i); +} +imagefilledrectangle($im, 5,5, 10,10, $c); +imagegif($im, $cwd . '/test_gif.gif'); +$i--; +if (check_box($i,$i,$i)) { + echo "<256 cols: ok\n"; +} + + +$im = imagecreatefromjpeg($cwd . '/conv_test.jpeg'); +imagefilledrectangle($im, 5,5, 10,10, 0xffffff); +imagegif($im, $cwd . '/test_gif.gif'); +imagegif($im, $cwd . '/test_gif_2.gif'); + +if (check_box(255,255,255, 10)) { + echo ">256 cols: ok\n"; +} + +@unlink($cwd . "/test_gif.gif"); +?> +--EXPECT-- +<4 cols: ok +<8 cols: ok +<16 cols: ok +<32 cols: ok +<64 cols: ok +<128 cols: ok +<256 cols: ok +>256 cols: ok diff --git a/ext/gd/tests/imagewbmp.phpt b/ext/gd/tests/imagewbmp.phpt new file mode 100644 index 0000000000..cea464e759 --- /dev/null +++ b/ext/gd/tests/imagewbmp.phpt @@ -0,0 +1,31 @@ +--TEST-- +imagewbmp +--SKIPIF-- + +--FILE-- + +--EXPECT-- +test create wbmp: ok diff --git a/ext/gd/tests/lines.phpt b/ext/gd/tests/lines.phpt new file mode 100644 index 0000000000..8f64e12aee --- /dev/null +++ b/ext/gd/tests/lines.phpt @@ -0,0 +1,116 @@ +--TEST-- +imageline no AA +--SKIPIF-- + +--FILE-- + +--EXPECTF-- + +Warning: Wrong parameter count for imageline() in %s on line %d +Horizontal: ok +Vertical: ok +Diagonal: ok +Outside 1: ok +Outside 2: ok diff --git a/ext/gd/tests/src.gd2 b/ext/gd/tests/src.gd2 new file mode 100644 index 0000000000..1c64b46d9a Binary files /dev/null and b/ext/gd/tests/src.gd2 differ diff --git a/ext/gd/tests/src.wbmp b/ext/gd/tests/src.wbmp new file mode 100644 index 0000000000..d38c74268a Binary files /dev/null and b/ext/gd/tests/src.wbmp differ diff --git a/ext/gd/tests/test_gif_2.gif b/ext/gd/tests/test_gif_2.gif new file mode 100644 index 0000000000..332ec8b41f Binary files /dev/null and b/ext/gd/tests/test_gif_2.gif differ diff --git a/ext/gd/tests/truecolor.phpt b/ext/gd/tests/truecolor.phpt new file mode 100644 index 0000000000..9e30cbe29c --- /dev/null +++ b/ext/gd/tests/truecolor.phpt @@ -0,0 +1,19 @@ +--TEST-- +imageistruecolor, truecolortopalette +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +ok +ok +ok diff --git a/ext/gd/tests/types.phpt b/ext/gd/tests/types.phpt new file mode 100644 index 0000000000..0b79e78d1b --- /dev/null +++ b/ext/gd/tests/types.phpt @@ -0,0 +1,33 @@ +--TEST-- +imagetypes +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +ok