summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-src/tests/png/bug00381_1.c
blob: d8f375b89f8fb0939e412aaacdc1e45819e30300 (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 failure to convert to PNG returns NULL
 *
 * We are creating a palette image without allocating any colors in the palette,
 * and pass this image to `gdImagePngPtr()` which is supposed to fail, and as
 * such should return NULL.
 *
 * See also <https://github.com/libgd/libgd/issues/381>
 */


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


int main()
{
    gdImagePtr im;
    void *data;
    int size = 0;

    im = gdImageCreate(100, 100);
    gdTestAssert(im != NULL);

    data = gdImagePngPtr(im, &size);
    gdTestAssert(data == NULL);

    gdImageDestroy(im);

    return gdNumFailures();
}