autotests: Remove Test::initWaylandWorkspace()

It reduces the amount of boilerplate code and makes startup sequence in
autotests similar to the one in kwin_wayland.
This commit is contained in:
Vlad Zahorodnii 2022-07-30 18:12:36 +03:00 committed by David Edmundson
parent 84bde36cc0
commit e24ee60bb2
62 changed files with 2 additions and 68 deletions

View file

@ -60,7 +60,6 @@ void ActivationTest::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
void ActivationTest::init()

View file

@ -62,7 +62,6 @@ void ActivitiesTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
}
void ActivitiesTest::cleanupTestCase()

View file

@ -65,7 +65,6 @@ void TestDbusInterface::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
VirtualDesktopManager::self()->setCount(4);
}

View file

@ -62,7 +62,6 @@ void DebugConsoleTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
}
void DebugConsoleTest::cleanup()

View file

@ -143,7 +143,6 @@ void DecorationInputTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
}
void DecorationInputTest::init()

View file

@ -56,7 +56,6 @@ void X11DesktopWindowTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
}
void X11DesktopWindowTest::init()

View file

@ -62,7 +62,6 @@ void DontCrashAuroraeDestroyDecoTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
QCOMPARE(Compositor::self()->backend()->compositingType(), KWin::OpenGLCompositing);
}

View file

@ -71,7 +71,6 @@ void DontCrashCursorPhysicalSizeEmpty::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
}
void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco()

View file

@ -54,7 +54,6 @@ void DontCrashEmptyDecorationTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
QCOMPARE(Compositor::self()->backend()->compositingType(), KWin::OpenGLCompositing);
}

View file

@ -63,7 +63,6 @@ void DontCrashNoBorder::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
QCOMPARE(Compositor::self()->backend()->compositingType(), KWin::OpenGLCompositing);
}

View file

@ -70,7 +70,6 @@ void DontCrashReinitializeCompositorTest::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
QCOMPARE(Compositor::self()->backend()->compositingType(), KWin::OpenGLCompositing);
}

View file

@ -62,7 +62,6 @@ void TestDontCrashUseractionsMenu::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
void TestDontCrashUseractionsMenu::init()

View file

@ -62,7 +62,6 @@ void DesktopSwitchingAnimationTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
QCOMPARE(Compositor::self()->backend()->compositingType(), KWin::OpenGLCompositing);
}

View file

@ -59,7 +59,6 @@ void MaximizeAnimationTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
}
void MaximizeAnimationTest::init()

View file

@ -63,7 +63,6 @@ void MinimizeAnimationTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
QCOMPARE(Compositor::self()->backend()->compositingType(), KWin::OpenGLCompositing);
}

View file

@ -68,7 +68,6 @@ void PopupOpenCloseAnimationTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
}
void PopupOpenCloseAnimationTest::init()

View file

@ -65,7 +65,6 @@ void ToplevelOpenCloseAnimationTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
QCOMPARE(Compositor::self()->backend()->compositingType(), KWin::OpenGLCompositing);
}

View file

@ -69,7 +69,6 @@ void GlobalShortcutsTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
}
void GlobalShortcutsTest::init()

View file

@ -48,7 +48,6 @@ void TestIdleInhibition::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
}
void TestIdleInhibition::init()

View file

@ -62,7 +62,6 @@ void InputStackingOrderTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
}
void InputStackingOrderTest::init()

View file

@ -93,7 +93,6 @@ void InputMethodTest::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
void InputMethodTest::init()

View file

@ -192,7 +192,6 @@ void InternalWindowTest::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
void InternalWindowTest::init()

View file

@ -146,7 +146,6 @@ void KeyboardLayoutTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
// don't get DBus signal on one-layout configuration
// QVERIFY(layoutsReconfiguredSpy.wait());

View file

@ -63,7 +63,6 @@ void KeymapCreationFailureTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
}
void KeymapCreationFailureTest::init()

View file

@ -169,6 +169,8 @@ void WaylandTestApplication::continueStartupWithScene()
createWorkspace();
createPlugins();
waylandServer()->initWorkspace();
if (!waylandServer()->start()) {
qFatal("Failed to initialize the Wayland server, exiting now");
}

View file

@ -654,8 +654,6 @@ bool lockScreen();
*/
bool unlockScreen();
void initWaylandWorkspace();
Window *inputPanelWindow();
MockInputMethod *inputMethod();
KWayland::Client::Surface *inputPanelSurface();

View file

@ -55,7 +55,6 @@ void KWinBindingsTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
}
void KWinBindingsTest::init()

View file

@ -65,7 +65,6 @@ void LayerShellV1WindowTest::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
void LayerShellV1WindowTest::init()

View file

@ -192,7 +192,6 @@ void LockScreenTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
QCOMPARE(Compositor::self()->backend()->compositingType(), KWin::OpenGLCompositing);
}

View file

@ -62,7 +62,6 @@ void TestMaximized::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
void TestMaximized::init()

View file

@ -92,7 +92,6 @@ void ModifierOnlyShortcutTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
}
void ModifierOnlyShortcutTest::init()

View file

