diff --git a/autotests/libxrenderutils/blendpicture_test.cpp b/autotests/libxrenderutils/blendpicture_test.cpp
index d00ad3df7b..5cf3239f0c 100644
--- a/autotests/libxrenderutils/blendpicture_test.cpp
+++ b/autotests/libxrenderutils/blendpicture_test.cpp
@@ -21,6 +21,7 @@ along with this program. If not, see .
#include
#include
+#include "../testutils.h"
#include "../../libkwineffects/kwinxrenderutils.h"
class BlendPictureTest : public QObject
@@ -55,5 +56,6 @@ void BlendPictureTest::testDontCrashOnTeardown()
Q_UNUSED(picture2)
}
+Q_CONSTRUCTOR_FUNCTION(forceXcb)
QTEST_MAIN(BlendPictureTest)
#include "blendpicture_test.moc"
diff --git a/autotests/tabbox/test_tabbox_clientmodel.cpp b/autotests/tabbox/test_tabbox_clientmodel.cpp
index 72109a29d6..f7b94a62f7 100644
--- a/autotests/tabbox/test_tabbox_clientmodel.cpp
+++ b/autotests/tabbox/test_tabbox_clientmodel.cpp
@@ -20,6 +20,7 @@ along with this program. If not, see .
#include "test_tabbox_clientmodel.h"
#include "mock_tabboxhandler.h"
#include "clientmodel.h"
+#include "../testutils.h"
#include
#include
@@ -89,4 +90,5 @@ void TestTabBoxClientModel::testCreateClientListActiveClientNotInFocusChain()
QCOMPARE(clientModel->rowCount(), 1);
}
+Q_CONSTRUCTOR_FUNCTION(forceXcb)
QTEST_MAIN(TestTabBoxClientModel)
diff --git a/autotests/tabbox/test_tabbox_handler.cpp b/autotests/tabbox/test_tabbox_handler.cpp
index b3ed194c31..83e92c4f96 100644
--- a/autotests/tabbox/test_tabbox_handler.cpp
+++ b/autotests/tabbox/test_tabbox_handler.cpp
@@ -19,6 +19,7 @@ along with this program. If not, see .
*********************************************************************/
#include "mock_tabboxhandler.h"
#include "clientmodel.h"
+#include "../testutils.h"
#include
#include
@@ -56,6 +57,7 @@ void TestTabBoxHandler::testDontCrashUpdateOutlineNullClient()
tabboxhandler.show();
}
+Q_CONSTRUCTOR_FUNCTION(forceXcb)
QTEST_MAIN(TestTabBoxHandler)
#include "test_tabbox_handler.moc"
diff --git a/autotests/test_builtin_effectloader.cpp b/autotests/test_builtin_effectloader.cpp
index 689cd2b58a..0f3dab7898 100644
--- a/autotests/test_builtin_effectloader.cpp
+++ b/autotests/test_builtin_effectloader.cpp
@@ -21,6 +21,7 @@ along with this program. If not, see .
#include "../effects/effect_builtins.h"
#include "mock_effectshandler.h"
#include "../scripting/scriptedeffect.h" // for mocking ScriptedEffect::create
+#include "testutils.h"
// KDE
#include
#include
@@ -563,5 +564,6 @@ void TestBuiltInEffectLoader::testLoadAllEffects()
QCOMPARE(loadedEffects.at(1), QStringLiteral("mouseclick"));
}
+Q_CONSTRUCTOR_FUNCTION(forceXcb)
QTEST_MAIN(TestBuiltInEffectLoader)
#include "test_builtin_effectloader.moc"
diff --git a/autotests/test_client_machine.cpp b/autotests/test_client_machine.cpp
index cc37350c74..e862473701 100644
--- a/autotests/test_client_machine.cpp
+++ b/autotests/test_client_machine.cpp
@@ -151,5 +151,6 @@ void TestClientMachine::emptyHostName()
QCOMPARE(spy.isEmpty(), false);
}
+Q_CONSTRUCTOR_FUNCTION(forceXcb)
QTEST_MAIN(TestClientMachine)
#include "test_client_machine.moc"
diff --git a/autotests/test_screen_edges.cpp b/autotests/test_screen_edges.cpp
index ec4a845c19..87017bd717 100644
--- a/autotests/test_screen_edges.cpp
+++ b/autotests/test_screen_edges.cpp
@@ -30,6 +30,7 @@ along with this program. If not, see .
#include "mock_client.h"
#include "mock_screens.h"
#include "mock_workspace.h"
+#include "testutils.h"
// Frameworks
#include
// Qt
@@ -861,5 +862,6 @@ void TestScreenEdges::testClientEdge()
QCOMPARE(Cursor::pos(), QPoint(1, 50));
}
+Q_CONSTRUCTOR_FUNCTION(forceXcb)
QTEST_MAIN(TestScreenEdges)
#include "test_screen_edges.moc"
diff --git a/autotests/test_xcb_size_hints.cpp b/autotests/test_xcb_size_hints.cpp
index 1c00096666..e759943a57 100644
--- a/autotests/test_xcb_size_hints.cpp
+++ b/autotests/test_xcb_size_hints.cpp
@@ -371,5 +371,6 @@ void TestXcbSizeHints::geometryHintsBeforeRead()
QCOMPARE(hints.windowGravity(), XCB_GRAVITY_NORTH_WEST);
}
+Q_CONSTRUCTOR_FUNCTION(forceXcb)
QTEST_MAIN(TestXcbSizeHints)
#include "test_xcb_size_hints.moc"
diff --git a/autotests/test_xcb_window.cpp b/autotests/test_xcb_window.cpp
index 8b1ec4a5b4..339be675a4 100644
--- a/autotests/test_xcb_window.cpp
+++ b/autotests/test_xcb_window.cpp
@@ -207,5 +207,6 @@ void TestXcbWindow::destroyNotManaged()
QVERIFY(attribs);
}
+Q_CONSTRUCTOR_FUNCTION(forceXcb)
QTEST_MAIN(TestXcbWindow)
#include "test_xcb_window.moc"
diff --git a/autotests/test_xcb_wrapper.cpp b/autotests/test_xcb_wrapper.cpp
index 4c14cde432..a1e312c3fe 100644
--- a/autotests/test_xcb_wrapper.cpp
+++ b/autotests/test_xcb_wrapper.cpp
@@ -525,5 +525,6 @@ void TestXcbWrapper::testMotif()
QTEST(hints.close(), "expectedClose");
}
+Q_CONSTRUCTOR_FUNCTION(forceXcb)
QTEST_MAIN(TestXcbWrapper)
#include "test_xcb_wrapper.moc"
diff --git a/autotests/testutils.h b/autotests/testutils.h
index 7fff8c49b5..2b5e5450ed 100644
--- a/autotests/testutils.h
+++ b/autotests/testutils.h
@@ -24,6 +24,12 @@ along with this program. If not, see .
// XCB
#include
+namespace {
+ static void forceXcb() {
+ qputenv("QT_QPA_PLATFORM", QByteArrayLiteral("xcb"));
+ }
+}
+
namespace KWin {
/**