autotests: Make decoration mode change tests more robust

Currently, kwin expects that the xdg-decoration is installed before the
initial commit. However, decoration tests do that after the initial
commit, which makes testMaximizeAndChangeDecorationModeAfterInitialCommit()
silently pass.

On a second look, it seems that the xdg-decoration spec is okay with the
xdg-decoration being created after the first commit (as long as it's
done before the surface is mapped). This needs to be fixed separately.

CCBUG: 445259
This commit is contained in:
Vlad Zahorodnii 2021-12-08 11:52:04 +02:00
parent b82897ce73
commit 53e3e87681

View file

@ -1848,11 +1848,16 @@ void TestXdgShellClient::testMaximizeAndChangeDecorationModeAfterInitialCommit()
// if an xdg-toplevel surface is set maximized and decoration mode changes after initial commit.
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data())); // will wait for the first configure event
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly));
QScopedPointer<Test::XdgToplevelDecorationV1> decoration(Test::createXdgToplevelDecorationV1(shellSurface.data()));
QSignalSpy toplevelConfigureRequestedSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested);
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
// Commit the initial state.
surface->commit(KWayland::Client::Surface::CommitFlag::None);
QVERIFY(surfaceConfigureRequestedSpy.wait());
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), QSize(0, 0));
// Request maximized mode and set decoration mode, i.e. perform late initialization.
shellSurface->set_maximized();
decoration->set_mode(Test::XdgToplevelDecorationV1::mode_client_side);
@ -1871,11 +1876,16 @@ void TestXdgShellClient::testFullScreenAndChangeDecorationModeAfterInitialCommit
// if an xdg-toplevel surface is set fullscreen and decoration mode changes after initial commit.
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data())); // will wait for the first configure event
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly));
QScopedPointer<Test::XdgToplevelDecorationV1> decoration(Test::createXdgToplevelDecorationV1(shellSurface.data()));
QSignalSpy toplevelConfigureRequestedSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested);
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
// Commit the initial state.
surface->commit(KWayland::Client::Surface::CommitFlag::None);
QVERIFY(surfaceConfigureRequestedSpy.wait());
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), QSize(0, 0));
// Request fullscreen mode and set decoration mode, i.e. perform late initialization.
shellSurface->set_fullscreen(nullptr);
decoration->set_mode(Test::XdgToplevelDecorationV1::mode_client_side);