Warning, /frameworks/kservice/autotests/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 include(ECMAddTests)
0002 
0003 ########### unittests ###############
0004 
0005 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} CONFIG REQUIRED Concurrent Test)
0006 
0007 macro(KSERVICE_UNIT_TESTS)
0008   foreach(_testname ${ARGN})
0009     ecm_add_test(${_testname}.cpp TEST_NAME ${_testname}
0010         LINK_LIBRARIES KF5::Service Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Concurrent KF5::ConfigCore KF5::CoreAddons Qt${QT_MAJOR_VERSION}::Xml)
0011     target_compile_definitions(${_testname} PRIVATE -DKBUILDSYCOCAEXE=\"$<TARGET_FILE:kbuildsycoca5>\")
0012   endforeach()
0013 endmacro(KSERVICE_UNIT_TESTS)
0014 
0015 kservice_unit_tests(
0016  ksycocatest
0017  ksycoca_xdgdirstest
0018  ksycocadicttest
0019  ksycocathreadtest
0020  kservicetest
0021  kapplicationtradertest
0022 )
0023 
0024 if(UNIX AND
0025   NOT EXCLUDE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT" AND
0026    EXCLUDE_DEPRECATED_BEFORE_AND_AT VERSION_LESS 5.89.0)
0027   kservice_unit_tests(ktoolinvocation_x11test)
0028 endif()
0029 
0030 if(NOT EXCLUDE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT" AND
0031    EXCLUDE_DEPRECATED_BEFORE_AND_AT VERSION_LESS 5.82.0)
0032    kservice_unit_tests(kplugintradertest)
0033 endif()
0034 if(NOT EXCLUDE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT" AND
0035    EXCLUDE_DEPRECATED_BEFORE_AND_AT VERSION_LESS 5.87.0)
0036    kservice_unit_tests(kautostarttest)
0037 endif()
0038 
0039 # the test plays with the timestamp of ~/.qttest/share/kservicetypes5, and with the ksycoca file, other tests can collide
0040 set_tests_properties(ksycocatest PROPERTIES RUN_SERIAL TRUE)
0041 # KServiceTest::testAllServices can fail if any service is deleted while the test runs
0042 set_tests_properties(kservicetest PROPERTIES RUN_SERIAL TRUE)
0043 # This test deletes ~/.qttest/share/applications
0044 set_tests_properties(kapplicationtradertest PROPERTIES RUN_SERIAL TRUE)
0045 
0046 target_sources(kapplicationtradertest PUBLIC
0047   ${CMAKE_CURRENT_SOURCE_DIR}/../src/services/ktraderparsetree.cpp
0048 )
0049 
0050 if(NOT EXCLUDE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT" AND
0051    EXCLUDE_DEPRECATED_BEFORE_AND_AT VERSION_LESS 5.90.0)
0052     kservice_unit_tests(kplugininfotest)
0053 
0054     add_library(fakeplugin MODULE nsaplugin.cpp)
0055     ecm_mark_as_test(fakeplugin)
0056     target_link_libraries(fakeplugin KF5::Service)
0057 
0058 
0059     # generate new-style and old-style JSON from the .desktop file
0060     file(COPY fakeplugin.desktop DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
0061     file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/fakeplugin.desktop ${CMAKE_CURRENT_BINARY_DIR}/fakeplugin_json_old.desktop)
0062     kcoreaddons_desktop_to_json(fakeplugin ${CMAKE_CURRENT_BINARY_DIR}/fakeplugin_json_old.desktop COMPAT_MODE)
0063 
0064     file(COPY fakeplugin.desktop DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
0065     file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/fakeplugin.desktop ${CMAKE_CURRENT_BINARY_DIR}/fakeplugin_json_new.desktop)
0066     kcoreaddons_desktop_to_json(fakeplugin ${CMAKE_CURRENT_BINARY_DIR}/fakeplugin_json_new.desktop)
0067 endif()
0068 
0069 ######### kmimeassociationstest ########
0070 
0071 set(kmimeassociationstest_SRCS kmimeassociationstest.cpp ../src/sycoca/kmimeassociations.cpp)
0072 ecm_qt_declare_logging_category(kmimeassociationstest_SRCS
0073     HEADER sycocadebug.h
0074     IDENTIFIER SYCOCA
0075     CATEGORY_NAME kf.service.sycoca
0076 )
0077 
0078 ecm_add_test(${kmimeassociationstest_SRCS} TEST_NAME kmimeassociationstest
0079              LINK_LIBRARIES KF5::Service Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Xml KF5::ConfigCore KF5::CoreAddons)
0080