Commit bf7c6704 authored by Martin Flöser's avatar Martin Flöser

[autotests] Wrap integration tests in dbus-session-run

Each test needs a dedicated dbus session as the test needs to register
services (e.g. kglobalaccel) and might fail if that cannot be registered.

Due to the wrapping in another command the test need to make sure that
any process they start terminates before them. E.g. the activities test
must stop kactivitymanagerd in cleanupTestCase, otherwise the test times
out.
parent a69300f7
......@@ -11,7 +11,7 @@ function(integrationTest)
cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
add_executable(${ARGS_NAME} ${ARGS_SRCS})
target_link_libraries(${ARGS_NAME} KWinIntegrationTestFramework kwin Qt5::Test ${ARGS_LIBS})
add_test(kwin-${ARGS_NAME} ${ARGS_NAME})
add_test(NAME kwin-${ARGS_NAME} COMMAND dbus-run-session ${CMAKE_CURRENT_BINARY_DIR}/${ARGS_NAME})
endfunction()
integrationTest(NAME testStart SRCS start_test.cpp)
......
......@@ -44,6 +44,7 @@ class ActivitiesTest : public QObject
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
void testSetOnActivitiesValidates();
......@@ -72,6 +73,11 @@ void ActivitiesTest::initTestCase()
waylandServer()->initWorkspace();
}
void ActivitiesTest::cleanupTestCase()
{
QProcess::execute(QStringLiteral("kactivitymanagerd"), QStringList{QStringLiteral("stop")});
}
void ActivitiesTest::init()
{
screens()->setCurrent(0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment