summaryrefslogtreecommitdiff
path: root/tests/gdimagefill/bug00002_2.c
blob: 4edcd6aca7c88ab0759ea72e530b1a4679b1984b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "gd.h"
#include <stdio.h>
#include "gdtest.h"

int main()
{
	gdImagePtr im, tile;
	int im_black, tile_black;
	int x,y, error = 0;

/*	fputs("flag 0\n", stdout); */
	im = gdImageCreate(150, 150);
	tile = gdImageCreate(36, 36);
	gdImageColorAllocate(tile,255,255,255); /* allocate white for background color */
	tile_black = gdImageColorAllocate(tile,0,0,0);
	gdImageColorAllocate(im,255,255,255); /* allocate white for background color */
	im_black = gdImageColorAllocate(im,0,0,0);


	/* create the dots pattern */
	for (x=0; x<36; x+=2) {
		for (y=0; y<36; y+=2) {
			gdImageSetPixel(tile,x,y,tile_black);
		}
	}

	gdImageSetTile(im,tile);
	gdImageRectangle(im, 9,9,139,139, im_black);
	gdImageLine(im, 9,9,139,139, im_black);
	gdImageFill(im, 11,12, gdTiled);


/*	fputs("flag 1\n", stdout); */
	gdImageFill(im, 0, 0, 0xffffff);
/*	fputs("flag 2\n", stdout); */
	gdImageFill(im, 0, 0, 0xffffff);
/*	fputs("flag 2\n", stdout); */


	if (!gdAssertImageEqualsToFile("gdimagefill/bug00002_2_exp.png", im)) {
		error = 1;
	}

	/* Destroy it */
	gdImageDestroy(im);
	gdImageDestroy(tile);
	return error;
}