mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 17:08:08 -04:00
The plugin export mechanism has been patched up (including the addition of the JSON file), and the FindWebP.cmake file is new. Writing is currently disabled, as it produces broken images. Autotests are generated using the cwebp and dwebp utilities distributed with the libwebp reference library. REVIEW: 115355
74 lines
2.2 KiB
CMake
74 lines
2.2 KiB
CMake
#find_package(Qt5Test ${REQUIRED_QT_VERSION} NO_MODULE)
|
|
|
|
include(ECMMarkAsTest)
|
|
|
|
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)
|
|
foreach(_testname ${ARGN})
|
|
add_test(
|
|
NAME kimageformats-read-${_testname}
|
|
COMMAND readtest ${_testname}
|
|
)
|
|
endforeach(_testname)
|
|
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)
|
|
foreach(_testname ${ARGN})
|
|
string(REGEX MATCH "-lossless$" _is_lossless "${_testname}")
|
|
unset(lossless_arg)
|
|
if (_is_lossless)
|
|
set(lossless_arg "--lossless")
|
|
string(REGEX REPLACE "-lossless$" "" _testname "${_testname}")
|
|
endif()
|
|
add_test(
|
|
NAME kimageformats-write-${_testname}
|
|
COMMAND writetest ${lossless_arg} ${_testname}
|
|
)
|
|
endforeach(_testname)
|
|
endmacro()
|
|
|
|
# Basic read tests
|
|
# 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
|
|
ras
|
|
rgb
|
|
tga
|
|
xcf
|
|
webp
|
|
)
|
|
|
|
# Basic write tests
|
|
# Loads each png image in write/, writes the data out
|
|
# as a <format> image, and compares the result against the
|
|
# the corresponding <format> file.
|
|
# 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
|
|
)
|