Warning, /frameworks/kfilemetadata/autotests/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Test) 0002 0003 find_package(Python3 COMPONENTS Interpreter) 0004 set_package_properties(Python3 PROPERTIES DESCRIPTION "Python Interpreter" 0005 URL "https://www.python.org" TYPE OPTIONAL 0006 PURPOSE "Python interpreter is required for testing external extractors and writers") 0007 0008 remove_definitions(-DQT_NO_CAST_FROM_ASCII) 0009 0010 configure_file(indexerextractortestsconfig.h.in 0011 ${CMAKE_CURRENT_BINARY_DIR}/indexerextractortestsconfig.h @ONLY) 0012 0013 0014 set(KfileMetaDataAutotest_SRCS) 0015 ecm_qt_declare_logging_category(KfileMetaDataAutotest_SRCS 0016 HEADER kfilemetadata_debug.h 0017 IDENTIFIER KFILEMETADATA_LOG 0018 CATEGORY_NAME kf.filemetadata 0019 ) 0020 0021 0022 # 0023 # Test case coverage 0024 # 0025 ecm_add_test(extractorcoveragetest.cpp 0026 TEST_NAME "extractorcoveragetest" 0027 LINK_LIBRARIES Qt6::Test KF6::FileMetaData 0028 ) 0029 0030 # 0031 # Full text extraction test 0032 # 0033 set(text_COMPAT_CODEC) 0034 ecm_add_test( 0035 indexerextractortests.cpp 0036 ../src/extractors/plaintextextractor.cpp 0037 TEST_NAME "indexextractortest" 0038 LINK_LIBRARIES Qt6::Test KF6::FileMetaData ${text_COMPAT_CODEC} 0039 ) 0040 0041 # 0042 # Office 0043 # 0044 if(KF6Archive_FOUND) 0045 ecm_add_test(odfextractortest.cpp ../src/extractors/odfextractor.cpp 0046 TEST_NAME "odfextractortest" 0047 LINK_LIBRARIES Qt6::Test Qt6::Xml KF6::FileMetaData KF6::Archive 0048 ) 0049 endif() 0050 0051 if(KF6Archive_FOUND) 0052 ecm_add_test(office2007extractortest.cpp ../src/extractors/office2007extractor.cpp 0053 TEST_NAME "officeextractortest" 0054 LINK_LIBRARIES Qt6::Test Qt6::Xml KF6::FileMetaData KF6::Archive 0055 ) 0056 endif() 0057 0058 # 0059 # Poppler 0060 # 0061 if(Poppler_Qt6_FOUND) 0062 ecm_add_test(popplerextractortest.cpp ../src/extractors/popplerextractor.cpp 0063 TEST_NAME "popplerextractortest" 0064 LINK_LIBRARIES Qt6::Test KF6::FileMetaData Poppler::Qt6 0065 ) 0066 endif() 0067 0068 # 0069 # EPub 0070 # 0071 if(EPUB_FOUND) 0072 include_directories(${EPUB_INCLUDE_DIR}) 0073 0074 ecm_add_test( 0075 epubextractortest.cpp 0076 ../src/extractors/epubextractor.cpp 0077 ../src/kfilemetadata_debug.cpp 0078 TEST_NAME "epubextractortest" 0079 LINK_LIBRARIES Qt6::Test KF6::FileMetaData ${EPUB_LIBRARIES} 0080 ) 0081 endif() 0082 0083 # 0084 # Mobi 0085 # 0086 if (QMobipocket_FOUND) 0087 ecm_add_test(mobiextractortest.cpp ../src/extractors/mobiextractor.cpp 0088 TEST_NAME "mobiextractortest" 0089 LINK_LIBRARIES Qt6::Test KF6::FileMetaData qmobipocket 0090 ) 0091 endif() 0092 0093 # 0094 # FictionBook2 0095 # 0096 if(KF6Archive_FOUND) 0097 ecm_add_test( 0098 fb2extractortest.cpp 0099 ../src/extractors/fb2extractor.cpp 0100 ../src/kfilemetadata_debug.cpp 0101 TEST_NAME "fb2extractortest" 0102 LINK_LIBRARIES Qt6::Test KF6::Archive KF6::FileMetaData 0103 ) 0104 endif() 0105 0106 # 0107 # Property Info 0108 # 0109 add_executable(propertyinfotest_bin propertyinfotest.cpp) 0110 target_link_libraries(propertyinfotest_bin 0111 Qt6::Test 0112 KF6::FileMetaData 0113 ) 0114 ecm_mark_as_test(propertyinfotest_bin) 0115 ecm_mark_nongui_executable(propertyinfotest_bin) 0116 # Run the benchmark with just 1 iteration, so we known it works 0117 add_test(NAME propertyinfotest_en COMMAND propertyinfotest_bin "-iterations" "1") 0118 add_test(NAME propertyinfotest_localized COMMAND propertyinfotest_bin "--localized" "-iterations" "1") 0119 0120 # 0121 # Exiv2 0122 # 0123 if(LibExiv2_FOUND) 0124 kde_enable_exceptions() 0125 ecm_add_test(exiv2extractortest.cpp ../src/extractors/exiv2extractor.cpp 0126 TEST_NAME "exiv2extractortest" 0127 LINK_LIBRARIES Qt6::Test KF6::FileMetaData LibExiv2::LibExiv2 0128 ) 0129 if (${LibExiv2_VERSION} VERSION_LESS 0.28.0) 0130 # exiv2 0.27.x still uses std::auto_ptr, which is incompatible with C++17 0131 set_target_properties(kfilemetadata_exiv2extractor PROPERTIES CXX_STANDARD 14) 0132 endif() 0133 target_include_directories(exiv2extractortest PRIVATE ${CMAKE_BINARY_DIR}/src/extractors) 0134 endif() 0135 0136 # 0137 # FFMPEG 0138 # 0139 if(FFMPEG_FOUND) 0140 kde_enable_exceptions() 0141 ecm_add_test( 0142 ffmpegextractortest.cpp 0143 ../src/extractors/ffmpegextractor.cpp 0144 ../src/kfilemetadata_debug.cpp 0145 TEST_NAME "ffmpegextractortest" 0146 LINK_LIBRARIES Qt6::Test KF6::FileMetaData ${AVCODEC_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVUTIL_LIBRARIES} 0147 ) 0148 target_include_directories(ffmpegextractortest SYSTEM PRIVATE ${AVCODEC_INCLUDE_DIRS} ${AVFORMAT_INCLUDE_DIRS} ${AVUTIL_INCLUDE_DIRS}) 0149 endif() 0150 0151 # 0152 # TagLib 0153 # 0154 if(Taglib_FOUND) 0155 kde_enable_exceptions() 0156 ecm_add_test(taglibextractortest.cpp ../src/extractors/taglibextractor.cpp ${KfileMetaDataAutotest_SRCS} 0157 TEST_NAME "taglibextractortest" 0158 LINK_LIBRARIES Qt6::Test KF6::FileMetaData Taglib::Taglib 0159 ) 0160 endif() 0161 0162 0163 if(TARGET Python3::Interpreter AND NOT WIN32) 0164 # Test relies on working she-bang, which does non exist on Windows 0165 configure_file(samplefiles/testexternalextractor/main.py samplefiles/testexternalextractor/main.py) 0166 configure_file(samplefiles/testexternalextractor/manifest.json samplefiles/testexternalextractor/manifest.json COPYONLY) 0167 0168 ecm_add_test(externalextractortest.cpp $<$<BOOL:${BUILD_SHARED_LIBS}>:../src/externalextractor.cpp> ${KfileMetaDataAutotest_SRCS} 0169 TEST_NAME "externalextractortest" 0170 LINK_LIBRARIES Qt6::Test KF6::FileMetaData KF6::I18n 0171 ) 0172 endif() 0173 0174 # 0175 # Collection 0176 # 0177 ecm_add_test(extractorcollectiontest.cpp 0178 TEST_NAME "extractorcollectiontest" 0179 LINK_LIBRARIES Qt6::Test KF6::FileMetaData 0180 ) 0181 0182 if(Taglib_FOUND) 0183 ecm_add_test(writercollectiontest.cpp 0184 TEST_NAME "writercollectiontest" 0185 LINK_LIBRARIES Qt6::Test KF6::FileMetaData 0186 ) 0187 endif() 0188 0189 # 0190 # XML 0191 # 0192 ecm_add_test( 0193 xmlextractortest.cpp 0194 ../src/extractors/xmlextractor.cpp 0195 ../src/extractors/dublincoreextractor.cpp 0196 ../src/kfilemetadata_debug.cpp 0197 TEST_NAME "xmlextractortest" 0198 LINK_LIBRARIES Qt6::Test Qt6::Xml KF6::FileMetaData 0199 ) 0200 0201 # 0202 # Postscript DSC 0203 # 0204 ecm_add_test( 0205 postscriptdscextractortest.cpp 0206 ../src/extractors/postscriptdscextractor.cpp 0207 ../src/kfilemetadata_debug.cpp 0208 TEST_NAME "postscriptdscextractortest" 0209 LINK_LIBRARIES Qt6::Test KF6::FileMetaData 0210 ) 0211 0212 # 0213 # AppImage 0214 # 0215 if(libappimage_FOUND AND KF6Config_FOUND AND Qt6Gui_FOUND) 0216 ecm_add_test(appimageextractortest.cpp ../src/extractors/appimageextractor.cpp 0217 TEST_NAME "appimageextractortest" 0218 LINK_LIBRARIES 0219 Qt6::Test 0220 KF6::FileMetaData 0221 KF6::ConfigCore 0222 Qt6::Xml 0223 Qt6::Gui 0224 libappimage 0225 ) 0226 endif() 0227 0228 # 0229 # PNG 0230 # 0231 ecm_add_test(pngextractortest.cpp ../src/extractors/pngextractor.cpp 0232 TEST_NAME "pngextractortest" 0233 LINK_LIBRARIES 0234 Qt6::Test 0235 KF6::FileMetaData 0236 Qt6::Gui 0237 ) 0238 0239 # 0240 # Krita 0241 # 0242 if(KF6Archive_FOUND) 0243 ecm_add_test(kritaextractortest.cpp ../src/extractors/kritaextractor.cpp 0244 TEST_NAME "kritaextractortest" 0245 LINK_LIBRARIES 0246 KF6::Archive 0247 KF6::FileMetaData 0248 Qt6::Test 0249 Qt6::Gui 0250 ) 0251 endif() 0252 0253 ################ 0254 # Writer tests # 0255 ################ 0256 0257 # 0258 # UserMetaData 0259 # 0260 if(UNIX) 0261 kde_enable_exceptions() 0262 ecm_add_test(usermetadatawritertest.cpp ../src/usermetadata.cpp 0263 TEST_NAME "usermetadatawritertest" 0264 LINK_LIBRARIES Qt6::Test KF6::FileMetaData 0265 ) 0266 endif() 0267 0268 # 0269 # TagLib 0270 # 0271 if(Taglib_FOUND) 0272 kde_enable_exceptions() 0273 ecm_add_test(taglibwritertest.cpp ../src/writers/taglibwriter.cpp ${KfileMetaDataAutotest_SRCS} 0274 TEST_NAME "taglibwritertest" 0275 LINK_LIBRARIES Qt6::Test KF6::FileMetaData Taglib::Taglib 0276 ) 0277 endif() 0278 0279 if(TARGET Python3::Interpreter AND NOT WIN32) 0280 configure_file(samplefiles/testexternalwriter/main.py samplefiles/testexternalwriter/main.py) 0281 configure_file(samplefiles/testexternalwriter/manifest.json samplefiles/testexternalwriter/manifest.json COPYONLY) 0282 0283 ecm_add_test(externalwritertest.cpp $<$<BOOL:${BUILD_SHARED_LIBS}>:../src/externalwriter.cpp> ${KfileMetaDataAutotest_SRCS} 0284 TEST_NAME "externalwritertest" 0285 LINK_LIBRARIES Qt6::Test KF6::FileMetaData KF6::I18n 0286 ) 0287 endif()