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

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