summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-src/tests/gdimagefill/bug00002_1.c
blob: 2a440f20ede08c144158681badb8ed4512ad8cd1 (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"

#define TMP_FN "bug00002_1.png"

int main()
{
	gdImagePtr im;
	FILE *fp;
	char path[1024];

	im = gdImageCreateTrueColor(100, 100);

	if (im == NULL) {
		gdTestErrorMsg("Cannot create image.\n");
		return 1;
	}

	gdImageFill(im, 0, 0, 0xffffff);
	gdImageFill(im, 0, 0, 0xffffff);

	fp = fopen(TMP_FN, "wb");
	if (fp == NULL) {
		gdTestErrorMsg("Cannot create image from <%s>\n", TMP_FN);
		gdImageDestroy(im);
		return 1;
	}

	gdImagePng(im,fp);
	fclose(fp);

	sprintf(path, "%s/gdimagefill/bug00002_1_exp.png", GDTEST_TOP_DIR);
	if (!gdAssertImageEqualsToFile(path, im)) {
		gdImageDestroy(im);
		return 1;
	}

	gdImageDestroy(im);

	if (remove(TMP_FN) == -1) {
		gdTestErrorMsg("Cannot remove temporary file: <%s>\n", TMP_FN);
		return 1;
	}

	return 0;
}