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