Warning, /plasma/plasma-integration/qt6/autotests/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 include(ECMMarkAsTest)
0002 include(ECMMarkNonGuiExecutable)
0003 
0004 find_package(Qt6Test ${QT_MIN_VERSION} CONFIG QUIET)
0005 find_package(Qt6Qml ${QT_MIN_VERSION} CONFIG QUIET)
0006 find_package(Qt6QmlTools ${QT_MIN_VERSION} CONFIG QUIET) # qmltestrunner
0007 
0008 if(NOT Qt6Test_FOUND)
0009     message(STATUS "Qt6Test not found, autotests will not be built.")
0010     return()
0011 endif()
0012 
0013 if(NOT Qt6Qml_FOUND)
0014     message(STATUS "Qt6Qml not found, QML autotests will not be built.")
0015 endif()
0016 
0017 set(CONFIGFILE "${CMAKE_CURRENT_SOURCE_DIR}/kdeplatformtheme_kdeglobals")
0018 set(CHANGED_CONFIGFILE "${CMAKE_CURRENT_SOURCE_DIR}/kdeplatformtheme_changed_kdeglobals")
0019 configure_file(kdeplatformtheme_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/kdeplatformtheme_config.h)
0020 
0021 remove_definitions(-DQT_NO_CAST_FROM_ASCII)
0022 # qdbusmenubar uses them
0023 remove_definitions(-DQT_NO_SIGNALS_SLOTS_KEYWORDS)
0024 
0025 macro(FRAMEWORKINTEGRATION_TESTS _testname)
0026     add_executable(${_testname}6 ${_testname}.cpp ${ARGN})
0027     set_target_properties(${_testname}6 PROPERTIES COMPILE_FLAGS "-DUNIT_TEST")
0028     add_test(NAME frameworkintegration-${_testname}6 COMMAND ${_testname}6)
0029     ecm_mark_as_test(${_testname}6)
0030     ecm_mark_nongui_executable(${_testname}6)
0031     target_include_directories(${_testname}6 PRIVATE ${CMAKE_BINARY_DIR}/qt6/src/platformtheme)
0032     target_link_libraries(${_testname}6
0033         Qt6::GuiPrivate
0034         Qt6::Test
0035         Qt6::DBus
0036         Qt6::QuickControls2
0037         ${QT5PLATFORMSUPPORT_LIBS}
0038         KF6::ConfigWidgets
0039         KF6::ConfigCore
0040         KF6::IconThemes
0041         KF6::KIOFileWidgets
0042         KF6::I18n
0043         KF6::Notifications
0044         KF6::StatusNotifierItem
0045         KF6::WindowSystem
0046         KF6::GuiAddons
0047         Qt6::WaylandClient
0048         XCB::XCB
0049         Wayland::Client
0050         KF6::XmlGui
0051     )
0052     if (QT_MAJOR_VERSION EQUAL "5")
0053         target_link_libraries(${_testname} Qt5::X11Extras)
0054     endif()
0055 endmacro()
0056 
0057 set(dbus_interface)
0058 qt6_add_dbus_interface(dbus_interface ../src/platformtheme/org.kde.StatusNotifierWatcher.xml statusnotifierwatcher_interface)
0059 
0060 frameworkintegration_tests(
0061     kdeplatformtheme_unittest
0062 )
0063 set(wayland_interfaces)
0064 qt6_generate_wayland_protocol_client_sources(kdeplatformtheme_unittest6 FILES
0065     ${PLASMA_WAYLAND_PROTOCOLS_DIR}/appmenu.xml
0066     ${PLASMA_WAYLAND_PROTOCOLS_DIR}/server-decoration-palette.xml
0067 )
0068 
0069 target_sources(kdeplatformtheme_unittest6 PRIVATE
0070   ../src/platformtheme/kdeplatformtheme.cpp ../src/platformtheme/kdeplatformtheme.h
0071   ../src/platformtheme/kfontsettingsdata.cpp ../src/platformtheme/kfontsettingsdata.h
0072   ../src/platformtheme/khintssettings.cpp ../src/platformtheme/khintssettings.h
0073   ../src/platformtheme/kdeplatformfiledialoghelper.cpp ../src/platformtheme/kdeplatformfiledialoghelper.h
0074   ../src/platformtheme/kdeplatformfiledialogbase.cpp
0075   ../src/platformtheme/kdeplatformfontdialoghelper.cpp
0076   ../src/platformtheme/kdeplatformsystemtrayicon.cpp ../src/platformtheme/kdeplatformsystemtrayicon.h
0077   ../src/platformtheme/kdirselectdialog.cpp
0078   ../src/platformtheme/kfiletreeview.cpp
0079   ../src/platformtheme/kwaylandintegration.cpp ../src/platformtheme/kwaylandintegration.h
0080   ../src/platformtheme/x11integration.cpp ../src/platformtheme/x11integration.h
0081   ../src/platformtheme/qxdgdesktopportalfiledialog.cpp
0082   ../src/platformtheme/qdbusmenubarwrapper.h
0083   ${dbus_interface}
0084   ${wayland_interfaces}
0085 )
0086 # TODO KF6 Port D-Bus menu support
0087 target_compile_definitions(kdeplatformtheme_unittest6 PRIVATE -DKF6_TODO_DBUS_MENUBAR)
0088 
0089 frameworkintegration_tests(
0090   kfontsettingsdata_unittest
0091   ../src/platformtheme/kfontsettingsdata.cpp ../src/platformtheme/kfontsettingsdata.h
0092 )
0093 
0094 frameworkintegration_tests(
0095   kfiledialog_unittest
0096 )
0097 
0098 frameworkintegration_tests(
0099   ksni_unittest
0100 )
0101 
0102 frameworkintegration_tests(
0103   kdeplatformsystemtrayicon_unittest
0104   ../src/platformtheme/kdeplatformsystemtrayicon.cpp ../src/platformtheme/kdeplatformsystemtrayicon.h
0105   ${dbus_interface}
0106 )
0107 
0108 frameworkintegration_tests(
0109   kdirselectdialog_unittest
0110   ../src/platformtheme/kdeplatformfiledialogbase.cpp
0111   ../src/platformtheme/kdirselectdialog.cpp
0112   ../src/platformtheme/kfiletreeview.cpp
0113 )
0114 
0115 frameworkintegration_tests(
0116   khintssettings_unittest
0117   ../src/platformtheme/khintssettings.cpp ../src/platformtheme/khintssettings.h
0118 )
0119 
0120 if(Qt6Qml_FOUND AND TARGET Qt6::qmltestrunner)
0121     add_test(NAME qmltests6 COMMAND Qt6::qmltestrunner WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
0122 
0123     frameworkintegration_tests(kfiledialogqml_unittest)
0124     target_link_libraries(kfiledialogqml_unittest6 Qt6::Qml)
0125 endif()