summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-src/tests/gdimagesetinterpolationmethod/github_bug_00584.c
blob: e11f9f0633137ddb7e7e488fde0e9a7e1973c434 (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
/**
 * Test that gdImageSetInterpolationMethod(im, GD_DEFAULT) is consistent
 *
 * See <https://github.com/libgd/libgd/issues/584>
 */

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


int main()
{
    gdImagePtr im;
    gdInterpolationMethod old_m, new_m;
    interpolation_method old_f, new_f;

    im = gdImageCreateTrueColor(8, 8);
    gdTestAssert(im != NULL);
    gdTestAssert(gdImageSetInterpolationMethod(im, GD_SINC));
    old_m = gdImageGetInterpolationMethod(im);
    gdTestAssert(old_m == GD_SINC);
    old_f = im->interpolation;
    gdTestAssert(gdImageSetInterpolationMethod(im, GD_DEFAULT));
    new_m = gdImageGetInterpolationMethod(im);
    gdTestAssert(new_m == GD_LINEAR);
    new_f = im->interpolation;
    gdTestAssert(new_m != old_m);
    gdTestAssert(new_f != old_f);
    gdImageDestroy(im);
    return gdNumFailures();
}