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