From e0da725533df4967c1f185ea92c6e1e841687880 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 21 Apr 2023 23:28:48 +0300 Subject: [PATCH] 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. --- autotests/integration/activation_test.cpp | 48 +++++++++---------- .../integration/decoration_input_test.cpp | 2 +- .../desktop_switching_animation_test.cpp | 2 +- .../effects/maximize_animation_test.cpp | 2 +- .../effects/minimize_animation_test.cpp | 4 +- .../popup_open_close_animation_test.cpp | 6 +-- .../toplevel_open_close_animation_test.cpp | 2 +- .../integration/globalshortcuts_test.cpp | 2 +- .../integration/idle_inhibition_test.cpp | 12 ++--- autotests/integration/inputmethod_test.cpp | 10 ++-- autotests/integration/internal_window.cpp | 2 +- .../integration/keyboard_layout_test.cpp | 2 +- autotests/integration/kwin_wayland_test.h | 2 +- .../integration/layershellv1window_test.cpp | 24 +++++----- autotests/integration/maximize_test.cpp | 10 ++-- .../integration/move_resize_window_test.cpp | 14 +++--- autotests/integration/placement_test.cpp | 36 +++++++------- autotests/integration/plasmawindow_test.cpp | 4 +- .../integration/pointer_constraints_test.cpp | 2 +- autotests/integration/pointer_input.cpp | 8 ++-- .../scripting/minimizeall_test.cpp | 4 +- autotests/integration/struts_test.cpp | 4 +- autotests/integration/tabbox_test.cpp | 18 +++---- autotests/integration/test_helpers.cpp | 8 ++-- autotests/integration/touch_input_test.cpp | 2 +- autotests/integration/transient_placement.cpp | 2 +- autotests/integration/x11_window_test.cpp | 10 ++-- .../integration/xdgshellwindow_rules_test.cpp | 2 +- autotests/integration/xdgshellwindow_test.cpp | 26 +++++----- .../xwaylandserver_restart_test.cpp | 2 +- 30 files changed, 136 insertions(+), 136 deletions(-) diff --git a/autotests/integration/activation_test.cpp b/autotests/integration/activation_test.cpp index 9ce98b9ffe..1bbac769c2 100644 --- a/autotests/integration/activation_test.cpp +++ b/autotests/integration/activation_test.cpp @@ -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() diff --git a/autotests/integration/decoration_input_test.cpp b/autotests/integration/decoration_input_test.cpp index 145dfc8a2d..c2fa21e6b7 100644 --- a/autotests/integration/decoration_input_test.cpp +++ b/autotests/integration/decoration_input_test.cpp @@ -776,7 +776,7 @@ void DecorationInputTest::testTooltipDoesntEatKeyEvents() QVERIFY(keyEvent.wait()); window->decoratedClient()->requestHideToolTip(); - Test::waitForWindowDestroyed(internal); + Test::waitForWindowClosed(internal); } } diff --git a/autotests/integration/effects/desktop_switching_animation_test.cpp b/autotests/integration/effects/desktop_switching_animation_test.cpp index 6a8edf3923..28547d415d 100644 --- a/autotests/integration/effects/desktop_switching_animation_test.cpp +++ b/autotests/integration/effects/desktop_switching_animation_test.cpp @@ -138,7 +138,7 @@ void DesktopSwitchingAnimationTest::testSwitchDesktops() // Destroy the test window. surface.reset(); - QVERIFY(Test::waitForWindowDestroyed(window)); + QVERIFY(Test::waitForWindowClosed(window)); } WAYLANDTEST_MAIN(DesktopSwitchingAnimationTest) diff --git a/autotests/integration/effects/maximize_animation_test.cpp b/autotests/integration/effects/maximize_animation_test.cpp index 842843d13e..8f0fe0bea1 100644 --- a/autotests/integration/effects/maximize_animation_test.cpp +++ b/autotests/integration/effects/maximize_animation_test.cpp @@ -177,7 +177,7 @@ void MaximizeAnimationTest::testMaximizeRestore() // Destroy the test window. surface.reset(); - QVERIFY(Test::waitForWindowDestroyed(window)); + QVERIFY(Test::waitForWindowClosed(window)); } WAYLANDTEST_MAIN(MaximizeAnimationTest) diff --git a/autotests/integration/effects/minimize_animation_test.cpp b/autotests/integration/effects/minimize_animation_test.cpp index aedd370ea9..412ba08925 100644 --- a/autotests/integration/effects/minimize_animation_test.cpp +++ b/autotests/integration/effects/minimize_animation_test.cpp @@ -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) diff --git a/autotests/integration/effects/popup_open_close_animation_test.cpp b/autotests/integration/effects/popup_open_close_animation_test.cpp index b63d2f5d2c..11f1bc5604 100644 --- a/autotests/integration/effects/popup_open_close_animation_test.cpp +++ b/autotests/integration/effects/popup_open_close_animation_test.cpp @@ -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) diff --git a/autotests/integration/effects/toplevel_open_close_animation_test.cpp b/autotests/integration/effects/toplevel_open_close_animation_test.cpp index 07c9fec710..3753ca74cd 100644 --- a/autotests/integration/effects/toplevel_open_close_animation_test.cpp +++ b/autotests/integration/effects/toplevel_open_close_animation_test.cpp @@ -197,7 +197,7 @@ void ToplevelOpenCloseAnimationTest::testDontAnimatePopups() // Destroy the main window. mainWindowSurface.reset(); - QVERIFY(Test::waitForWindowDestroyed(mainWindow)); + QVERIFY(Test::waitForWindowClosed(mainWindow)); } WAYLANDTEST_MAIN(ToplevelOpenCloseAnimationTest) diff --git a/autotests/integration/globalshortcuts_test.cpp b/autotests/integration/globalshortcuts_test.cpp index f844ee16da..fbc8df4121 100644 --- a/autotests/integration/globalshortcuts_test.cpp +++ b/autotests/integration/globalshortcuts_test.cpp @@ -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 } diff --git a/autotests/integration/idle_inhibition_test.cpp b/autotests/integration/idle_inhibition_test.cpp index 745babd3c6..839bc60ff1 100644 --- a/autotests/integration/idle_inhibition_test.cpp +++ b/autotests/integration/idle_inhibition_test.cpp @@ -93,7 +93,7 @@ void TestIdleInhibition::testInhibit() QCOMPARE(input()->idleInhibitors(), QList{window}); shellSurface.reset(); - QVERIFY(Test::waitForWindowDestroyed(window)); + QVERIFY(Test::waitForWindowClosed(window)); QCOMPARE(input()->idleInhibitors(), QList{}); } @@ -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{}); } @@ -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{}); } @@ -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{}); } @@ -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{}); } diff --git a/autotests/integration/inputmethod_test.cpp b/autotests/integration/inputmethod_test.cpp index e1068a0938..3c39445e9b 100644 --- a/autotests/integration/inputmethod_test.cpp +++ b/autotests/integration/inputmethod_test.cpp @@ -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() diff --git a/autotests/integration/internal_window.cpp b/autotests/integration/internal_window.cpp index 7e5228ee21..c8ef1ce35d 100644 --- a/autotests/integration/internal_window.cpp +++ b/autotests/integration/internal_window.cpp @@ -399,7 +399,7 @@ void InternalWindowTest::testKeyboardTriggersLeave() // Destroy the test window. shellSurface.reset(); - QVERIFY(Test::waitForWindowDestroyed(window)); + QVERIFY(Test::waitForWindowClosed(window)); } void InternalWindowTest::testTouch() diff --git a/autotests/integration/keyboard_layout_test.cpp b/autotests/integration/keyboard_layout_test.cpp index d24c84448b..3849b80337 100644 --- a/autotests/integration/keyboard_layout_test.cpp +++ b/autotests/integration/keyboard_layout_test.cpp @@ -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)")); diff --git a/autotests/integration/kwin_wayland_test.h b/autotests/integration/kwin_wayland_test.h index e921b1ba04..6f18ca7b81 100644 --- a/autotests/integration/kwin_wayland_test.h +++ b/autotests/integration/kwin_wayland_test.h @@ -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. diff --git a/autotests/integration/layershellv1window_test.cpp b/autotests/integration/layershellv1window_test.cpp index c0bf314c12..1ddf430a50 100644 --- a/autotests/integration/layershellv1window_test.cpp +++ b/autotests/integration/layershellv1window_test.cpp @@ -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 diff --git a/autotests/integration/maximize_test.cpp b/autotests/integration/maximize_test.cpp index 4c072b031c..9d793e74dd 100644 --- a/autotests/integration/maximize_test.cpp +++ b/autotests/integration/maximize_test.cpp @@ -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{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) diff --git a/autotests/integration/move_resize_window_test.cpp b/autotests/integration/move_resize_window_test.cpp index e0f94dbefa..2ccfb6312d 100644 --- a/autotests/integration/move_resize_window_test.cpp +++ b/autotests/integration/move_resize_window_test.cpp @@ -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); } diff --git a/autotests/integration/placement_test.cpp b/autotests/integration/placement_test.cpp index 19fb411f2f..2c5c7022b1 100644 --- a/autotests/integration/placement_test.cpp +++ b/autotests/integration/placement_test.cpp @@ -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) diff --git a/autotests/integration/plasmawindow_test.cpp b/autotests/integration/plasmawindow_test.cpp index 292a4f1231..e5be364c93 100644 --- a/autotests/integration/plasmawindow_test.cpp +++ b/autotests/integration/plasmawindow_test.cpp @@ -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() diff --git a/autotests/integration/pointer_constraints_test.cpp b/autotests/integration/pointer_constraints_test.cpp index ebdc33eb32..f947ec1636 100644 --- a/autotests/integration/pointer_constraints_test.cpp +++ b/autotests/integration/pointer_constraints_test.cpp @@ -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); } diff --git a/autotests/integration/pointer_input.cpp b/autotests/integration/pointer_input.cpp index 3ef5a38ac0..02757eaa31 100644 --- a/autotests/integration/pointer_input.cpp +++ b/autotests/integration/pointer_input.cpp @@ -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)); } } diff --git a/autotests/integration/scripting/minimizeall_test.cpp b/autotests/integration/scripting/minimizeall_test.cpp index a49062f309..f557c46e04 100644 --- a/autotests/integration/scripting/minimizeall_test.cpp +++ b/autotests/integration/scripting/minimizeall_test.cpp @@ -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)); } } diff --git a/autotests/integration/struts_test.cpp b/autotests/integration/struts_test.cpp index 1160dccce6..149e0a8d78 100644 --- a/autotests/integration/struts_test.cpp +++ b/autotests/integration/struts_test.cpp @@ -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() diff --git a/autotests/integration/tabbox_test.cpp b/autotests/integration/tabbox_test.cpp index 8b8b652dd9..dbd79fe324 100644 --- a/autotests/integration/tabbox_test.cpp +++ b/autotests/integration/tabbox_test.cpp @@ -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) diff --git a/autotests/integration/test_helpers.cpp b/autotests/integration/test_helpers.cpp index 92fad91db2..76ce575da7 100644 --- a/autotests/integration/test_helpers.cpp +++ b/autotests/integration/test_helpers.cpp @@ -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 diff --git a/autotests/integration/touch_input_test.cpp b/autotests/integration/touch_input_test.cpp index c0d2843b2d..c2581d8d25 100644 --- a/autotests/integration/touch_input_test.cpp +++ b/autotests/integration/touch_input_test.cpp @@ -351,7 +351,7 @@ void TouchInputTest::testUpdateFocusOnDecorationDestroy() // Destroy the window. shellSurface.reset(); - QVERIFY(Test::waitForWindowDestroyed(window)); + QVERIFY(Test::waitForWindowClosed(window)); } void TouchInputTest::testGestureDetection() diff --git a/autotests/integration/transient_placement.cpp b/autotests/integration/transient_placement.cpp index 709fc6fc19..beff7e9202 100644 --- a/autotests/integration/transient_placement.cpp +++ b/autotests/integration/transient_placement.cpp @@ -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); diff --git a/autotests/integration/x11_window_test.cpp b/autotests/integration/x11_window_test.cpp index 2cf26d9e42..f1e20386d3 100644 --- a/autotests/integration/x11_window_test.cpp +++ b/autotests/integration/x11_window_test.cpp @@ -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) diff --git a/autotests/integration/xdgshellwindow_rules_test.cpp b/autotests/integration/xdgshellwindow_rules_test.cpp index 4c0c795d12..0f36dad743 100644 --- a/autotests/integration/xdgshellwindow_rules_test.cpp +++ b/autotests/integration/xdgshellwindow_rules_test.cpp @@ -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 diff --git a/autotests/integration/xdgshellwindow_test.cpp b/autotests/integration/xdgshellwindow_test.cpp index 018cb592db..cc83aec20a 100644 --- a/autotests/integration/xdgshellwindow_test.cpp +++ b/autotests/integration/xdgshellwindow_test.cpp @@ -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() diff --git a/autotests/integration/xwaylandserver_restart_test.cpp b/autotests/integration/xwaylandserver_restart_test.cpp index 42af0a798c..68d25f0c49 100644 --- a/autotests/integration/xwaylandserver_restart_test.cpp +++ b/autotests/integration/xwaylandserver_restart_test.cpp @@ -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