diff options
Diffstat (limited to 'Build/source/libs/gd/libgd-src/tests/png/png_resolution.c')
-rw-r--r-- | Build/source/libs/gd/libgd-src/tests/png/png_resolution.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Build/source/libs/gd/libgd-src/tests/png/png_resolution.c b/Build/source/libs/gd/libgd-src/tests/png/png_resolution.c new file mode 100644 index 00000000000..aed7545ba51 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/png/png_resolution.c @@ -0,0 +1,30 @@ +#include "gd.h" +#include <stdio.h> +#include <stdlib.h> +#include "gdtest.h" + +int main() +{ + gdImagePtr im; + void *data; + int size, red; + + im = gdImageCreate(100, 100); + gdImageSetResolution(im, 72, 300); + red = gdImageColorAllocate(im, 0xFF, 0x00, 0x00); + gdImageFilledRectangle(im, 0, 0, 99, 99, red); + data = gdImagePngPtr(im, &size); + gdImageDestroy(im); + + im = gdImageCreateFromPngPtr(size, data); + gdFree(data); + + if (!gdTestAssert(gdImageResolutionX(im) == 72) || !gdTestAssert(gdImageResolutionY(im) == 300)) { + gdTestErrorMsg("failed image resolution X (%d != 72) or Y (%d != 300)\n", gdImageResolutionX(im), gdImageResolutionY(im)); + gdImageDestroy(im); + return 1; + } + + gdImageDestroy(im); + return 0; +} |