summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-src/tests/gdimagecontrast/basic.c
blob: 66c17ab9fb9a087692eda6bc7c940ba937b2cf57 (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
/**
 * Basic test for gdImageContrast()
 */


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


static void test_contrast(double contrast);


int main()
{
    test_contrast(+50.0);
    test_contrast(-50.0);

    return gdNumFailures();
}


static void test_contrast(double contrast)
{
    gdImagePtr im;
    FILE *fp;
    char basename[256];
    char *path;

    fp = gdTestFileOpen2("gdimagecontrast", "basic.png");
    im = gdImageCreateFromPng(fp);
    fclose(fp);

    gdImageContrast(im, contrast);

    sprintf(basename, "basic%+03.0f.png", contrast);
    path = gdTestFilePath2("gdimagecontrast", basename);
    gdAssertImageEqualsToFile(path, im);
    gdFree(path);

    gdImageDestroy(im);
}