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