mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-07-18 20:04:16 -04:00
Only perform tests for plugins that are built
This both excludes the autotests and tests subdirs if the user sets BUILD_TESTING off, and makes sure we do not run tests for formats that were not built due to dependencies not being found. REVIEW: 115504
This commit is contained in:
@ -6,11 +6,13 @@ add_definitions(-DPLUGIN_DIR="${CMAKE_CURRENT_BINARY_DIR}/../src")
|
||||
remove_definitions(-DQT_NO_CAST_FROM_ASCII)
|
||||
|
||||
macro(kimageformats_read_tests)
|
||||
add_executable(readtest readtest.cpp)
|
||||
target_link_libraries(readtest Qt5::Gui)
|
||||
target_compile_definitions(readtest
|
||||
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/read")
|
||||
ecm_mark_as_test(readtest)
|
||||
if (NOT TARGET readtest)
|
||||
add_executable(readtest readtest.cpp)
|
||||
target_link_libraries(readtest Qt5::Gui)
|
||||
target_compile_definitions(readtest
|
||||
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/read")
|
||||
ecm_mark_as_test(readtest)
|
||||
endif()
|
||||
foreach(_testname ${ARGN})
|
||||
add_test(
|
||||
NAME kimageformats-read-${_testname}
|
||||
@ -20,11 +22,13 @@ macro(kimageformats_read_tests)
|
||||
endmacro()
|
||||
|
||||
macro(kimageformats_write_tests)
|
||||
add_executable(writetest writetest.cpp)
|
||||
target_link_libraries(writetest Qt5::Gui)
|
||||
target_compile_definitions(writetest
|
||||
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/write")
|
||||
ecm_mark_as_test(writetest)
|
||||
if (NOT TARGET writetest)
|
||||
add_executable(writetest writetest.cpp)
|
||||
target_link_libraries(writetest Qt5::Gui)
|
||||
target_compile_definitions(writetest
|
||||
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/write")
|
||||
ecm_mark_as_test(writetest)
|
||||
endif()
|
||||
foreach(_testname ${ARGN})
|
||||
string(REGEX MATCH "-lossless$" _is_lossless "${_testname}")
|
||||
unset(lossless_arg)
|
||||
@ -43,9 +47,6 @@ endmacro()
|
||||
# Loads each <format> image in read/<format>/, and compares the
|
||||
# result against the data read from the corresponding png file
|
||||
kimageformats_read_tests(
|
||||
#eps # EPS read tests depend on the vagaries of GhostScript
|
||||
# which we cannot even guarantee to find
|
||||
jp2
|
||||
pcx
|
||||
pic
|
||||
psd
|
||||
@ -53,7 +54,6 @@ kimageformats_read_tests(
|
||||
rgb
|
||||
tga
|
||||
xcf
|
||||
webp
|
||||
)
|
||||
|
||||
# Basic write tests
|
||||
@ -63,11 +63,25 @@ kimageformats_read_tests(
|
||||
# You can append -lossless to the format to indicate that
|
||||
# reading back the image data will result in an identical image.
|
||||
kimageformats_write_tests(
|
||||
#eps # EPS writing depends on a choice of tools, and so needs
|
||||
# a cleverer test
|
||||
jp2
|
||||
pcx-lossless
|
||||
pic-lossless
|
||||
rgb-lossless
|
||||
tga # fixme: the alpha images appear not to be written properly
|
||||
)
|
||||
|
||||
# EPS read tests depend on the vagaries of GhostScript
|
||||
# which we cannot even guarantee to find, so disable them for now
|
||||
#if (BUILD_EPS_PLUGIN)
|
||||
# kimageformats_read_tests(eps)
|
||||
# kimageformats_write_tests(eps)
|
||||
#endif()
|
||||
if (JASPER_FOUND)
|
||||
kimageformats_read_tests(jp2)
|
||||
kimageformats_write_tests(jp2)
|
||||
endif()
|
||||
if (OpenEXR_FOUND)
|
||||
# FIXME: OpenEXR tests
|
||||
endif()
|
||||
if (WebP_FOUND)
|
||||
kimageformats_read_tests(webp)
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user