autotests: Fix Test::waitForWindowDestroyed

Before Deleted merge, it used to be equivalent to waiting until the
window is closed.

This fixes tests waiting until the window closing animation completes
and the Window object is destroyed.
This commit is contained in:
Vlad Zahorodnii 2023-04-21 23:28:48 +03:00
parent 9852748a84
commit e0da725533
30 changed files with 136 additions and 136 deletions

View file

@ -132,13 +132,13 @@ void ActivationTest::testSwitchToWindowToLeft()
// Destroy all windows.
shellSurface1.reset();
QVERIFY(Test::waitForWindowDestroyed(window1));
QVERIFY(Test::waitForWindowClosed(window1));
shellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
shellSurface3.reset();
QVERIFY(Test::waitForWindowDestroyed(window3));
QVERIFY(Test::waitForWindowClosed(window3));
shellSurface4.reset();
QVERIFY(Test::waitForWindowDestroyed(window4));
QVERIFY(Test::waitForWindowClosed(window4));
}
void ActivationTest::testSwitchToWindowToRight()
@ -198,13 +198,13 @@ void ActivationTest::testSwitchToWindowToRight()
// Destroy all windows.
shellSurface1.reset();
QVERIFY(Test::waitForWindowDestroyed(window1));
QVERIFY(Test::waitForWindowClosed(window1));
shellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
shellSurface3.reset();
QVERIFY(Test::waitForWindowDestroyed(window3));
QVERIFY(Test::waitForWindowClosed(window3));
shellSurface4.reset();
QVERIFY(Test::waitForWindowDestroyed(window4));
QVERIFY(Test::waitForWindowClosed(window4));
}
void ActivationTest::testSwitchToWindowAbove()
@ -264,13 +264,13 @@ void ActivationTest::testSwitchToWindowAbove()
// Destroy all windows.
shellSurface1.reset();
QVERIFY(Test::waitForWindowDestroyed(window1));
QVERIFY(Test::waitForWindowClosed(window1));
shellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
shellSurface3.reset();
QVERIFY(Test::waitForWindowDestroyed(window3));
QVERIFY(Test::waitForWindowClosed(window3));
shellSurface4.reset();
QVERIFY(Test::waitForWindowDestroyed(window4));
QVERIFY(Test::waitForWindowClosed(window4));
}
void ActivationTest::testSwitchToWindowBelow()
@ -330,13 +330,13 @@ void ActivationTest::testSwitchToWindowBelow()
// Destroy all windows.
shellSurface1.reset();
QVERIFY(Test::waitForWindowDestroyed(window1));
QVERIFY(Test::waitForWindowClosed(window1));
shellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
shellSurface3.reset();
QVERIFY(Test::waitForWindowDestroyed(window3));
QVERIFY(Test::waitForWindowClosed(window3));
shellSurface4.reset();
QVERIFY(Test::waitForWindowDestroyed(window4));
QVERIFY(Test::waitForWindowClosed(window4));
}
void ActivationTest::testSwitchToWindowMaximized()
@ -413,13 +413,13 @@ void ActivationTest::testSwitchToWindowMaximized()
// Destroy all windows.
shellSurface1.reset();
QVERIFY(Test::waitForWindowDestroyed(window1));
QVERIFY(Test::waitForWindowClosed(window1));
shellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
shellSurface3.reset();
QVERIFY(Test::waitForWindowDestroyed(window3));
QVERIFY(Test::waitForWindowClosed(window3));
shellSurface4.reset();
QVERIFY(Test::waitForWindowDestroyed(window4));
QVERIFY(Test::waitForWindowClosed(window4));
}
void ActivationTest::testSwitchToWindowFullScreen()
@ -496,13 +496,13 @@ void ActivationTest::testSwitchToWindowFullScreen()
// Destroy all windows.
shellSurface1.reset();
QVERIFY(Test::waitForWindowDestroyed(window1));
QVERIFY(Test::waitForWindowClosed(window1));
shellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
shellSurface3.reset();
QVERIFY(Test::waitForWindowDestroyed(window3));
QVERIFY(Test::waitForWindowClosed(window3));
shellSurface4.reset();
QVERIFY(Test::waitForWindowDestroyed(window4));
QVERIFY(Test::waitForWindowClosed(window4));
}
void ActivationTest::stackScreensHorizontally()

