summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-src/tests/gdimagecolormatch/gdimagecolormatch.c
blob: f59c7691b3d906349b7d9e05ecd0e2f3f9fcdbcc (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
/**
 * Basic test for gdImageColorMatch()
 **/
#include "gd.h"
#include "gdtest.h"

int main(){
	gdImagePtr im1, im2;

	im1 = gdImageCreateTrueColor(80, 80);
	im2 = gdImageCreate(80, 80);

	gdImageColorAllocate(im1, 255, 36, 74);

	gdImageColorAllocate(im2, 255, 36, 74);
	gdImageColorAllocate(im2, 40, 0, 240);
	gdImageColorAllocate(im2, 255, 100, 255);
	gdImageColorAllocate(im2, 80, 60, 44);

	int ifMatch = gdImageColorMatch(im1, im2);

	gdImageDestroy(im1);
	gdImageDestroy(im2);

	if (gdTestAssert(ifMatch != 0))
	{
		gdTestErrorMsg("gdImageColorMatch failed.\n");
		return 1;
	}

	return 0;
}