1 /**
2  * Test that gdImageSetInterpolationMethod(im, GD_DEFAULT) is consistent
3  *
4  * See <https://github.com/libgd/libgd/issues/584>
5  */
6 
7 #include "gd.h"
8 #include "gdtest.h"
9 
10 
main()11 int main()
12 {
13     gdImagePtr im;
14     gdInterpolationMethod old_m, new_m;
15     interpolation_method old_f, new_f;
16 
17     im = gdImageCreateTrueColor(8, 8);
18     gdTestAssert(im != NULL);
19     gdTestAssert(gdImageSetInterpolationMethod(im, GD_SINC));
20     old_m = gdImageGetInterpolationMethod(im);
21     gdTestAssert(old_m == GD_SINC);
22     old_f = im->interpolation;
23     gdTestAssert(gdImageSetInterpolationMethod(im, GD_DEFAULT));
24     new_m = gdImageGetInterpolationMethod(im);
25     gdTestAssert(new_m == GD_LINEAR);
26     new_f = im->interpolation;
27     gdTestAssert(new_m != old_m);
28     gdTestAssert(new_f != old_f);
29     gdImageDestroy(im);
30     return gdNumFailures();
31 }
32