tests: add more checks for libpng (and other deps)

This fixes #382.
master
Mike Frysinger 2017-02-23 17:31:41 -05:00
parent 12a0f039b3
commit 00bbb69cc3
24 changed files with 84 additions and 22 deletions

View File

@ -1,12 +1,12 @@
LIST(APPEND TESTS_FILES
bmp_null
bug00275
bug00276
)
IF(PNG_FOUND)
LIST(APPEND TESTS_FILES
bmp_im2im
bug00276
)
ENDIF(PNG_FOUND)

View File

@ -1,11 +1,11 @@
libgd_test_programs += \
bmp/bmp_null \
bmp/bug00275 \
bmp/bug00276
bmp/bug00275
if HAVE_LIBPNG
libgd_test_programs += \
bmp/bmp_im2im
bmp/bmp_im2im \
bmp/bug00276
endif
EXTRA_DIST += \

View File

@ -1,7 +1,9 @@
IF(FREETYPE_FOUND AND FONTCONFIG_FOUND)
if(FONTCONFIG_FOUND)
IF(FREETYPE_FOUND)
LIST(APPEND TESTS_FILES
basic
)
ENDIF(FREETYPE_FOUND AND FONTCONFIG_FOUND)
ENDIF(FREETYPE_FOUND)
ENDIF(FONTCONFIG_FOUND)
ADD_GD_TESTS()

View File

@ -1,7 +1,9 @@
IF(FREETYPE_FOUND)
IF(PNG_FOUND)
LIST(APPEND TESTS_FILES
bug00132
)
ENDIF(PNG_FOUND)
ENDIF(FREETYPE_FOUND)
ADD_GD_TESTS()

View File

@ -1,7 +1,9 @@
if HAVE_LIBFREETYPE
if HAVE_LIBPNG
libgd_test_programs += \
freetype/bug00132
endif
endif
EXTRA_DIST += \
freetype/CMakeLists.txt \

View File

@ -1,5 +1,9 @@
IF(TIFF_FOUND)
if(WEBP_FOUND)
LIST(APPEND TESTS_FILES
gdnametest
)
ENDIF(WEBP_FOUND)
ENDIF(TIFF_FOUND)
ADD_GD_TESTS()

View File

@ -1,5 +1,9 @@
if HAVE_LIBTIFF
if HAVE_LIBWEBP
libgd_test_programs += \
gdimagefile/gdnametest
endif
endif
EXTRA_DIST += \
gdimagefile/CMakeLists.txt \

View File

@ -1,9 +1,14 @@
LIST(APPEND TESTS_FILES
bug00003
bug00106_gdimagerectangle
bug00299
github_bug_00172
point_ordering
)
IF(PNG_FOUND)
LIST(APPEND TESTS_FILES
bug00299
)
ENDIF(PNG_FOUND)
ADD_GD_TESTS()

View File

@ -1,10 +1,14 @@
libgd_test_programs += \
gdimagerectangle/bug00003 \
gdimagerectangle/bug00106_gdimagerectangle \
gdimagerectangle/bug00299 \
gdimagerectangle/github_bug_00172 \
gdimagerectangle/point_ordering
if HAVE_LIBPNG
libgd_test_programs += \
gdimagerectangle/bug00299
endif
EXTRA_DIST += \
gdimagerectangle/CMakeLists.txt \
gdimagerectangle/bug00299_exp.png

View File

