File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / gd / tests / colorat.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:56 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
imagecolorat
--SKIPIF--
<?php
        if (!function_exists('imagecolorat')) die("skip gd extension not available\n");
?>
--FILE--
<?php
$file = dirname(__FILE__) . '/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";
imagedestroy($im);

$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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>