From 53e3e87681ddfb92a6676f575bc1dd2ccf2530c2 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 8 Dec 2021 11:52:04 +0200 Subject: [PATCH] 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 --- autotests/integration/xdgshellclient_test.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/autotests/integration/xdgshellclient_test.cpp b/autotests/integration/xdgshellclient_test.cpp index bc5375713e..feba4bf4c7 100644 --- a/autotests/integration/xdgshellclient_test.cpp +++ b/autotests/integration/xdgshellclient_test.cpp @@ -1848,11 +1848,16 @@ void TestXdgShellClient::testMaximizeAndChangeDecorationModeAfterInitialCommit() // if an xdg-toplevel surface is set maximized and decoration mode changes after initial commit. QScopedPointer surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createXdgToplevelSurface(surface.data())); // will wait for the first configure event + QScopedPointer shellSurface(Test::createXdgToplevelSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly)); QScopedPointer 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(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 surface(Test::createSurface()); - QScopedPointer shellSurface(Test::createXdgToplevelSurface(surface.data())); // will wait for the first configure event + QScopedPointer shellSurface(Test::createXdgToplevelSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly)); QScopedPointer 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(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);