File: basic.c

package info (click to toggle)
libgd2 2.2.4-2%2Bdeb9u5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 9,956 kB
  • sloc: ansic: 46,953; sh: 5,560; cpp: 1,325; makefile: 295; perl: 223; tcl: 45; awk: 43
file content (62 lines) | stat: -rw-r--r-- 1,211 bytes parent folder | download | duplicates (2)
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();
}