summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-2.1.1/tests/png/bug00088.c
blob: 78495aa4410495bf5e16a1a81a8ce7cad206ce26 (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
/* $Id$ */
#include "gd.h"
#include <stdio.h>
#include <stdlib.h>
#include "gdtest.h"

int main()
{
	int error;
	gdImagePtr im;
	FILE *fp;
	char path[1024];
	const char * files[2] = {"bug00088_1.png", "bug00088_2.png"};
	const char * files_exp[2] = {"bug00088_1_exp.png", "bug00088_2_exp.png"};

	int i, cnt = 2;
	error = 0;

	for (i = 0; i < cnt; i++) {

		sprintf(path, "%s/png/%s", GDTEST_TOP_DIR, files[i]);
		fp = fopen(path, "rb");
		if (!fp) {
			printf("failed, cannot open file <%s>\n", path);
			return 1;
		}

		im = gdImageCreateFromPng(fp);
		fclose(fp);

		if (!im) {
			error |= 1;
			continue;
		}

		sprintf(path, "%s/png/%s", GDTEST_TOP_DIR, files_exp[i]);
		if (!gdAssertImageEqualsToFile(path, im)) {
			error |= 1;
		}
		gdImageDestroy(im);
	}

	return error;
}