1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/gd/tests/colorat.phpt

40 lines
739 B
PHP

--TEST--
imagecolorat
--EXTENSIONS--
gd
--FILE--
<?php
$file = __DIR__ . '/im.wbmp';
$im = imagecreatetruecolor(6,6);
imagefill($im, 0,0, 0xffffff);
imagesetpixel($im, 3,3, 0x0);
echo 'test colorat truecolor: ';
$c = imagecolorat($im, 3,3);
echo $c == 0x0 ? 'ok' : 'failed';
echo "\n";
$im = imagecreate(6,6);
$c1 = imagecolorallocate($im, 255,255,255);
$c2 = imagecolorallocate($im, 0,0,0);
imagefill($im, 0,0, $c1);
imagesetpixel($im, 3,3, $c2);
echo 'test colorat palette: ';
$c = imagecolorsforindex($im, imagecolorat($im, 3,3));
$failed = false;
foreach ($c as $v) {
if ($v != 0) {
$failed = true;
}
}
echo !$failed ? 'ok' : 'failed';
echo "\n";
?>
--EXPECT--
test colorat truecolor: ok
test colorat palette: ok