xref: /PHP-8.4/ext/gd/tests/bug24594.phpt (revision a375d547)
1--TEST--
2Bug #24594 (Filling an area using tiles).
3--EXTENSIONS--
4gd
5--FILE--
6<?php
7    $tile = imagecreate(36,36);
8    $base = imagecreate(150,150);
9    $white = imagecolorallocate($tile,255,255,255);
10    $black = imagecolorallocate($tile,0,0,0);
11    $white = imagecolorallocate($base,255,255,255);
12    $black = imagecolorallocate($base,0,0,0);
13
14    /* create the dots pattern */
15    for ($x=0;$x<36;$x+=2) {
16        for ($y=0;$y<36;$y+=2) {
17            imagesetpixel($tile,$x,$y,$black);
18        }
19    }
20
21    imagesettile($base,$tile);
22    imagerectangle($base, 9,9,139,139,$black);
23    imageline($base, 9,9,139,139,$black);
24    imagefill($base,11,12,IMG_COLOR_TILED);
25
26    $res = imagecolorat($base,0,10)==$black?'1':'0';
27    $res .= imagecolorat($base,0,20)==$black?'1':'0';
28    $res .= imagecolorat($base,0,30)==$black?'1':'0';
29    $res .= imagecolorat($base,0,40)==$black?'1':'0';
30    $res .= imagecolorat($base,0,50)==$black?'1':'0';
31    $res .= imagecolorat($base,0,60)==$black?'1':'0';
32
33    $res .= imagecolorat($base,11,12)==$white?'1':'0';
34    $res .= imagecolorat($base,12,13)==$white?'1':'0';
35    $res .= imagecolorat($base,13,14)==$white?'1':'0';
36    $res .= imagecolorat($base,14,15)==$white?'1':'0';
37    $res .= imagecolorat($base,15,16)==$white?'1':'0';
38    $res .= imagecolorat($base,16,17)==$white?'1':'0';
39
40    $res .= imagecolorat($base,10,12)==$black?'1':'0';
41    $res .= imagecolorat($base,11,13)==$black?'1':'0';
42    $res .= imagecolorat($base,12,14)==$black?'1':'0';
43    $res .= imagecolorat($base,13,15)==$black?'1':'0';
44    $res .= imagecolorat($base,14,16)==$black?'1':'0';
45    $res .= imagecolorat($base,15,17)==$black?'1':'0';
46    echo "$res\n";
47
48    imagefilledrectangle($base,0,0,149,149,$white);
49    imagerectangle($base, 9,9,139,139,$black);
50    imageline($base, 9,9,139,139,$black);
51    imagefill($base,0,0,IMG_COLOR_TILED);
52
53    $res = imagecolorat($base,0,10)==$black?'1':'0';
54    $res .= imagecolorat($base,0,20)==$black?'1':'0';
55    $res .= imagecolorat($base,0,30)==$black?'1':'0';
56    $res .= imagecolorat($base,0,40)==$black?'1':'0';
57    $res .= imagecolorat($base,0,50)==$black?'1':'0';
58    $res .= imagecolorat($base,0,60)==$black?'1':'0';
59
60    $res .= imagecolorat($base,11,12)==$white?'1':'0';
61    $res .= imagecolorat($base,12,13)==$white?'1':'0';
62    $res .= imagecolorat($base,13,14)==$white?'1':'0';
63    $res .= imagecolorat($base,14,15)==$white?'1':'0';
64    $res .= imagecolorat($base,15,16)==$white?'1':'0';
65    $res .= imagecolorat($base,16,17)==$white?'1':'0';
66
67    $res .= imagecolorat($base,0,16)==$black?'1':'0';
68    $res .= imagecolorat($base,2,42)==$black?'1':'0';
69    $res .= imagecolorat($base,4,44)==$black?'1':'0';
70    $res .= imagecolorat($base,146,146)==$black?'1':'0';
71    $res .= imagecolorat($base,148,146)==$black?'1':'0';
72    $res .= imagecolorat($base,0,0)==$black?'1':'0';
73
74    echo "$res\n";
75?>
76--EXPECT--
77000000111111101010
78111111111111111111
79