diff --git a/autotests/integration/placement_test.cpp b/autotests/integration/placement_test.cpp index 2d464b00c7..888382361f 100644 --- a/autotests/integration/placement_test.cpp +++ b/autotests/integration/placement_test.cpp @@ -52,6 +52,7 @@ private Q_SLOTS: void testPlaceUnderMouse(); void testPlaceCascaded(); void testPlaceRandom(); + void testFullscreen(); private: void setPlacementPolicy(Placement::Policy policy); @@ -345,5 +346,35 @@ void TestPlacement::testPlaceRandom() QVERIFY(Test::waitForWindowDestroyed(client1)); } +void TestPlacement::testFullscreen() +{ + setPlacementPolicy(Placement::Smart); + QScopedPointer surface(Test::createSurface()); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); + AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::red); + + // auto-ack. XdgShell isn't being tested here, only the actual placement + connect(shellSurface.data(), &XdgShellSurface::configureRequested, [&](const QSize &size, KWayland::Client::XdgShellSurface::States, quint32 serial) { + if (!size.isEmpty()) { + shellSurface->ackConfigure(serial); + Test::render(surface.data(), size, Qt::red); + } + }); + + QVERIFY(client); + client->sendToScreen(0); + + QSignalSpy geometryChangedSpy(client, &Toplevel::frameGeometryChanged); + client->setFullScreen(true); + + QVERIFY(geometryChangedSpy.wait()); + QCOMPARE(client->frameGeometry(), screens()->geometry(0)); + + // this doesn't require a round trip, so should be immediate + client->sendToScreen(1); + QCOMPARE(client->frameGeometry(), screens()->geometry(1)); + QCOMPARE(geometryChangedSpy.count(), 2); +} + WAYLANDTEST_MAIN(TestPlacement) #include "placement_test.moc"