autotests: Add a test that checks one possible corner case during xdg-toplevel initialization
If the preferred decoration mode changes after the initial commit but before the surface is mapped, there's a chance that kwin can send a bad configure event, it's been the case in the past. Add a test to prevent such cases go unnoticed.
This commit is contained in:
parent
9cc80d7468
commit
97160c9b90
1 changed files with 28 additions and 0 deletions
|
@ -106,6 +106,7 @@ private Q_SLOTS:
|
|||
void testDoubleMaximize();
|
||||
void testMaximizeAndChangeDecorationModeAfterInitialCommit();
|
||||
void testFullScreenAndChangeDecorationModeAfterInitialCommit();
|
||||
void testChangeDecorationModeAfterInitialCommit();
|
||||
};
|
||||
|
||||
void TestXdgShellClient::testXdgWindowReactive()
|
||||
|
@ -1885,5 +1886,32 @@ void TestXdgShellClient::testFullScreenAndChangeDecorationModeAfterInitialCommit
|
|||
QCOMPARE(toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>(), Test::XdgToplevel::State::Fullscreen);
|
||||
}
|
||||
|
||||
void TestXdgShellClient::testChangeDecorationModeAfterInitialCommit()
|
||||
{
|
||||
// This test verifies that the compositor will respond with a good configure event when
|
||||
// the decoration mode changes after the first surface commit but before the surface is mapped.
|
||||
|
||||
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
|
||||
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly));
|
||||
QScopedPointer<Test::XdgToplevelDecorationV1> decoration(Test::createXdgToplevelDecorationV1(shellSurface.data()));
|
||||
QSignalSpy decorationConfigureRequestedSpy(decoration.data(), &Test::XdgToplevelDecorationV1::configureRequested);
|
||||
QSignalSpy toplevelConfigureRequestedSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested);
|
||||
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
|
||||
|
||||
// Perform the initial commit.
|
||||
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
||||
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
||||
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), QSize(0, 0));
|
||||
QCOMPARE(decorationConfigureRequestedSpy.last().at(0).value<Test::XdgToplevelDecorationV1::mode>(), Test::XdgToplevelDecorationV1::mode_server_side);
|
||||
|
||||
// Change decoration mode.
|
||||
decoration->set_mode(Test::XdgToplevelDecorationV1::mode_client_side);
|
||||
|
||||
// The configure event should still have 0x0 size.
|
||||
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
||||
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), QSize(0, 0));
|
||||
QCOMPARE(decorationConfigureRequestedSpy.last().at(0).value<Test::XdgToplevelDecorationV1::mode>(), Test::XdgToplevelDecorationV1::mode_client_side);
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(TestXdgShellClient)
|
||||
#include "xdgshellclient_test.moc"
|
||||
|
|
Loading…
Reference in a new issue