autotests: Stabilize testXdgShellClient

Currently, testXdgWindowReactive() is a bit flaky because the parent
window and the popup window are created together. The popup can be
configured again if its global position changes after the parent window
has been placed.

In order to stabilize the test, create the parent window, then the popup
window.
This commit is contained in:
Vlad Zahorodnii 2021-10-07 23:11:41 +03:00
parent 4ba7aa62b9
commit dee97068fb

View file

@ -114,15 +114,13 @@ void TestXdgShellClient::testXdgWindowReactive()
positioner->set_reactive();
QScopedPointer<KWayland::Client::Surface> rootSurface(Test::createSurface());
QScopedPointer<KWayland::Client::Surface> childSurface(Test::createSurface());
QScopedPointer<Test::XdgToplevel> root(Test::createXdgToplevelSurface(rootSurface.data()));
QScopedPointer<Test::XdgPopup> popup(Test::createXdgPopupSurface(childSurface.data(), root->xdgSurface(), positioner.data()));
auto rootClient = Test::renderAndWaitForShown(rootSurface.data(), QSize(100, 100), Qt::cyan);
auto childClient = Test::renderAndWaitForShown(childSurface.data(), QSize(10, 10), Qt::cyan);
QVERIFY(rootClient);
QScopedPointer<KWayland::Client::Surface> childSurface(Test::createSurface());
QScopedPointer<Test::XdgPopup> popup(Test::createXdgPopupSurface(childSurface.data(), root->xdgSurface(), positioner.data()));
auto childClient = Test::renderAndWaitForShown(childSurface.data(), QSize(10, 10), Qt::cyan);
QVERIFY(childClient);
QSignalSpy popupConfigureRequested(popup.data(), &Test::XdgPopup::configureRequested);
@ -145,15 +143,13 @@ void TestXdgShellClient::testXdgWindowRepositioning()
otherPositioner->set_anchor_rect(10, 10, 10, 10);
QScopedPointer<KWayland::Client::Surface> rootSurface(Test::createSurface());
QScopedPointer<KWayland::Client::Surface> childSurface(Test::createSurface());
QScopedPointer<Test::XdgToplevel> root(Test::createXdgToplevelSurface(rootSurface.data()));
QScopedPointer<Test::XdgPopup> popup(Test::createXdgPopupSurface(childSurface.data(), root->xdgSurface(), positioner.data()));
auto rootClient = Test::renderAndWaitForShown(rootSurface.data(), QSize(100, 100), Qt::cyan);
auto childClient = Test::renderAndWaitForShown(childSurface.data(), QSize(10, 10), Qt::cyan);
QVERIFY(rootClient);
QScopedPointer<KWayland::Client::Surface> childSurface(Test::createSurface());
QScopedPointer<Test::XdgPopup> popup(Test::createXdgPopupSurface(childSurface.data(), root->xdgSurface(), positioner.data()));
auto childClient = Test::renderAndWaitForShown(childSurface.data(), QSize(10, 10), Qt::cyan);
QVERIFY(childClient);
QSignalSpy reconfigureSpy(popup.data(), &Test::XdgPopup::configureRequested);