summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Redondo <qt@david-redondo.de>2023-04-27 15:22:26 +0200
committerDavid Redondo <qt@david-redondo.de>2023-05-17 10:19:06 +0200
commit07cf229f53ab15bb87b943aa07617681a6088d53 (patch)
tree326aa7ebcada2d00cf563b20c60e154d90d08067 /tests
parent851a01767850b49b4c691a1694252530857e8518 (diff)
downloadqtwayland-07cf229f53ab15bb87b943aa07617681a6088d53.tar.gz
Properly clean up screens during reconnect
Otherwise the old screens are left dangling. Also create a placeholder screen so the windows get assigned a valid screen upon reconnect. Change-Id: Iea5d1da6f32be5e87464412447ae1449d91d8e75 Reviewed-by: David Edmundson <davidedmundson@kde.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/client/reconnect/tst_reconnect.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/client/reconnect/tst_reconnect.cpp b/tests/auto/client/reconnect/tst_reconnect.cpp
index 93007d4c..2b6c7558 100644
--- a/tests/auto/client/reconnect/tst_reconnect.cpp
+++ b/tests/auto/client/reconnect/tst_reconnect.cpp
@@ -101,6 +101,7 @@ private Q_SLOTS:
//core
void cleanup() { QTRY_VERIFY2(m_comp->isClean(), qPrintable(m_comp->dirtyMessage())); }
void basicWindow();
+ void screens();
//input
void keyFocus();
@@ -141,6 +142,30 @@ void tst_WaylandReconnect::basicWindow()
QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel());
}
+void tst_WaylandReconnect::screens()
+{
+ QRasterWindow window;
+ window.resize(64, 48);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel());
+
+ auto originalScreens = QGuiApplication::screens();
+
+ QSignalSpy screenRemovedSpy(qGuiApp, &QGuiApplication::screenRemoved);
+ QVERIFY(screenRemovedSpy.isValid());
+
+ triggerReconnect();
+
+ // All screens plus temporary placeholder screen removed
+ QCOMPARE(screenRemovedSpy.count(), originalScreens.count() + 1);
+ for (const auto &screen : std::as_const(screenRemovedSpy)) {
+ originalScreens.removeOne(screen[0].value<QScreen *>());
+ }
+ QVERIFY(originalScreens.isEmpty());
+ QVERIFY(window.screen());
+ QVERIFY(QGuiApplication::screens().contains(window.screen()));
+}
+
void tst_WaylandReconnect::keyFocus()
{
TestWindow window;