xref: /PHP-8.4/ext/gd/tests/libgd00186.phpt (revision a375d547)
1--TEST--
2libgd #186 (Tiling true colour with palette image does not work)
3--EXTENSIONS--
4gd
5--FILE--
6<?php
7$im = imagecreatetruecolor(10,10);
8$tile = imagecreate(10,10);
9$red   = imagecolorallocate($tile,0xff,0,0);
10$green = imagecolorallocate($tile,0,0xff,0);
11$blue  = imagecolorallocate($tile,0,0,0xff);
12$other = imagecolorallocate($tile,0,0,0x2);
13imagefilledrectangle($tile,0,0,2,10,$red);
14imagefilledrectangle($tile,3,0,4,10,$green);
15imagefilledrectangle($tile,5,0,7,10,$blue);
16imagefilledrectangle($tile,8,0,9,10,$other);
17imagecolortransparent($tile,$blue);
18imagesettile($im,$tile);
19for ($i=0; $i<10; $i++) {
20  imagesetpixel($im,$i,$i,IMG_COLOR_TILED);
21}
22$index = imagecolorat($im,9,9);
23$arr = imagecolorsforindex($im, $index);
24if ($arr['blue'] == 2) {
25  $r = "Ok";
26} else {
27  $r = "Failed";
28}
29imagedestroy($tile);
30imagedestroy($im);
31echo $r;
32?>
33--EXPECT--
34Ok
35