summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-src/tests/gdimageflip/gdimageflip.c
blob: da834eeda65f98e397fb9b3176f2ef89d632eeea (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
/**
 * Testing the basic operation of the gdImageFlip*() functions
 */

#include "gd.h"
#include "gdtest.h"

static void test_flip(void (BGD_STDCALL *func)(gdImagePtr), const char *filename)
{
	gdImagePtr im;
	FILE *fp;
	char *path;

	fp = gdTestFileOpen2("gdimageflip", "remi.png");
	im = gdImageCreateFromPng(fp);
	fclose(fp);

	func(im);

	path = gdTestFilePath2("gdimageflip", filename);
	gdAssertImageEqualsToFile(path, im);
	gdFree(path);

	gdImageDestroy(im);
}

int main()
{
	test_flip(gdImageFlipVertical, "gdimageflipvertical_exp.png");
	test_flip(gdImageFlipHorizontal, "gdimagefliphorizontal_exp.png");
	test_flip(gdImageFlipBoth, "gdimageflipboth_exp.png");

	return gdNumFailures();
}