autotests: Fix PointerInputTest::testDecoCancelsPopup()

We need to ack configure event that wants to change deco mode.
This commit is contained in:
Vlad Zahorodnii 2021-12-15 17:14:25 +02:00
parent 92317c5eff
commit 4bd9708503

View file

@ -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<KWayland::Client::Surface> surface(Test::createSurface());
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
QScopedPointer<Test::XdgToplevelDecorationV1> 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<quint32>());
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<AbstractClient *>();
auto popupClient = Test::renderAndWaitForShown(popupSurface, QSize(100, 50), Qt::red);
QVERIFY(popupClient);
QVERIFY(popupClient != window);
QCOMPARE(window, workspace()->activeClient());