diff options
Diffstat (limited to 'Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_resolution.c')
-rw-r--r-- | Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_resolution.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_resolution.c b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_resolution.c new file mode 100644 index 00000000000..386f5f3fee4 --- /dev/null +++ b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_resolution.c @@ -0,0 +1,28 @@ +#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 = gdImageJpegPtr(im, &size, 10); + gdImageDestroy(im); + + im = gdImageCreateFromJpegPtr(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; +} |