summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-src/tests/gdimageline/bug00315.c
blob: 719d155e0ba46add162d9005841dd7c9aef2d279 (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
/**
 * Regression test for <https://github.com/libgd/libgd/issues/315>
 *
 * We're testing that a single-pointed gdImageAALine() is drawn as a single
 * non-antialized pixel, according to (two-pointed) vertical and horizontal
 * lines.
 */

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

int main()
{
	gdImagePtr im;
	int white, black;
	char *path;

	im = gdImageCreateTrueColor(6, 6);
	white = gdImageColorAllocate(im, 255, 255, 255);
	black = gdImageColorAllocate(im, 0, 0, 0);
	gdImageFilledRectangle(im, 0,0, 5,5, white);

	gdImageLine(im, 4,4, 4,4, black);
	gdImageLine(im, 1,4, 2,4, black);
	gdImageLine(im, 4,1, 4,2, black);

	gdImageSetAntiAliased(im, black);
	gdImageLine(im, 1,1, 1,1, gdAntiAliased);

	path = gdTestFilePath2("gdimageline", "bug00315_exp.png");
	gdAssertImageEqualsToFile(path, im);
	gdFree(path);

	gdImageDestroy(im);

	return gdNumFailures();
}