autotests: Fix testActivation

Currently there's a race condition with regards to the first configure
event with the activated state.
This commit is contained in:
Vlad Zahorodnii 2021-05-12 19:21:38 +03:00
parent 0fbde9a2e0
commit c9ee2f06db

View file

@ -451,13 +451,12 @@ void ActivationTest::testSwitchToWindowFullScreen()
// Create several maximized clients on the top screen. // Create several maximized clients on the top screen.
QScopedPointer<Surface> surface1(Test::createSurface()); QScopedPointer<Surface> surface1(Test::createSurface());
QScopedPointer<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.data())); QScopedPointer<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.data()));
QSignalSpy toplevelConfigureRequestedSpy1(shellSurface1.data(), &Test::XdgToplevel::configureRequested);
QSignalSpy surfaceConfigureRequestedSpy1(shellSurface1->xdgSurface(), &Test::XdgSurface::configureRequested);
AbstractClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); AbstractClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
QVERIFY(client1); QVERIFY(client1);
QVERIFY(client1->isActive()); QVERIFY(client1->isActive());
QSignalSpy toplevelConfigureRequestedSpy1(shellSurface1.data(), &Test::XdgToplevel::configureRequested); QVERIFY(surfaceConfigureRequestedSpy1.wait()); // Wait for the configure event with the activated state.
QVERIFY(toplevelConfigureRequestedSpy1.isValid());
QSignalSpy surfaceConfigureRequestedSpy1(shellSurface1->xdgSurface(), &Test::XdgSurface::configureRequested);
QVERIFY(surfaceConfigureRequestedSpy1.isValid());
workspace()->slotWindowFullScreen(); workspace()->slotWindowFullScreen();
QVERIFY(surfaceConfigureRequestedSpy1.wait()); QVERIFY(surfaceConfigureRequestedSpy1.wait());
QSignalSpy frameGeometryChangedSpy1(client1, &AbstractClient::frameGeometryChanged); QSignalSpy frameGeometryChangedSpy1(client1, &AbstractClient::frameGeometryChanged);
@ -468,13 +467,12 @@ void ActivationTest::testSwitchToWindowFullScreen()
QScopedPointer<Surface> surface2(Test::createSurface()); QScopedPointer<Surface> surface2(Test::createSurface());
QScopedPointer<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.data())); QScopedPointer<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.data()));
QSignalSpy toplevelConfigureRequestedSpy2(shellSurface2.data(), &Test::XdgToplevel::configureRequested);
QSignalSpy surfaceConfigureRequestedSpy2(shellSurface2->xdgSurface(), &Test::XdgSurface::configureRequested);
AbstractClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); AbstractClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue);
QVERIFY(client2); QVERIFY(client2);
QVERIFY(client2->isActive()); QVERIFY(client2->isActive());
QSignalSpy toplevelConfigureRequestedSpy2(shellSurface2.data(), &Test::XdgToplevel::configureRequested); QVERIFY(surfaceConfigureRequestedSpy2.wait()); // Wait for the configure event with the activated state.
QVERIFY(toplevelConfigureRequestedSpy2.wait());
QSignalSpy surfaceConfigureRequestedSpy2(shellSurface2->xdgSurface(), &Test::XdgSurface::configureRequested);
QVERIFY(surfaceConfigureRequestedSpy2.isValid());
workspace()->slotWindowFullScreen(); workspace()->slotWindowFullScreen();
QVERIFY(surfaceConfigureRequestedSpy2.wait()); QVERIFY(surfaceConfigureRequestedSpy2.wait());
QSignalSpy frameGeometryChangedSpy2(client2, &AbstractClient::frameGeometryChanged); QSignalSpy frameGeometryChangedSpy2(client2, &AbstractClient::frameGeometryChanged);