View file

@ -776,7 +776,7 @@ void DecorationInputTest::testTooltipDoesntEatKeyEvents()
QVERIFY(keyEvent.wait());
window->decoratedClient()->requestHideToolTip();
Test::waitForWindowDestroyed(internal);
Test::waitForWindowClosed(internal);
}
}

View file

@ -138,7 +138,7 @@ void DesktopSwitchingAnimationTest::testSwitchDesktops()
// Destroy the test window.
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
WAYLANDTEST_MAIN(DesktopSwitchingAnimationTest)

View file

@ -177,7 +177,7 @@ void MaximizeAnimationTest::testMaximizeRestore()
// Destroy the test window.
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
WAYLANDTEST_MAIN(MaximizeAnimationTest)

View file

@ -165,11 +165,11 @@ void MinimizeAnimationTest::testMinimizeUnminimize()
// Destroy the panel.
panelSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(panel));
QVERIFY(Test::waitForWindowClosed(panel));
// Destroy the test window.
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
WAYLANDTEST_MAIN(MinimizeAnimationTest)

View file

@ -139,7 +139,7 @@ void PopupOpenCloseAnimationTest::testAnimatePopups()
// Destroy the main window.
mainWindowSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(mainWindow));
QVERIFY(Test::waitForWindowClosed(mainWindow));
}
void PopupOpenCloseAnimationTest::testAnimateUserActionsPopup()
@ -190,7 +190,7 @@ void PopupOpenCloseAnimationTest::testAnimateUserActionsPopup()
// Destroy the test window.
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void PopupOpenCloseAnimationTest::testAnimateDecorationTooltips()
@ -253,7 +253,7 @@ void PopupOpenCloseAnimationTest::testAnimateDecorationTooltips()
// Destroy the test window.
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
WAYLANDTEST_MAIN(PopupOpenCloseAnimationTest)

View file

@ -197,7 +197,7 @@ void ToplevelOpenCloseAnimationTest::testDontAnimatePopups()
// Destroy the main window.
mainWindowSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(mainWindow));
QVERIFY(Test::waitForWindowClosed(mainWindow));
}
WAYLANDTEST_MAIN(ToplevelOpenCloseAnimationTest)

View file

@ -370,7 +370,7 @@ void GlobalShortcutsTest::testWaylandWindowShortcut()
shellSurface.reset();
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
QTRY_VERIFY_WITH_TIMEOUT(workspace()->shortcutAvailable(seq), 500); // we need the try since KGlobalAccelPrivate::unregister is async
}

View file

@ -93,7 +93,7 @@ void TestIdleInhibition::testInhibit()
QCOMPARE(input()->idleInhibitors(), QList<Window *>{window});
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
QCOMPARE(input()->idleInhibitors(), QList<Window *>{});
}
@ -142,7 +142,7 @@ void TestIdleInhibition::testDontInhibitWhenNotOnCurrentDesktop()
// Destroy the test window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
QCOMPARE(input()->idleInhibitors(), QList<Window *>{});
}
@ -178,7 +178,7 @@ void TestIdleInhibition::testDontInhibitWhenMinimized()
// Destroy the test window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
QCOMPARE(input()->idleInhibitors(), QList<Window *>{});
}
@ -218,7 +218,7 @@ void TestIdleInhibition::testDontInhibitWhenUnmapped()
// Unmap the window.
surface->attachBuffer(KWayland::Client::Buffer::Ptr());
surface->commit(KWayland::Client::Surface::CommitFlag::None);
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
// The surface is no longer visible, so the compositor doesn't have to honor the
// idle inhibitor object.
@ -245,7 +245,7 @@ void TestIdleInhibition::testDontInhibitWhenUnmapped()
// Destroy the test window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
QCOMPARE(input()->idleInhibitors(), QList<Window *>{});
}
@ -294,7 +294,7 @@ void TestIdleInhibition::testDontInhibitWhenLeftCurrentDesktop()
// Destroy the test window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
QCOMPARE(input()->idleInhibitors(), QList<Window *>{});
}

View file

