diff options
Diffstat (limited to 'Build/source/libs/gd/libgd-src/tests')
11 files changed, 56 insertions, 12 deletions
diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagefile/CMakeLists.txt b/Build/source/libs/gd/libgd-src/tests/gdimagefile/CMakeLists.txt index ba48d643352..8676264c033 100644 --- a/Build/source/libs/gd/libgd-src/tests/gdimagefile/CMakeLists.txt +++ b/Build/source/libs/gd/libgd-src/tests/gdimagefile/CMakeLists.txt @@ -1,8 +1,10 @@ IF(TIFF_FOUND) -if(WEBP_FOUND) +IF(WEBP_FOUND) +IF(ENABLE_GD_FORMATS) LIST(APPEND TESTS_FILES gdnametest ) +ENDIF(ENABLE_GD_FORMATS) ENDIF(WEBP_FOUND) ENDIF(TIFF_FOUND) diff --git a/Build/source/libs/gd/libgd-src/tests/gdimageline/gdimageline_bug5.c b/Build/source/libs/gd/libgd-src/tests/gdimageline/gdimageline_bug5.c index 44adc8eaf86..d055b0c3123 100644 --- a/Build/source/libs/gd/libgd-src/tests/gdimageline/gdimageline_bug5.c +++ b/Build/source/libs/gd/libgd-src/tests/gdimageline/gdimageline_bug5.c @@ -10,7 +10,13 @@ int main() { /* FILE *pngout; */ int black, white; + /* If the data seg size is less than 195000, + * gdImageCrateTrueColor will return NULL. + * See https://github.com/libgd/libgd/issues/621 */ im = gdImageCreateTrueColor(63318, 771); + if (gdTestAssertMsg(im != NULL, "gdImageCreateTrueColor() returns NULL\n") == 0) { + return gdNumFailures(); + } /* Allocate the color white (red, green and blue all maximum). */ white = gdImageColorAllocate(im, 255, 255, 255); diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagesquaretocircle/Makemodule.am b/Build/source/libs/gd/libgd-src/tests/gdimagesquaretocircle/Makemodule.am index 5b303000756..77b7a308920 100644 --- a/Build/source/libs/gd/libgd-src/tests/gdimagesquaretocircle/Makemodule.am +++ b/Build/source/libs/gd/libgd-src/tests/gdimagesquaretocircle/Makemodule.am @@ -1,5 +1,7 @@ +if HAVE_LIBPNG libgd_test_programs += \ gdimagesquaretocircle/gdimagesquaretocircle +endif EXTRA_DIST += \ gdimagesquaretocircle/CMakeLists.txt \ diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagestring16/gdimagestring16.c b/Build/source/libs/gd/libgd-src/tests/gdimagestring16/gdimagestring16.c index 57eae978c36..0ca06680252 100644 --- a/Build/source/libs/gd/libgd-src/tests/gdimagestring16/gdimagestring16.c +++ b/Build/source/libs/gd/libgd-src/tests/gdimagestring16/gdimagestring16.c @@ -9,9 +9,7 @@ int main() { /* Declare the image */ gdImagePtr im = NULL; - wchar_t *wchr = L"H"; - unsigned short *sptr; - sptr = (unsigned short *)wchr; + unsigned short s[2] = {'H', 0}; int foreground; int errorcode = 0; gdFontPtr fontptr = gdFontGetLarge(); @@ -20,7 +18,7 @@ int main() gdImageColorAllocate(im, 255, 255, 255); foreground = gdImageColorAllocate(im, 22, 4, 238); - gdImageString16(im, fontptr, 2, 2, sptr, foreground); + gdImageString16(im, fontptr, 2, 2, s, foreground); if (!gdAssertImageEqualsToFile("gdimagestring16/gdimagestring16_exp.png", im)) errorcode = 1; diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagestringft/CMakeLists.txt b/Build/source/libs/gd/libgd-src/tests/gdimagestringft/CMakeLists.txt index f46b9006ee6..42868a27afe 100644 --- a/Build/source/libs/gd/libgd-src/tests/gdimagestringft/CMakeLists.txt +++ b/Build/source/libs/gd/libgd-src/tests/gdimagestringft/CMakeLists.txt @@ -1,5 +1,6 @@ IF(FREETYPE_FOUND) LIST(APPEND TESTS_FILES + bug00615 gdimagestringft_bbox ) ENDIF(FREETYPE_FOUND) diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagestringft/Makemodule.am b/Build/source/libs/gd/libgd-src/tests/gdimagestringft/Makemodule.am index 0dfe26fb13c..a62081f420f 100644 --- a/Build/source/libs/gd/libgd-src/tests/gdimagestringft/Makemodule.am +++ b/Build/source/libs/gd/libgd-src/tests/gdimagestringft/Makemodule.am @@ -1,5 +1,6 @@ if HAVE_LIBFREETYPE libgd_test_programs += \ + gdimagestringft/bug00615 \ gdimagestringft/gdimagestringft_bbox endif diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagestringft/bug00615.c b/Build/source/libs/gd/libgd-src/tests/gdimagestringft/bug00615.c new file mode 100644 index 00000000000..0da51dae8a9 --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/gdimagestringft/bug00615.c @@ -0,0 +1,25 @@ +/** + * Test that rendering an empty string does not fail + * + * Rendering an empty string with gdImageStringFT() is not supposed to fail; + * it is just a no-op. + * + * See <https://github.com/libgd/libgd/issues/615> + */ + +#include "gd.h" +#include "gdtest.h" + +int main() +{ + gdImagePtr im = gdImageCreate(100, 100); + + int rect[8]; + int fg = gdImageColorAllocate(im, 255, 255, 255); + char *path = gdTestFilePath("freetype/DejaVuSans.ttf"); + char *res = gdImageStringFT(im, rect, fg, path, 12, 0, 10, 10, ""); + + gdTestAssert(res == NULL); + + return gdNumFailures(); +} diff --git a/Build/source/libs/gd/libgd-src/tests/gdimagestringup16/gdimagestringup16.c b/Build/source/libs/gd/libgd-src/tests/gdimagestringup16/gdimagestringup16.c index c843abec473..c24639fd2d1 100644 --- a/Build/source/libs/gd/libgd-src/tests/gdimagestringup16/gdimagestringup16.c +++ b/Build/source/libs/gd/libgd-src/tests/gdimagestringup16/gdimagestringup16.c @@ -9,9 +9,7 @@ int main() { /* Declare the image */ gdImagePtr im = NULL; - wchar_t *wchr = L"H"; - unsigned short *sptr; - sptr = (unsigned short *)wchr; + unsigned short s[2] = {'H', 0}; int foreground; int errorcode = 0; gdFontPtr fontptr = gdFontGetLarge(); @@ -20,7 +18,7 @@ int main() gdImageColorAllocate(im, 255, 255, 255); foreground = gdImageColorAllocate(im, 22, 4, 238); - gdImageStringUp16(im, fontptr, 2, 18, sptr, foreground); + gdImageStringUp16(im, fontptr, 2, 18, s, foreground); if (!gdAssertImageEqualsToFile("gdimagestringup16/gdimagestringup16_exp.png", im)) errorcode = 1; diff --git a/Build/source/libs/gd/libgd-src/tests/gdtest/CMakeLists.txt b/Build/source/libs/gd/libgd-src/tests/gdtest/CMakeLists.txt index 4b0526252ab..ff9fd7da82b 100644 --- a/Build/source/libs/gd/libgd-src/tests/gdtest/CMakeLists.txt +++ b/Build/source/libs/gd/libgd-src/tests/gdtest/CMakeLists.txt @@ -1,3 +1,7 @@ add_definitions(-DGDTEST_TOP_DIR="${CMAKE_CURRENT_SOURCE_DIR}/..") -add_library (gdTest STATIC gdtest.c) +SET(GDTEST_FILES gdtest.c) +if(WIN32) + LIST(APPEND GDTEST_FILES readdir.c) +endif() +add_library(gdTest STATIC ${GDTEST_FILES}) target_link_libraries(gdTest ${GD_LIB}) diff --git a/Build/source/libs/gd/libgd-src/tests/webp/CMakeLists.txt b/Build/source/libs/gd/libgd-src/tests/webp/CMakeLists.txt index bfabf2626cd..1d1b98f2e70 100644 --- a/Build/source/libs/gd/libgd-src/tests/webp/CMakeLists.txt +++ b/Build/source/libs/gd/libgd-src/tests/webp/CMakeLists.txt @@ -1,9 +1,13 @@ IF(WEBP_FOUND) LIST(APPEND TESTS_FILES bug00111 - bug_double_free gdImageWebpEx ) +IF(JPEG_FOUND) +LIST(APPEND TESTS_FILES + bug_double_free +) +ENDIF(JPEG_FOUND) ENDIF(WEBP_FOUND) ADD_GD_TESTS() diff --git a/Build/source/libs/gd/libgd-src/tests/webp/Makemodule.am b/Build/source/libs/gd/libgd-src/tests/webp/Makemodule.am index 48f2a527014..528edee0c48 100644 --- a/Build/source/libs/gd/libgd-src/tests/webp/Makemodule.am +++ b/Build/source/libs/gd/libgd-src/tests/webp/Makemodule.am @@ -1,8 +1,11 @@ if HAVE_LIBWEBP libgd_test_programs += \ webp/bug00111 \ - webp/bug_double_free \ webp/gdImageWebpEx +if HAVE_LIBJPEG +libgd_test_programs += \ + webp/bug_double_free +endif endif EXTRA_DIST += \ |