@ -43,7 +43,6 @@ void NightColorTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
NightColorManager *manager = NightColorManager::self();
QVERIFY(manager);

View file

@ -100,7 +100,6 @@ void NoGlobalShortcutsTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
}
void NoGlobalShortcutsTest::init()

View file

@ -51,7 +51,6 @@ void OutputChangesTest::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
void OutputChangesTest::init()

View file

@ -91,7 +91,6 @@ void TestPlacement::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
void TestPlacement::setPlacementPolicy(Placement::Policy policy)

View file

@ -73,7 +73,6 @@ void PlasmaWindowTest::initTestCase()
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
setenv("QMLSCENE_DEVICE", "softwarecontext", true);
Test::initWaylandWorkspace();
}
void PlasmaWindowTest::init()

View file

@ -78,7 +78,6 @@ void TestPointerConstraints::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
void TestPointerConstraints::init()

View file

@ -158,7 +158,6 @@ void PointerInputTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
}
void PointerInputTest::init()

View file

@ -45,7 +45,6 @@ void ScreenChangesTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
}
void ScreenChangesTest::init()

View file

@ -63,7 +63,6 @@ void ScreenEdgeClientShowTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
}
void ScreenEdgeClientShowTest::init()

View file

@ -85,7 +85,6 @@ void ScreenEdgesTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
}
void ScreenEdgesTest::init()

View file

@ -60,7 +60,6 @@ void ScreensTest::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
void ScreensTest::init()

View file

@ -57,7 +57,6 @@ void MinimizeAllScriptTest::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
static QString locateMainScript(const QString &pluginName)

View file

@ -51,7 +51,6 @@ void ShadeTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
}
void ShadeTest::init()

View file

@ -43,7 +43,6 @@ void ShowingDesktopTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
}
void ShowingDesktopTest::init()

View file

@ -64,7 +64,6 @@ void StackingOrderTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
}
void StackingOrderTest::init()

View file

@ -80,7 +80,6 @@ void StrutsTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
}
void StrutsTest::init()

View file

@ -55,7 +55,6 @@ void TabBoxTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
}
void TabBoxTest::init()

View file

@ -969,13 +969,6 @@ bool unlockScreen()
}
#endif // KWIN_BUILD_LOCKSCREEN
void initWaylandWorkspace()
{
QSignalSpy workspaceInitializedSpy(waylandServer(), &WaylandServer::initialized);
waylandServer()->initWorkspace();
QVERIFY(workspaceInitializedSpy.count() || workspaceInitializedSpy.wait());
}
WaylandOutputManagementV2::WaylandOutputManagementV2(struct ::wl_registry *registry, int id, int version)
: QObject()
, QtWayland::kde_output_management_v2()

View file

@ -52,7 +52,6 @@ void VirtualKeyboardDBusTest::initTestCase()
static_cast<WaylandTestApplication *>(kwinApp())->setInputMethodServerToStart("internal");
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
QVERIFY(setupWaylandConnection(AdditionalWaylandInterface::Seat | AdditionalWaylandInterface::InputMethodV1 | AdditionalWaylandInterface::TextInputManagerV2 | AdditionalWaylandInterface::TextInputManagerV3));
}

View file

@ -63,7 +63,6 @@ void TouchInputTest::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
void TouchInputTest::init()

View file

@ -74,7 +74,6 @@ void TransientPlacementTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
}
void TransientPlacementTest::init()

View file

@ -50,7 +50,6 @@ void VirtualDesktopTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
if (kwinApp()->x11Connection()) {
// verify the current desktop x11 property on startup, see BUG: 391034

View file

@ -55,7 +55,6 @@ void WindowRuleTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
}
void WindowRuleTest::init()

View file

@ -67,7 +67,6 @@ void TestWindowSelection::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
void TestWindowSelection::init()

View file

@ -74,7 +74,6 @@ void X11WindowTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
QVERIFY(KWin::Compositor::self());
Test::initWaylandWorkspace();
}
void X11WindowTest::init()

View file

@ -190,7 +190,6 @@ void TestXdgShellWindowRules::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
m_config = KSharedConfig::openConfig(QStringLiteral("kwinrulesrc"), KConfig::SimpleConfig);
workspace()->rulebook()->setConfig(m_config);

View file

@ -180,7 +180,6 @@ void TestXdgShellWindow::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
void TestXdgShellWindow::init()

View file

@ -54,7 +54,6 @@ void XWaylandInputTest::initTestCase()
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
setenv("QT_QPA_PLATFORM", "wayland", true);
Test::initWaylandWorkspace();
}
void XWaylandInputTest::init()

View file

@ -63,7 +63,6 @@ void XwaylandSelectionsTest::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
// // wait till the xclipboard sync data device is created
// if (clipboardSyncDevicedCreated.empty()) {
// QVERIFY(clipboardSyncDevicedCreated.wait());

View file

@ -64,7 +64,6 @@ void XwaylandServerCrashTest::initTestCase()
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
Test::initWaylandWorkspace();
}
void XwaylandServerCrashTest::testCrash()

View file

@ -56,7 +56,6 @@ void XwaylandServerRestartTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
Test::initWaylandWorkspace();
}
static void kwin_safe_kill(QProcess *process)