From 4bd9708503ccd99de8043f7f9de2fbeae04009c8 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 15 Dec 2021 17:14:25 +0200 Subject: [PATCH] autotests: Fix PointerInputTest::testDecoCancelsPopup() We need to ack configure event that wants to change deco mode. --- autotests/integration/pointer_input.cpp | 30 +++++++++---------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/autotests/integration/pointer_input.cpp b/autotests/integration/pointer_input.cpp index f7f2799c26..a9ef7ad633 100644 --- a/autotests/integration/pointer_input.cpp +++ b/autotests/integration/pointer_input.cpp @@ -1352,23 +1352,17 @@ void PointerInputTest::testDecoCancelsPopup() QVERIFY(motionSpy.isValid()); Cursors::self()->mouse()->setPos(800, 800); - QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); - QVERIFY(clientAddedSpy.isValid()); - KWayland::Client::Surface *surface = Test::createSurface(m_compositor); - QVERIFY(surface); - Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface, surface); - QVERIFY(shellSurface); - auto deco = Test::waylandServerSideDecoration()->create(surface, surface); - QSignalSpy decoSpy(deco, &ServerSideDecoration::modeChanged); - QVERIFY(decoSpy.isValid()); - QVERIFY(decoSpy.wait()); - deco->requestMode(ServerSideDecoration::Mode::Server); - QVERIFY(decoSpy.wait()); - QCOMPARE(deco->mode(), ServerSideDecoration::Mode::Server); - render(surface); - QVERIFY(clientAddedSpy.wait()); - AbstractClient *window = workspace()->activeClient(); + // create a decorated window + QScopedPointer surface(Test::createSurface()); + QScopedPointer shellSurface(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly)); + QScopedPointer decoration(Test::createXdgToplevelDecorationV1(shellSurface.data())); + QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested); + decoration->set_mode(Test::XdgToplevelDecorationV1::mode_server_side); + surface->commit(KWayland::Client::Surface::CommitFlag::None); + QVERIFY(surfaceConfigureRequestedSpy.wait()); + shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value()); + auto window = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(window); QCOMPARE(window->hasPopupGrab(), false); QVERIFY(window->isDecorated()); @@ -1396,9 +1390,7 @@ void PointerInputTest::testDecoCancelsPopup() QSignalSpy doneReceivedSpy(popupShellSurface, &Test::XdgPopup::doneReceived); QVERIFY(doneReceivedSpy.isValid()); popupShellSurface->grab(*Test::waylandSeat(), 0); // FIXME: Serial. - render(popupSurface, QSize(100, 50)); - QVERIFY(clientAddedSpy.wait()); - auto popupClient = clientAddedSpy.last().first().value(); + auto popupClient = Test::renderAndWaitForShown(popupSurface, QSize(100, 50), Qt::red); QVERIFY(popupClient); QVERIFY(popupClient != window); QCOMPARE(window, workspace()->activeClient());