@ -1,10 +1,10 @@
IF(PNG_FOUND)
IF(JPEG_FOUND)
LIST(APPEND TESTS_FILES
bug00067
)
ENDIF(JPEG_FOUND)
IF(PNG_FOUND)
LIST(APPEND TESTS_FILES
php_bug_64898
php_bug_65070

View File

@ -1,9 +1,9 @@
if HAVE_LIBPNG
if HAVE_LIBJPEG
libgd_test_programs += \
gdimagerotate/bug00067
endif
if HAVE_LIBPNG
libgd_test_programs += \
gdimagerotate/php_bug_64898 \
gdimagerotate/php_bug_65070

View File

@ -1,8 +1,13 @@
LIST(APPEND TESTS_FILES
alpha_blending
bug00186
gdeffectoverlay
gdeffectmultiply
)
IF(PNG_FOUND)
LIST(APPEND TESTS_FILES
alpha_blending
)
ENDIF(PNG_FOUND)
ADD_GD_TESTS()

View File

@ -1,9 +1,13 @@
libgd_test_programs += \
gdimagesetpixel/alpha_blending \
gdimagesetpixel/bug00186 \
gdimagesetpixel/gdeffectmultiply \
gdimagesetpixel/gdeffectoverlay
if HAVE_LIBPNG
libgd_test_programs += \
gdimagesetpixel/alpha_blending
endif
EXTRA_DIST += \
gdimagesetpixel/CMakeLists.txt \
gdimagesetpixel/alphablending_exp.png

View File

@ -1,7 +1,9 @@
IF(FREETYPE_FOUND)
IF(PNG_FOUND)
LIST(APPEND TESTS_FILES
gdimagestringft_bbox
)
ENDIF(PNG_FOUND)
ENDIF(FREETYPE_FOUND)
ADD_GD_TESTS()

View File

@ -1,7 +1,9 @@
if HAVE_LIBFREETYPE
if HAVE_LIBPNG
libgd_test_programs += \
gdimagestringft/gdimagestringft_bbox
endif
endif
EXTRA_DIST += \
gdimagestringft/CMakeLists.txt

View File

@ -40,6 +40,7 @@ void gdSilence(int priority, const char *format, va_list args)
(void)args;
}
#ifdef HAVE_LIBPNG
gdImagePtr gdTestImageFromPng(const char *filename)
{
gdImagePtr image;
@ -64,6 +65,7 @@ gdImagePtr gdTestImageFromPng(const char *filename)
fclose(fp);
return image;
}
#endif
static char *tmpdir_base;
@ -501,7 +503,7 @@ unsigned int gdMaxPixelDiff(gdImagePtr a, gdImagePtr b)
return diff;
}
#ifdef HAVE_LIBPNG
int gdTestImageCompareToImage(const char* file, unsigned int line, const char* message,
gdImagePtr expected, gdImagePtr actual)
{
@ -578,13 +580,15 @@ fail:
if (surface_diff) {
gdImageDestroy(surface_diff);
}
return 0;
return 1;
}
#endif
#ifdef HAVE_LIBPNG
int gdTestImageCompareToFile(const char* file, unsigned int line, const char* message,
const char *expected_file, gdImagePtr actual)
{
gdImagePtr expected;
gdImagePtr expected = 0;
int res = 1;
expected = gdTestImageFromPng(expected_file);
@ -598,7 +602,7 @@ int gdTestImageCompareToFile(const char* file, unsigned int line, const char* me
}
return res;
}
#endif
static int failureCount = 0;

View File

@ -1,6 +1,5 @@
IF(JPEG_FOUND)
LIST(APPEND TESTS_FILES
bug_github_18
jpeg_empty_file
jpeg_im2im
jpeg_null
@ -8,6 +7,7 @@ LIST(APPEND TESTS_FILES
IF(PNG_FOUND)
LIST(APPEND TESTS_FILES
bug_github_18
jpeg_read
jpeg_resolution
)

View File

@ -1,12 +1,12 @@
if HAVE_LIBJPEG
libgd_test_programs += \
jpeg/bug_github_18 \
jpeg/jpeg_empty_file \
jpeg/jpeg_im2im \
jpeg/jpeg_null
if HAVE_LIBPNG
libgd_test_programs += \
jpeg/bug_github_18 \
jpeg/jpeg_read \
jpeg/jpeg_resolution
endif

View File

@ -1,12 +1,17 @@
LIST(APPEND TESTS_FILES
tga_null
bug00084
bug00247
bug00247a
bug00248
bug00248a
heap_overflow
tga_read
tga_null
)
IF(PNG_FOUND)
LIST(APPEND TESTS_FILES
tga_read
)
ENDIF(PNG_FOUND)
ADD_GD_TESTS()

View File

@ -5,8 +5,12 @@ libgd_test_programs += \
tga/bug00248 \
tga/bug00248a \
tga/heap_overflow \
tga/tga_null \
tga/tga_null
if HAVE_LIBPNG
libgd_test_programs += \
tga/tga_read
endif
EXTRA_DIST += \
tga/CMakeLists.txt \

View File

@ -4,8 +4,13 @@ LIST(APPEND TESTS_FILES
tiff_invalid_read
tiff_null
tiff_dpi
)
IF(PNG_FOUND)
LIST(APPEND TESTS_FILES
tiff_read_bw
)
ENDIF(PNG_FOUND)
ENDIF(TIFF_FOUND)
ADD_GD_TESTS()

View File

@ -3,9 +3,13 @@ libgd_test_programs += \
tiff/tiff_dpi \
tiff/tiff_im2im \
tiff/tiff_invalid_read \
tiff/tiff_null \
tiff/tiff_null
if HAVE_LIBPNG
libgd_test_programs += \
tiff/tiff_read_bw
endif
endif
EXTRA_DIST += \
tiff/CMakeLists.txt \

View File

@ -1,7 +1,9 @@
IF(PNG_FOUND)
LIST(APPEND TESTS_FILES
github_bug_109
github_bug_170
x10_basic_read
)
ENDIF(PNG_FOUND)
ADD_GD_TESTS()

View File

@ -1,7 +1,9 @@
if HAVE_LIBPNG
libgd_test_programs += \
xbm/github_bug_109 \
xbm/github_bug_170 \
xbm/x10_basic_read
endif
EXTRA_DIST += \
xbm/CMakeLists.txt \