Warning, /frameworks/kio/autotests/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 remove_definitions(-DQT_NO_CAST_FROM_ASCII)
0002 remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
0003
0004 include(ECMAddTests)
0005
0006 find_package(Qt6Widgets REQUIRED)
0007
0008 ########### unittests ###############
0009
0010 add_subdirectory(http)
0011
0012 find_package(Qt6Concurrent ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
0013
0014 if (ACL_FOUND)
0015 set (kacltest_SRC kacltest.cpp)
0016 endif()
0017
0018 ecm_add_tests(
0019 ${kacltest_SRC}
0020 listdirtest.cpp
0021 kmountpointtest.cpp
0022 upurltest.cpp
0023 dataprotocoltest.cpp
0024 jobtest.cpp
0025 jobremotetest.cpp
0026 kfileitemtest.cpp
0027 kprotocolinfotest.cpp
0028 globaltest.cpp
0029 mimetypefinderjobtest.cpp
0030 mkpathjobtest.cpp
0031 threadtest.cpp
0032 udsentrytest.cpp
0033 deletejobtest.cpp
0034 deleteortrashjobtest.cpp
0035 urlutiltest.cpp
0036 batchrenamejobtest.cpp
0037 ksambasharetest.cpp
0038 krecentdocumenttest.cpp
0039 filefiltertest.cpp
0040 NAME_PREFIX "kiocore-"
0041 LINK_LIBRARIES KF6::KIOCore KF6::I18n KF6::ConfigCore KF6::Service Qt6::Test Qt6::Network Qt6::Xml
0042 )
0043
0044 target_link_libraries(threadtest Qt6::Concurrent)
0045
0046 target_link_libraries(deleteortrashjobtest KF6::KIOWidgets)
0047
0048 # as per sysadmin request these are limited to linux only! https://invent.kde.org/frameworks/kio/-/merge_requests/1008
0049 if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND USE_FTPD_WSGIDAV_UNITTEST)
0050 include(FindGem)
0051 find_gem(ftpd)
0052 set_package_properties(Gem_ftpd PROPERTIES TYPE REQUIRED
0053 DESCRIPTION "Ruby ftpd gem. Either install it from your distribution's repos or by running `gem install --user-install ftpd`, which will install it under your user's home dir."
0054 PURPOSE "Ruby gem 'ftpd' required for testing the ftp worker."
0055 URL "https://rubygems.org/gems/ftpd")
0056 add_definitions(-DRubyExe_EXECUTABLE="${RubyExe_EXECUTABLE}")
0057 ecm_add_tests(
0058 ftptest.cpp
0059 NAME_PREFIX "kiocore-"
0060 LINK_LIBRARIES KF6::KIOCore KF6::I18n Qt6::Test Qt6::Network
0061 )
0062
0063 find_package(WsgidavExe)
0064 set_package_properties(WsgidavExe PROPERTIES TYPE REQUIRED
0065 DESCRIPTION "Python webdav server. Can be easily installed by running `pip3 install wsgidav`, which will install it under your user's home dir."
0066 PURPOSE "wsgidav required for running the webdavtest."
0067 URL "https://pypi.org/project/WsgiDAV/")
0068 ecm_add_tests(
0069 webdavtest.cpp
0070 NAME_PREFIX "kiocore-"
0071 LINK_LIBRARIES KF6::KIOCore Qt6::Test Qt6::Network
0072 )
0073 endif()
0074
0075 if(UNIX)
0076 ecm_add_tests(
0077 privilegejobtest.cpp
0078 NAME_PREFIX "kiocore-"
0079 LINK_LIBRARIES KF6::KIOCore KF6::I18n Qt6::Test Qt6::Network
0080 )
0081 endif()
0082
0083 if (TARGET KF6::KIOGui)
0084 ecm_add_tests(
0085 favicontest.cpp
0086 openurljobtest.cpp
0087 kemailclientlauncherjobtest.cpp
0088 NAME_PREFIX "kiogui-"
0089 LINK_LIBRARIES KF6::KIOCore KF6::KIOGui KF6::WindowSystem Qt6::Test
0090 )
0091
0092 foreach(_kprocessrunnerTest applicationlauncherjob commandlauncherjob kterminallauncherjob)
0093 foreach(_systemd "" "SCOPE" "SERVICE")
0094 set(_scope 0)
0095 set(_service 0)
0096 set(_forking 0)
0097 if(_systemd STREQUAL "SERVICE")
0098 set(KPR_TEST_TARGET ${_kprocessrunnerTest}_servicetest)
0099 set(_service 1)
0100 elseif(_systemd STREQUAL "SCOPE")
0101 set(KPR_TEST_TARGET ${_kprocessrunnerTest}_scopetest)
0102 set(_scope 1)
0103 else()
0104 set(KPR_TEST_TARGET ${_kprocessrunnerTest}_forkingtest)
0105 set(_forking 1)
0106 endif()
0107 add_executable(${KPR_TEST_TARGET} ${_kprocessrunnerTest}test.cpp)
0108 target_link_libraries(${KPR_TEST_TARGET} KF6::WindowSystem KF6::KIOCore KF6::KIOGui Qt6::Test)
0109 ecm_mark_as_test(${KPR_TEST_TARGET})
0110 add_test(NAME ${KPR_TEST_TARGET} COMMAND ${KPR_TEST_TARGET})
0111 set_tests_properties(${KPR_TEST_TARGET} PROPERTIES ENVIRONMENT
0112 "KDE_APPLICATIONS_AS_SERVICE=${_service};
0113 KDE_APPLICATIONS_AS_SCOPE=${_scope};
0114 KDE_APPLICATIONS_AS_FORKING=${_forking};"
0115 )
0116 endforeach()
0117 endforeach()
0118
0119 target_link_libraries(favicontest Qt6::Concurrent)
0120 endif()
0121
0122 if (NOT ANDROID)
0123 if (TARGET KF6::KIOWidgets)
0124 ecm_add_tests(
0125 clipboardupdatertest.cpp
0126 dropjobtest.cpp
0127 kdynamicjobtrackernowidgetstest.cpp
0128 desktopexecparsertest.cpp
0129 kdirlistertest.cpp
0130 kdirmodeltest.cpp
0131 kfileitemactionstest.cpp
0132 fileundomanagertest.cpp
0133 kurlcompletiontest.cpp
0134 ${jobguitest_SRC}
0135 pastetest.cpp
0136 kurifiltersearchprovideractionstest.cpp
0137 NAME_PREFIX "kiowidgets-"
0138 LINK_LIBRARIES KF6::KIOCore KF6::KIOWidgets Qt6::Test Qt6::DBus
0139 )
0140
0141 set(_libexec_dir_kf "${KDKE_INSTALL_FULL_LIBEXECDIR_KF}")
0142 target_compile_definitions(desktopexecparsertest PRIVATE "KDE_INSTALL_FULL_LIBEXECDIR_KF=${_libexec_dir_kf}")
0143
0144 set(kurifiltertest_libs KF6::KIOCore KF6::KIOWidgets Qt6::Test Qt6::DBus)
0145
0146 set(URIFILTER_COLON_TEST kiowidgets-kurifiltertest-colon-separator)
0147 ecm_add_test(kurifiltertest.cpp
0148 LINK_LIBRARIES ${kurifiltertest_libs}
0149 TEST_NAME ${URIFILTER_COLON_TEST}
0150 )
0151 target_compile_definitions(${URIFILTER_COLON_TEST} PUBLIC "-DWEBSHORTCUT_SEPARATOR=':'")
0152
0153 set(URIFILTER_SPACE_TEST kiowidgets-kurifiltertest-space-separator)
0154 ecm_add_test(kurifiltertest.cpp
0155 LINK_LIBRARIES ${kurifiltertest_libs}
0156 TEST_NAME ${URIFILTER_SPACE_TEST}
0157 )
0158 target_compile_definitions(${URIFILTER_SPACE_TEST} PUBLIC "-DWEBSHORTCUT_SEPARATOR=' '")
0159
0160 # Same as kurlcompletiontest, but with immediate return, and results posted by thread later
0161 ecm_add_test(
0162 kurlcompletiontest.cpp
0163 TEST_NAME kurlcompletiontest-nowait
0164 NAME_PREFIX "kiowidgets-"
0165 LINK_LIBRARIES KF6::KIOCore KF6::KIOWidgets Qt6::Test
0166 )
0167 set_target_properties(kurlcompletiontest-nowait PROPERTIES COMPILE_FLAGS "-DNO_WAIT")
0168
0169
0170 endif()
0171
0172 if (TARGET KF6::KIOFileWidgets)
0173 include_directories(${CMAKE_SOURCE_DIR}/src/filewidgets ${CMAKE_BINARY_DIR}/src/filewidgets)
0174 ecm_add_tests(
0175 kurlnavigatortest.cpp
0176 kurlcomboboxtest.cpp
0177 kdiroperatortest.cpp
0178 kfilewidgettest.cpp
0179 kfilecustomdialogtest.cpp
0180 knewfilemenutest.cpp
0181 kfilecopytomenutest.cpp
0182 kfileplacesmodeltest.cpp
0183 kfileplacesviewtest.cpp
0184 kurlrequestertest.cpp
0185 kfilefiltercombotest.cpp
0186 NAME_PREFIX "kiofilewidgets-"
0187 LINK_LIBRARIES KF6::KIOFileWidgets KF6::KIOWidgets KF6::Bookmarks Qt6::Test KF6::I18n
0188 )
0189
0190 # TODO: fix symbol exports for windows -> 'KSambaShare::KSambaShare': inconsistent dll linkage
0191 if (NOT WIN32)
0192 ecm_add_test(
0193 ksambashareprivatetest.cpp
0194 ../src/core/ksambashare.cpp
0195 ../src/core/kiocoredebug.cpp
0196 TEST_NAME ksambashareprivatetest
0197 NAME_PREFIX "kiocore-"
0198 LINK_LIBRARIES KF6::KIOCore Qt6::Test Qt6::Network
0199 )
0200 endif()
0201
0202 set_tests_properties(kiofilewidgets-kfileplacesmodeltest PROPERTIES RUN_SERIAL TRUE)
0203 set_tests_properties(kiofilewidgets-kfileplacesviewtest PROPERTIES RUN_SERIAL TRUE)
0204 set_tests_properties(kiowidgets-kurifiltertest-space-separator PROPERTIES RUN_SERIAL TRUE)
0205 endif()
0206 endif()
0207
0208 # this should be done by cmake, see bug 371721
0209 if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
0210 set_property(TARGET jobtest APPEND PROPERTY AUTOMOC_MOC_OPTIONS --include ${CMAKE_BINARY_DIR}/src/core/moc_predefs.h)
0211 endif()
0212
0213 # Benchmark, compiled, but not run automatically with ctest
0214 add_executable(kcoredirlister_benchmark kcoredirlister_benchmark.cpp)
0215 target_link_libraries(kcoredirlister_benchmark KF6::KIOCore KF6::KIOWidgets Qt6::Test)
0216
0217 add_executable(udsentry_api_comparison_benchmark udsentry_api_comparison_benchmark.cpp)
0218 target_link_libraries(udsentry_api_comparison_benchmark KF6::KIOCore KF6::KIOWidgets Qt6::Test)
0219
0220 add_executable(udsentry_benchmark udsentry_benchmark.cpp)
0221 target_link_libraries(udsentry_benchmark KF6::KIOCore KF6::KIOWidgets Qt6::Test)