File: github_bug_00584.c

package info (click to toggle)
libgd2 2.3.3-13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,396 kB
  • sloc: ansic: 49,708; sh: 5,660; javascript: 1,859; cpp: 1,308; makefile: 345; perl: 197; tcl: 45
file content (31 lines) | stat: -rw-r--r-- 834 bytes parent folder | download | duplicates (3)
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();
}