diff options
Diffstat (limited to 'Build/source/libs/gd/libgd-src/tests/gdimagestringup')
4 files changed, 49 insertions, 0 deletions
diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagestringup/CMakeLists.txt b/Build/source/libs/gd/libgd-src/tests/gdimagestringup/CMakeLists.txt new file mode 100644 index 00000000000..424cb837dad --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagestringup/CMakeLists.txt @@ -0,0 +1,7 @@ +IF(PNG_FOUND) +LIST(APPEND TESTS_FILES + gdimagestringup +) +ENDIF(PNG_FOUND) + +ADD_GD_TESTS() diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagestringup/Makemodule.am b/Build/source/libs/gd/libgd-src/tests/gdimagestringup/Makemodule.am new file mode 100644 index 00000000000..b136c80c906 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagestringup/Makemodule.am @@ -0,0 +1,8 @@ +if HAVE_LIBPNG +libgd_test_programs += \ + gdimagestringup/gdimagestringup +endif + +EXTRA_DIST += \ + gdimagestringup/CMakeLists.txt \ + gdimagestringup/gdimagestringup_exp.png diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagestringup/gdimagestringup.c b/Build/source/libs/gd/libgd-src/tests/gdimagestringup/gdimagestringup.c new file mode 100644 index 00000000000..0832bd79072 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagestringup/gdimagestringup.c @@ -0,0 +1,34 @@ +/** + * Base test for gdImageStringUp() + */ +#include <gd.h> +#include <gdfontl.h> +#include "gdtest.h" +#include <string.h> + +int main() +{ + /* Declare the image */ + gdImagePtr im = NULL; + char *s = "Hello gd"; + int errorcode = 0; + int foreground; + gdFontPtr fontptr = gdFontGetLarge(); + + im = gdImageCreate(50, 100); + gdImageColorAllocate(im, 202, 202, 0); + foreground = gdImageColorAllocate(im, 22, 4, 238); + + gdImageStringUp(im, fontptr, + im->sx / 2 - fontptr->h / 2, + im->sy / 2 + (strlen(s) * fontptr->w / 2), + (unsigned char*)s, foreground); + + if (!gdAssertImageEqualsToFile("gdimagestringup/gdimagestringup_exp.png", im)) + errorcode = 1; + + /* Destroy the image im memory */ + gdImageDestroy(im); + + return errorcode; +} diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagestringup/gdimagestringup_exp.png b/Build/source/libs/gd/libgd-src/tests/gdimagestringup/gdimagestringup_exp.png Binary files differnew file mode 100644 index 00000000000..d1f6d664848 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagestringup/gdimagestringup_exp.png |