@ -170,7 +170,7 @@ void InputMethodTest::testOpenClose()
// Destroy the test window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void InputMethodTest::testEnableDisableV3()
@ -257,7 +257,7 @@ void InputMethodTest::testEnableActive()
// Destroy the test window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void InputMethodTest::testHidePanel()
@ -300,7 +300,7 @@ void InputMethodTest::testHidePanel()
// Destroy the test window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void InputMethodTest::testSwitchFocusedSurfaces()
@ -347,7 +347,7 @@ void InputMethodTest::testSwitchFocusedSurfaces()
// Destroy the test window.
for (int i = 0; i < windows.count(); ++i) {
delete toplevels[i];
QVERIFY(Test::waitForWindowDestroyed(windows[i]));
QVERIFY(Test::waitForWindowClosed(windows[i]));
}
}
@ -419,7 +419,7 @@ void InputMethodTest::testV2V3SameClient()
QVERIFY(!kwinApp()->inputMethod()->isActive());
toplevel.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void InputMethodTest::testV3Styling()

View file

@ -399,7 +399,7 @@ void InternalWindowTest::testKeyboardTriggersLeave()
// Destroy the test window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void InternalWindowTest::testTouch()

View file

@ -497,7 +497,7 @@ void KeyboardLayoutTest::testApplicationPolicy()
shellSurface2.reset();
surface2.reset();
QVERIFY(Test::waitForWindowDestroyed(c2));
QVERIFY(Test::waitForWindowClosed(c2));
QVERIFY(!layoutChangedSpy.wait(1000));
QCOMPARE(xkb->layoutName(), QStringLiteral("German (Neo 2)"));

View file

