summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-src/tests/gdimagescale/bug00330.c
blob: 0c9d10c9139ee9df08471907015836436f48536a (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
/**
 * Regression test for <https://github.com/libgd/libgd/issues/330>.
 *
 * We're testing that after scaling a palette image, the center pixel actually
 * has the expected color value.
 */


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


int main()
{
    gdImagePtr src, dst;
    int color;

    src = gdImageCreate(100, 100);
    gdImageColorAllocate(src, 255, 255, 255);

    gdImageSetInterpolationMethod(src, GD_BILINEAR_FIXED);
    dst = gdImageScale(src, 200, 200);

    color = gdImageGetPixel(dst, 99, 99);
    gdTestAssertMsg(color == 0xffffff,
                    "expected color ffffff, but got %x\n", color);

    gdImageDestroy(src);
    gdImageDestroy(dst);

    return 0;
}