Annotation of embedaddon/php/ext/gd/tests/colorat.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: imagecolorat
3: --SKIPIF--
4: <?php
5: if (!function_exists('imagecolorat')) die("skip gd extension not available\n");
6: ?>
7: --FILE--
8: <?php
9: $file = dirname(__FILE__) . '/im.wbmp';
10:
11: $im = imagecreatetruecolor(6,6);
12: imagefill($im, 0,0, 0xffffff);
13: imagesetpixel($im, 3,3, 0x0);
14:
15:
16: echo 'test colorat truecolor: ';
17: $c = imagecolorat($im, 3,3);
18: echo $c == 0x0 ? 'ok' : 'failed';
19: echo "\n";
20: imagedestroy($im);
21:
22: $im = imagecreate(6,6);
23: $c1 = imagecolorallocate($im, 255,255,255);
24: $c2 = imagecolorallocate($im, 0,0,0);
25:
26: imagefill($im, 0,0, $c1);
27: imagesetpixel($im, 3,3, $c2);
28: echo 'test colorat palette: ';
29:
30: $c = imagecolorsforindex($im, imagecolorat($im, 3,3));
31: $failed = false;
32: foreach ($c as $v) {
33: if ($v != 0) {
34: $failed = true;
35: }
36: }
37: echo !$failed ? 'ok' : 'failed';
38: echo "\n";
39: ?>
40: --EXPECT--
41: test colorat truecolor: ok
42: test colorat palette: ok
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>