diff --git a/autotests/integration/plasma_surface_test.cpp b/autotests/integration/plasma_surface_test.cpp
index 819de4c0c6..5e6c728d9a 100644
--- a/autotests/integration/plasma_surface_test.cpp
+++ b/autotests/integration/plasma_surface_test.cpp
@@ -20,6 +20,7 @@ along with this program. If not, see .
#include "kwin_wayland_test.h"
#include "platform.h"
#include "shell_client.h"
+#include "screens.h"
#include "wayland_server.h"
#include "workspace.h"
#include
@@ -50,6 +51,7 @@ private Q_SLOTS:
void testAcceptsFocus();
void testDesktopIsOpaque();
+ void testOSDPlacement();
private:
ConnectionThread *m_connection = nullptr;
@@ -199,5 +201,40 @@ void PlasmaSurfaceTest::testDesktopIsOpaque()
QCOMPARE(c->depth(), 24);
}
+void PlasmaSurfaceTest::testOSDPlacement()
+{
+ QScopedPointer surface(Test::createSurface());
+ QVERIFY(!surface.isNull());
+ QScopedPointer shellSurface(Test::createShellSurface(surface.data()));
+ QVERIFY(!shellSurface.isNull());
+ QScopedPointer plasmaSurface(m_plasmaShell->createSurface(surface.data()));
+ QVERIFY(!plasmaSurface.isNull());
+ plasmaSurface->setRole(PlasmaShellSurface::Role::OnScreenDisplay);
+
+ // now render and map the window
+ auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
+
+ QVERIFY(c);
+ QCOMPARE(c->windowType(), NET::OnScreenDisplay);
+ QVERIFY(c->isOnScreenDisplay());
+ QCOMPARE(c->geometry(), QRect(590, 649, 100, 50));
+
+ // change the screen size
+ QSignalSpy screensChangedSpy(screens(), &Screens::changed);
+ QVERIFY(screensChangedSpy.isValid());
+ const QVector geometries{QRect(0, 0, 1280, 1024), QRect(1280, 0, 1280, 1024)};
+ QMetaObject::invokeMethod(kwinApp()->platform(), "outputGeometriesChanged",
+ Qt::DirectConnection,
+ Q_ARG(QVector, geometries));
+ QVERIFY(screensChangedSpy.wait());
+ QCOMPARE(screensChangedSpy.count(), 1);
+ QCOMPARE(screens()->count(), 2);
+ QCOMPARE(screens()->geometry(0), geometries.at(0));
+ QCOMPARE(screens()->geometry(1), geometries.at(1));
+
+ QEXPECT_FAIL("", "Geometry should not change due to a screen being added", Continue);
+ QCOMPARE(c->geometry(), QRect(590, 649, 100, 50));
+}
+
WAYLANDTEST_MAIN(PlasmaSurfaceTest)
#include "plasma_surface_test.moc"