blob: 267a079d898305b37d09f2d8431233528f820be0 (
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/**
* Basic test for gdImageConvolution() and related functions
*/
#include "gd.h"
#include "gdtest.h"
static void test_convolution(void (*convolution_func)(gdImagePtr im), const char *expected)
{
gdImagePtr im;
FILE *fp;
char *path;
fp = gdTestFileOpen2("gdimageconvolution", "basic.png");
im = gdImageCreateFromPng(fp);
fclose(fp);
convolution_func(im);
path = gdTestFilePath2("gdimageconvolution", expected);
gdAssertImageEqualsToFile(path, im);
gdFree(path);
gdImageDestroy(im);
}
static void test_edge_detect_quick(gdImagePtr im)
{
gdImageEdgeDetectQuick(im);
}
static void test_smooth(gdImagePtr im)
{
gdImageSmooth(im, 5);
}
static void test_emboss(gdImagePtr im)
{
gdImageEmboss(im);
}
static void test_mean_removal(gdImagePtr im)
{
gdImageMeanRemoval(im);
}
int main()
{
test_convolution(&test_edge_detect_quick, "basic_edge_detect_quick.png");
test_convolution(&test_smooth, "basic_smooth.png");
test_convolution(&test_emboss, "basic_emboss.png");
test_convolution(&test_mean_removal, "basic_mean_removal.png");
return gdNumFailures();
}
|