Warning, /frameworks/kimageformats/autotests/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 #find_package(Qt5Test ${REQUIRED_QT_VERSION} NO_MODULE) 0002 0003 include(ECMMarkAsTest) 0004 0005 add_definitions(-DPLUGIN_DIR="${CMAKE_CURRENT_BINARY_DIR}/../bin") 0006 remove_definitions(-DQT_NO_CAST_FROM_ASCII) 0007 0008 macro(kimageformats_read_tests) 0009 cmake_parse_arguments(KIF_RT "" "FUZZ" "" ${ARGN}) 0010 set(_fuzzarg) 0011 if (KIF_RT_FUZZ) 0012 set(_fuzzarg -f ${KIF_RT_FUZZ}) 0013 endif() 0014 0015 if (NOT TARGET readtest) 0016 add_executable(readtest readtest.cpp) 0017 target_link_libraries(readtest Qt${QT_MAJOR_VERSION}::Gui) 0018 target_compile_definitions(readtest 0019 PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/read") 0020 ecm_mark_as_test(readtest) 0021 endif() 0022 0023 foreach(_testname ${KIF_RT_UNPARSED_ARGUMENTS}) 0024 add_test( 0025 NAME kimageformats-read-${_testname} 0026 COMMAND readtest ${_fuzzarg} ${_testname} 0027 ) 0028 endforeach(_testname) 0029 endmacro() 0030 0031 macro(kimageformats_write_tests) 0032 cmake_parse_arguments(KIF_RT "" "FUZZ" "" ${ARGN}) 0033 set(_fuzzarg) 0034 if (KIF_RT_FUZZ) 0035 set(_fuzzarg -f ${KIF_RT_FUZZ}) 0036 endif() 0037 0038 if (NOT TARGET writetest) 0039 add_executable(writetest writetest.cpp) 0040 target_link_libraries(writetest Qt${QT_MAJOR_VERSION}::Gui) 0041 target_compile_definitions(writetest 0042 PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/write") 0043 ecm_mark_as_test(writetest) 0044 endif() 0045 foreach(_testname ${KIF_RT_UNPARSED_ARGUMENTS}) 0046 string(REGEX MATCH "-lossless$" _is_lossless "${_testname}") 0047 string(REGEX MATCH "-nodatacheck" _is_no_data_check "${_testname}") 0048 unset(lossless_arg) 0049 unset(no_data_check_arg) 0050 if (_is_lossless) 0051 set(lossless_arg "--lossless") 0052 string(REGEX REPLACE "-lossless$" "" _testname "${_testname}") 0053 endif() 0054 if (_is_no_data_check) 0055 set(no_data_check_arg "--no-data-check") 0056 string(REGEX REPLACE "-nodatacheck$" "" _testname "${_testname}") 0057 endif() 0058 add_test( 0059 NAME kimageformats-write-${_testname} 0060 COMMAND writetest ${lossless_arg} ${no_data_check_arg} ${_fuzzarg} ${_testname} 0061 ) 0062 endforeach(_testname) 0063 endmacro() 0064 0065 # Basic read tests 0066 # Loads each <format> image in read/<format>/, and compares the 0067 # result against the data read from the corresponding png file 0068 kimageformats_read_tests( 0069 hdr 0070 pcx 0071 psd 0072 qoi 0073 ras 0074 rgb 0075 tga 0076 ) 0077 0078 if (KF5Archive_FOUND) 0079 kimageformats_read_tests( 0080 kra 0081 ora 0082 ) 0083 endif() 0084 0085 if (TARGET avif) 0086 kimageformats_read_tests( 0087 avif 0088 ) 0089 kimageformats_write_tests( 0090 avif-nodatacheck-lossless 0091 ) 0092 endif() 0093 0094 if (LibHeif_FOUND) 0095 kimageformats_read_tests( 0096 heif 0097 ) 0098 # because the plug-ins use RGB->YUV conversion which sometimes results in 1 value difference. 0099 kimageformats_write_tests(FUZZ 1 0100 heif-nodatacheck-lossless 0101 ) 0102 endif() 0103 0104 if (LibJXL_FOUND AND LibJXLThreads_FOUND) 0105 kimageformats_read_tests( 0106 jxl 0107 ) 0108 kimageformats_write_tests( 0109 jxl-nodatacheck-lossless 0110 ) 0111 endif() 0112 0113 # Allow some fuzziness when reading this formats, to allow for 0114 # rounding errors (eg: in alpha blending). 0115 kimageformats_read_tests(FUZZ 1 0116 xcf 0117 ) 0118 0119 # Basic write tests 0120 # Loads each png image in write/, writes the data out 0121 # as a <format> image, and compares the result against the 0122 # the corresponding <format> file. 0123 # You can append -lossless to the format to indicate that 0124 # reading back the image data will result in an identical image. 0125 kimageformats_write_tests( 0126 pcx-lossless 0127 pic-lossless 0128 qoi-lossless 0129 rgb-lossless 0130 tga # fixme: the alpha images appear not to be written properly 0131 ) 0132 0133 # EPS read tests depend on the vagaries of GhostScript 0134 # which we cannot even guarantee to find, so disable them for now 0135 #if (BUILD_EPS_PLUGIN) 0136 # kimageformats_read_tests(eps) 0137 # kimageformats_write_tests(eps) 0138 #endif() 0139 if (OpenEXR_FOUND) 0140 kimageformats_read_tests( 0141 exr 0142 ) 0143 endif() 0144 0145 if (LibRaw_FOUND) 0146 kimageformats_read_tests( 0147 raw 0148 ) 0149 endif() 0150 0151 find_package(Qt${QT_MAJOR_VERSION}Test ${REQUIRED_QT_VERSION} CONFIG QUIET) 0152 0153 if(NOT TARGET Qt${QT_MAJOR_VERSION}::Test) 0154 message(STATUS "Qt${QT_MAJOR_VERSION}Test not found, some autotests will not be built.") 0155 return() 0156 endif() 0157 0158 add_executable(pictest pictest.cpp) 0159 target_link_libraries(pictest Qt${QT_MAJOR_VERSION}::Gui Qt${QT_MAJOR_VERSION}::Test) 0160 ecm_mark_as_test(pictest) 0161 add_test(NAME kimageformats-pic COMMAND pictest) 0162 0163 add_executable(anitest anitest.cpp) 0164 target_link_libraries(anitest Qt${QT_MAJOR_VERSION}::Gui Qt${QT_MAJOR_VERSION}::Test) 0165 ecm_mark_as_test(anitest) 0166 add_test(NAME kimageformats-ani COMMAND anitest)