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