@ -670,7 +670,7 @@ Window *renderAndWaitForShown(KWayland::Client::Surface *surface, const QImage &
/**
* Waits for the @p window to be destroyed.
*/
bool waitForWindowDestroyed(Window *window);
bool waitForWindowClosed(Window *window);
/**
* Locks the screen and waits till the screen is locked.

View file

@ -117,7 +117,7 @@ void LayerShellV1WindowTest::testOutput()
// Destroy the window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void LayerShellV1WindowTest::testAnchor_data()
@ -178,7 +178,7 @@ void LayerShellV1WindowTest::testAnchor()
// Destroy the window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void LayerShellV1WindowTest::testMargins_data()
@ -249,7 +249,7 @@ void LayerShellV1WindowTest::testMargins()
// Destroy the window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void LayerShellV1WindowTest::testLayer_data()
@ -290,7 +290,7 @@ void LayerShellV1WindowTest::testLayer()
// Destroy the window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void LayerShellV1WindowTest::testPlacementArea_data()
@ -334,7 +334,7 @@ void LayerShellV1WindowTest::testPlacementArea()
// Destroy the window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void LayerShellV1WindowTest::testFill_data()
@ -384,7 +384,7 @@ void LayerShellV1WindowTest::testFill()
// Destroy the window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void LayerShellV1WindowTest::testStack()
@ -433,9 +433,9 @@ void LayerShellV1WindowTest::testStack()
// Destroy the window.
shellSurface1.reset();
QVERIFY(Test::waitForWindowDestroyed(window1));
QVERIFY(Test::waitForWindowClosed(window1));
shellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
}
void LayerShellV1WindowTest::testFocus()
@ -464,7 +464,7 @@ void LayerShellV1WindowTest::testFocus()
// Destroy the window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void LayerShellV1WindowTest::testActivate_data()
@ -510,7 +510,7 @@ void LayerShellV1WindowTest::testActivate()
// Destroy the window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void LayerShellV1WindowTest::testUnmap()
@ -535,7 +535,7 @@ void LayerShellV1WindowTest::testUnmap()
// Unmap the layer surface.
surface->attachBuffer(KWayland::Client::Buffer::Ptr());
surface->commit(KWayland::Client::Surface::CommitFlag::None);
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
// Notify the compositor that we want to map the layer surface.
shellSurface->set_size(280, 124);
@ -551,7 +551,7 @@ void LayerShellV1WindowTest::testUnmap()
// Destroy the window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
} // namespace KWin

View file

@ -157,7 +157,7 @@ void TestMaximized::testMaximizedPassedToDeco()
// Destroy the test window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestMaximized::testInitiallyMaximizedBorderless()
@ -207,7 +207,7 @@ void TestMaximized::testInitiallyMaximizedBorderless()
// Destroy the window.
shellSurface.reset();
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestMaximized::testBorderlessMaximizedWindow()
{
@ -295,7 +295,7 @@ void TestMaximized::testBorderlessMaximizedWindow()
// Destroy the window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestMaximized::testMaximizedGainFocusAndBeActivated()
@ -319,9 +319,9 @@ void TestMaximized::testMaximizedGainFocusAndBeActivated()
QCOMPARE(workspace()->stackingOrder(), (QList<Window *>{window2, window}));
xdgShellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
xdgShellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
}
WAYLANDTEST_MAIN(TestMaximized)

View file

@ -174,7 +174,7 @@ void MoveResizeWindowTest::testMove()
QCOMPARE(window->isInteractiveMove(), false);
QVERIFY(workspace()->moveResizeWindow() == nullptr);
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void MoveResizeWindowTest::testResize()
@ -297,7 +297,7 @@ void MoveResizeWindowTest::testResize()
// Destroy the client.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void MoveResizeWindowTest::testPackTo_data()
@ -333,7 +333,7 @@ void MoveResizeWindowTest::testPackTo()
QMetaObject::invokeMethod(workspace(), methodCall.toLocal8Bit().constData());
QTEST(window->frameGeometry(), "expectedGeometry");
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void MoveResizeWindowTest::testPackAgainstClient_data()
@ -505,7 +505,7 @@ void MoveResizeWindowTest::testPointerMoveEnd()
Test::pointerButtonReleased(additionalButton, timestamp++);
QVERIFY(!window->isInteractiveMove());
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void MoveResizeWindowTest::testClientSideMove()
{
@ -585,7 +585,7 @@ void MoveResizeWindowTest::testPlasmaShellSurfaceMovable()
QTEST(window->isMovableAcrossScreens(), "movableAcrossScreens");
QTEST(window->isResizable(), "resizable");
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void MoveResizeWindowTest::testNetMove()
@ -1028,7 +1028,7 @@ void MoveResizeWindowTest::testDestroyMoveClient()
// Let's pretend that the client crashed.
shellSurface.reset();
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
QCOMPARE(interactiveMoveResizeFinishedSpy.count(), 1);
QCOMPARE(workspace()->moveResizeWindow(), nullptr);
}
@ -1062,7 +1062,7 @@ void MoveResizeWindowTest::testDestroyResizeClient()
// Let's pretend that the client crashed.
shellSurface.reset();
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
QCOMPARE(interactiveMoveResizeFinishedSpy.count(), 1);
QCOMPARE(workspace()->moveResizeWindow(), nullptr);
}

View file

@ -233,7 +233,7 @@ void TestPlacement::testPlaceCentered()
QCOMPARE(window->frameGeometry(), QRect(590, 487, 100, 50));
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestPlacement::testPlaceUnderMouse()
@ -255,7 +255,7 @@ void TestPlacement::testPlaceUnderMouse()
QCOMPARE(window->frameGeometry(), QRect(150, 275, 100, 50));
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestPlacement::testPlaceZeroCornered()
@ -289,11 +289,11 @@ void TestPlacement::testPlaceZeroCornered()
QCOMPARE(window3->size(), QSize(100, 50));
shellSurface3.reset();
QVERIFY(Test::waitForWindowDestroyed(window3));
QVERIFY(Test::waitForWindowClosed(window3));
shellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
shellSurface1.reset();
QVERIFY(Test::waitForWindowDestroyed(window1));
QVERIFY(Test::waitForWindowClosed(window1));
}
void TestPlacement::testPlaceRandom()
@ -327,11 +327,11 @@ void TestPlacement::testPlaceRandom()
QCOMPARE(window3->size(), QSize(100, 50));
shellSurface3.reset();
QVERIFY(Test::waitForWindowDestroyed(window3));
QVERIFY(Test::waitForWindowClosed(window3));
shellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
shellSurface1.reset();
QVERIFY(Test::waitForWindowDestroyed(window1));
QVERIFY(Test::waitForWindowClosed(window1));
}
void TestPlacement::testFullscreen()
@ -401,11 +401,11 @@ void TestPlacement::testCascadeIfCovering()
QCOMPARE(window3->size(), QSize(100, 50));
shellSurface3.reset();
QVERIFY(Test::waitForWindowDestroyed(window3));
QVERIFY(Test::waitForWindowClosed(window3));
shellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
shellSurface1.reset();
QVERIFY(Test::waitForWindowDestroyed(window1));
QVERIFY(Test::waitForWindowClosed(window1));
}
void TestPlacement::testCascadeIfCoveringIgnoreNonCovering()
@ -432,9 +432,9 @@ void TestPlacement::testCascadeIfCoveringIgnoreNonCovering()
QCOMPARE(window2->size(), QSize(50, 50));
shellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
shellSurface1.reset();
QVERIFY(Test::waitForWindowDestroyed(window1));
QVERIFY(Test::waitForWindowClosed(window1));
}
void TestPlacement::testCascadeIfCoveringIgnoreOutOfArea()
@ -461,9 +461,9 @@ void TestPlacement::testCascadeIfCoveringIgnoreOutOfArea()
QCOMPARE(window2->size(), QSize(1280, 1024));
shellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
shellSurface1.reset();
QVERIFY(Test::waitForWindowDestroyed(window1));
QVERIFY(Test::waitForWindowClosed(window1));
}
void TestPlacement::testCascadeIfCoveringIgnoreAlreadyCovered()
@ -496,11 +496,11 @@ void TestPlacement::testCascadeIfCoveringIgnoreAlreadyCovered()
QCOMPARE(window3->size(), QSize(100, 50));
shellSurface3.reset();
QVERIFY(Test::waitForWindowDestroyed(window3));
QVERIFY(Test::waitForWindowClosed(window3));
shellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
shellSurface1.reset();
QVERIFY(Test::waitForWindowDestroyed(window1));
QVERIFY(Test::waitForWindowClosed(window1));
}
WAYLANDTEST_MAIN(TestPlacement)

View file

@ -231,9 +231,9 @@ void PlasmaWindowTest::testPopupWindowNoPlasmaWindow()
// let's destroy the windows
popupShellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(popupWindow));
QVERIFY(Test::waitForWindowClosed(popupWindow));
parentShellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(parentClient));
QVERIFY(Test::waitForWindowClosed(parentClient));
}
void PlasmaWindowTest::testLockScreenNoPlasmaWindow()

View file

@ -262,7 +262,7 @@ void TestPointerConstraints::testConfinedPointer()
// and now unmap
shellSurface.reset();
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
QCOMPARE(input()->pointer()->isConstrained(), false);
}

View file

@ -435,7 +435,7 @@ void PointerInputTest::testUpdateFocusOnDecorationDestroy()
// Destroy the window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void PointerInputTest::testModifierClickUnrestrictedMove_data()
@ -1749,7 +1749,7 @@ void PointerInputTest::testDefaultInputRegion()
// Destroy the test window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void PointerInputTest::testEmptyInputRegion()
@ -1772,7 +1772,7 @@ void PointerInputTest::testEmptyInputRegion()
// Destroy the test window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void PointerInputTest::testUnfocusedModifiers()
@ -1836,7 +1836,7 @@ void PointerInputTest::testUnfocusedModifiers()
// Destroy the Wayland window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(waylandWindow));
QVERIFY(Test::waitForWindowClosed(waylandWindow));
}
}

View file

@ -141,9 +141,9 @@ void MinimizeAllScriptTest::testMinimizeUnminimize()
// Destroy test windows.
shellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
shellSurface1.reset();
QVERIFY(Test::waitForWindowDestroyed(window1));
QVERIFY(Test::waitForWindowClosed(window1));
}
}

View file

@ -325,9 +325,9 @@ void StrutsTest::testWaylandMobilePanel()
// Destroy test windows.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
shellSurface2.reset();
QVERIFY(Test::waitForWindowDestroyed(c1));
QVERIFY(Test::waitForWindowClosed(c1));
}
void StrutsTest::testX11Struts_data()

View file

@ -122,11 +122,11 @@ void TabBoxTest::testCapsLock()
QCOMPARE(workspace()->activeWindow(), c2);
surface3.reset();
QVERIFY(Test::waitForWindowDestroyed(c3));
QVERIFY(Test::waitForWindowClosed(c3));
surface2.reset();
QVERIFY(Test::waitForWindowDestroyed(c2));
QVERIFY(Test::waitForWindowClosed(c2));
surface1.reset();
QVERIFY(Test::waitForWindowDestroyed(c1));
QVERIFY(Test::waitForWindowClosed(c1));
}
void TabBoxTest::testMoveForward()
@ -171,11 +171,11 @@ void TabBoxTest::testMoveForward()
QCOMPARE(workspace()->activeWindow(), c2);
surface3.reset();
QVERIFY(Test::waitForWindowDestroyed(c3));
QVERIFY(Test::waitForWindowClosed(c3));
surface2.reset();
QVERIFY(Test::waitForWindowDestroyed(c2));
QVERIFY(Test::waitForWindowClosed(c2));
surface1.reset();
QVERIFY(Test::waitForWindowDestroyed(c1));
QVERIFY(Test::waitForWindowClosed(c1));
}
void TabBoxTest::testMoveBackward()
@ -224,11 +224,11 @@ void TabBoxTest::testMoveBackward()
QCOMPARE(workspace()->activeWindow(), c1);
surface3.reset();
QVERIFY(Test::waitForWindowDestroyed(c3));
QVERIFY(Test::waitForWindowClosed(c3));
surface2.reset();
QVERIFY(Test::waitForWindowDestroyed(c2));
QVERIFY(Test::waitForWindowClosed(c2));
surface1.reset();
QVERIFY(Test::waitForWindowDestroyed(c1));
QVERIFY(Test::waitForWindowClosed(c1));
}
WAYLANDTEST_MAIN(TabBoxTest)

View file

@ -931,13 +931,13 @@ IdleInhibitorV1 *createIdleInhibitorV1(KWayland::Client::Surface *surface)
return new IdleInhibitorV1(manager, surface);
}
bool waitForWindowDestroyed(Window *window)
bool waitForWindowClosed(Window *window)
{
QSignalSpy destroyedSpy(window, &QObject::destroyed);
if (!destroyedSpy.isValid()) {
QSignalSpy closedSpy(window, &Window::closed);
if (!closedSpy.isValid()) {
return false;
}
return destroyedSpy.wait();
return closedSpy.wait();
}
#if KWIN_BUILD_SCREENLOCKER

View file

@ -351,7 +351,7 @@ void TouchInputTest::testUpdateFocusOnDecorationDestroy()
// Destroy the window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TouchInputTest::testGestureDetection()

View file

@ -519,7 +519,7 @@ void TransientPlacementTest::testXdgPopupWithPanel()
transientShellSurface.reset();
transientSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(transient));
QVERIFY(Test::waitForWindowClosed(transient));
// now parent to fullscreen - on fullscreen the panel is ignored
QSignalSpy toplevelConfigureRequestedSpy(parentShellSurface, &Test::XdgToplevel::configureRequested);

View file

@ -640,7 +640,7 @@ void X11WindowTest::testFullscreenLayerWithActiveWaylandWindow()
// close the window
shellSurface.reset();
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(waylandWindow));
QVERIFY(Test::waitForWindowClosed(waylandWindow));
QTRY_VERIFY(window->isActive());
QCOMPARE(window->layer(), ActiveLayer);
@ -695,7 +695,7 @@ void X11WindowTest::testFocusInWithWaylandLastActiveWindow()
// and close Wayland window again
shellSurface.reset();
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(waylandWindow));
QVERIFY(Test::waitForWindowClosed(waylandWindow));
// and try to activate the x11 window through X11 api
const auto cookie = xcb_set_input_focus_checked(c.get(), XCB_INPUT_FOCUS_NONE, windowId, XCB_CURRENT_TIME);
@ -993,13 +993,13 @@ void X11WindowTest::testActivateFocusedWindow()
xcb_set_input_focus(connection.get(), XCB_INPUT_FOCUS_POINTER_ROOT, windowId1, XCB_CURRENT_TIME);
xcb_destroy_window(connection.get(), windowId2);
xcb_flush(connection.get());
QVERIFY(Test::waitForWindowDestroyed(window2));
QVERIFY(Test::waitForWindowClosed(window2));
QVERIFY(window1->isActive());
// Destroy the first test window.
xcb_destroy_window(connection.get(), windowId1);
xcb_flush(connection.get());
QVERIFY(Test::waitForWindowDestroyed(window1));
QVERIFY(Test::waitForWindowClosed(window1));
}
void X11WindowTest::testReentrantMoveResize()
@ -1050,7 +1050,7 @@ void X11WindowTest::testReentrantMoveResize()
// Destroy the test window.
xcb_destroy_window(c.get(), windowId);
xcb_flush(c.get());
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
WAYLANDTEST_MAIN(X11WindowTest)

View file

@ -269,7 +269,7 @@ void TestXdgShellWindowRules::destroyTestWindow()
m_toplevelConfigureRequestedSpy.reset();
m_shellSurface.reset();
m_surface.reset();
QVERIFY(Test::waitForWindowDestroyed(m_window));
QVERIFY(Test::waitForWindowClosed(m_window));
}
template<typename T>

View file

@ -224,7 +224,7 @@ void TestXdgShellWindow::testMapUnmap()
// Unmap the xdg_toplevel surface by committing a null buffer.
surface->attachBuffer(KWayland::Client::Buffer::Ptr());
surface->commit(KWayland::Client::Surface::CommitFlag::None);
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
// Tell the compositor that we want to re-map the xdg_toplevel surface.
surface->commit(KWayland::Client::Surface::CommitFlag::None);
@ -247,7 +247,7 @@ void TestXdgShellWindow::testMapUnmap()
// Destroy the test window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestXdgShellWindow::testWindowOutputs()
@ -398,7 +398,7 @@ void TestXdgShellWindow::testFullscreen()
// Destroy the window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestXdgShellWindow::testUserCanSetFullscreen()
@ -549,7 +549,7 @@ void TestXdgShellWindow::testMaximizedToFullscreen()
// Destroy the window.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestXdgShellWindow::testFullscreenMultipleOutputs()
@ -1137,7 +1137,7 @@ void TestXdgShellWindow::testXdgWindowGeometryAttachBuffer()
QCOMPARE(window->bufferGeometry().size(), QSize(100, 50));
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestXdgShellWindow::testXdgWindowGeometryAttachSubSurface()
@ -1269,7 +1269,7 @@ void TestXdgShellWindow::testXdgWindowGeometryInteractiveResize()
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Resizing));
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestXdgShellWindow::testXdgWindowGeometryFullScreen()
@ -1324,7 +1324,7 @@ void TestXdgShellWindow::testXdgWindowGeometryFullScreen()
QCOMPARE(window->frameGeometry().size(), QSize(180, 80));
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestXdgShellWindow::testXdgWindowGeometryMaximize()
@ -1379,7 +1379,7 @@ void TestXdgShellWindow::testXdgWindowGeometryMaximize()
QCOMPARE(window->frameGeometry().size(), QSize(180, 80));
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestXdgShellWindow::testPointerInputTransform()
@ -1434,7 +1434,7 @@ void TestXdgShellWindow::testPointerInputTransform()
// Destroy the xdg-toplevel surface.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestXdgShellWindow::testReentrantSetFrameGeometry()
@ -1462,7 +1462,7 @@ void TestXdgShellWindow::testReentrantSetFrameGeometry()
// Destroy the xdg-toplevel surface.
shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestXdgShellWindow::testDoubleMaximize()
@ -1609,7 +1609,7 @@ void TestXdgShellWindow::testMaximizeHorizontal()
// Destroy the window.
shellSurface.reset();
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestXdgShellWindow::testMaximizeVertical()
@ -1688,7 +1688,7 @@ void TestXdgShellWindow::testMaximizeVertical()
// Destroy the window.
shellSurface.reset();
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestXdgShellWindow::testMaximizeFull()
@ -1767,7 +1767,7 @@ void TestXdgShellWindow::testMaximizeFull()
// Destroy the window.
shellSurface.reset();
surface.reset();
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
void TestXdgShellWindow::testSendMaximizedWindowToAnotherOutput()

View file

@ -105,7 +105,7 @@ void XwaylandServerRestartTest::testRestart()
// Destroy the test window.
xcb_destroy_window(c.get(), windowId);
xcb_flush(c.get());
QVERIFY(Test::waitForWindowDestroyed(window));
QVERIFY(Test::waitForWindowClosed(window));
}
} // namespace KWin