diff options
Diffstat (limited to 'Build/source/libs/gd/libgd-src/tests/gdimagecolordeallocate/gdimagecolordeallocate.c')
-rw-r--r-- | Build/source/libs/gd/libgd-src/tests/gdimagecolordeallocate/gdimagecolordeallocate.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagecolordeallocate/gdimagecolordeallocate.c b/Build/source/libs/gd/libgd-src/tests/gdimagecolordeallocate/gdimagecolordeallocate.c new file mode 100644 index 00000000000..c671bd323de --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagecolordeallocate/gdimagecolordeallocate.c @@ -0,0 +1,29 @@ +#include <stdio.h> +#include "gd.h" +#include "gdtest.h" + +int main() +{ + gdImagePtr im; + int c; + + im = gdImageCreate(1, 1); + /* test for deallocating a color */ + c = gdImageColorAllocate(im, 255, 255, 255); + if (c < 0) { + gdImageDestroy(im); + return 1; + } + gdImageColorDeallocate(im, c); + if (!im->open[c]) { + gdImageDestroy(im); + return 1; + } + + /* just see whether it is OK with out-of-bounds values */ + gdImageColorDeallocate(im, gdMaxColors); + gdImageColorDeallocate(im, -1); + gdImageDestroy(im); + + return 0; +} |