diff --git a/autotests/integration/shell_client_test.cpp b/autotests/integration/shell_client_test.cpp
index deeaa08c10..f84eb6bc4c 100644
--- a/autotests/integration/shell_client_test.cpp
+++ b/autotests/integration/shell_client_test.cpp
@@ -30,6 +30,7 @@ along with this program. If not, see .
#include
#include
#include
+#include
#include
@@ -52,6 +53,8 @@ private Q_SLOTS:
void testTransientPositionAfterRemap();
void testMinimizeActiveWindow_data();
void testMinimizeActiveWindow();
+ void testFullscreen_data();
+ void testFullscreen();
};
void TestShellClient::initTestCase()
@@ -291,5 +294,79 @@ void TestShellClient::testMinimizeActiveWindow()
QCOMPARE(workspace()->activeClient(), c);
}
+void TestShellClient::testFullscreen_data()
+{
+ QTest::addColumn("type");
+
+ QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell;
+ QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5;
+}
+
+void TestShellClient::testFullscreen()
+{
+ // this test verifies that a window can be properly fullscreened
+ QScopedPointer surface(Test::createSurface());
+ QFETCH(Test::ShellSurfaceType, type);
+ QScopedPointer shellSurface(Test::createShellSurface(type, surface.data()));
+ auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
+ QVERIFY(c);
+ QVERIFY(c->isActive());
+ QVERIFY(!c->isFullScreen());
+ QCOMPARE(c->geometry(), QRect(0, 0, 100, 50));
+ QSignalSpy fullscreenChangedSpy(c, &ShellClient::fullScreenChanged);
+ QVERIFY(fullscreenChangedSpy.isValid());
+ QSignalSpy geometryChangedSpy(c, &ShellClient::geometryChanged);
+ QVERIFY(geometryChangedSpy.isValid());
+ QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), SIGNAL(sizeChanged(QSize)));
+ QVERIFY(sizeChangeRequestedSpy.isValid());
+
+ // fullscreen the window
+ switch (type) {
+ case Test::ShellSurfaceType::WlShell:
+ qobject_cast(shellSurface.data())->setFullscreen();
+ break;
+ case Test::ShellSurfaceType::XdgShellV5:
+ qobject_cast(shellSurface.data())->setFullscreen(true);
+ break;
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+ QVERIFY(fullscreenChangedSpy.wait());
+ QVERIFY(sizeChangeRequestedSpy.wait());
+ QCOMPARE(sizeChangeRequestedSpy.count(), 1);
+ QCOMPARE(sizeChangeRequestedSpy.first().first().toSize(), QSize(screens()->size(0)));
+ // TODO: should switch to fullscreen once it's updated
+ QVERIFY(c->isFullScreen());
+ QCOMPARE(c->geometry(), QRect(0, 0, 100, 50));
+ QVERIFY(geometryChangedSpy.isEmpty());
+
+ // render at the new size
+ Test::render(surface.data(), sizeChangeRequestedSpy.first().first().toSize(), Qt::red);
+ QVERIFY(geometryChangedSpy.wait());
+ QCOMPARE(geometryChangedSpy.count(), 1);
+ QVERIFY(c->isFullScreen());
+ QCOMPARE(c->geometry(), QRect(QPoint(0, 0), sizeChangeRequestedSpy.first().first().toSize()));
+
+ // swap back to normal
+ switch (type) {
+ case Test::ShellSurfaceType::WlShell:
+ qobject_cast(shellSurface.data())->setToplevel();
+ break;
+ case Test::ShellSurfaceType::XdgShellV5:
+ qobject_cast(shellSurface.data())->setFullscreen(false);
+ break;
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+ QVERIFY(fullscreenChangedSpy.wait());
+ QVERIFY(sizeChangeRequestedSpy.wait());
+ QCOMPARE(sizeChangeRequestedSpy.count(), 2);
+ QCOMPARE(sizeChangeRequestedSpy.last().first().toSize(), QSize(100, 50));
+ // TODO: should switch to fullscreen once it's updated
+ QVERIFY(!c->isFullScreen());
+}
+
WAYLANDTEST_MAIN(TestShellClient)
#include "shell_client_test.moc"