summaryrefslogtreecommitdiffstats
path: root/tests/auto/client/client/tst_client.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2017-08-29 14:40:05 +0200
committerJohan Helsing <johan.helsing@qt.io>2017-11-24 08:40:15 +0000
commit797a761091234de98f78ad86144264b76d2290d7 (patch)
tree92e98f241d9b548c8927abbdef03ad5e0aead231 /tests/auto/client/client/tst_client.cpp
parentf82bf9e25d400f0f3786c0519a3369f782e92640 (diff)
Client: Add removePrimaryScreen test
Test that removing the primary screen will not crash the application. Task-number: QTBUG-62044 Change-Id: I8ba870e1d608629318ef897f88a6cc0d6e6aa85e Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
Diffstat (limited to 'tests/auto/client/client/tst_client.cpp')
-rw-r--r--tests/auto/client/client/tst_client.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/client/client/tst_client.cpp b/tests/auto/client/client/tst_client.cpp
index e02aa9f8f..3cf19546f 100644
--- a/tests/auto/client/client/tst_client.cpp
+++ b/tests/auto/client/client/tst_client.cpp
@@ -140,6 +140,7 @@ private slots:
void primaryScreen();
void screens();
void windowScreens();
+ void removePrimaryScreen();
void createDestroyWindow();
void events();
void backingStore();
@@ -211,6 +212,38 @@ void tst_WaylandClient::windowScreens()
QTRY_VERIFY(!compositor->surface());
}
+void tst_WaylandClient::removePrimaryScreen()
+{
+ QSharedPointer<MockOutput> firstOutput;
+ QTRY_VERIFY(firstOutput = compositor->output());
+
+ TestWindow window;
+ window.show();
+
+ QSharedPointer<MockSurface> surface;
+ QTRY_VERIFY(surface = compositor->surface());
+ QTRY_COMPARE(QGuiApplication::screens().size(), 1);
+ QScreen *primaryScreen = QGuiApplication::screens().first();
+ QCOMPARE(window.screen(), primaryScreen);
+
+ compositor->sendAddOutput();
+
+ QTRY_COMPARE(QGuiApplication::screens().size(), 2);
+ QScreen *secondaryScreen = QGuiApplication::screens().at(1);
+ QVERIFY(secondaryScreen);
+
+ compositor->sendRemoveOutput(firstOutput);
+ QTRY_COMPARE(QGuiApplication::screens().size(), 1);
+
+ compositor->sendMousePress(surface, QPoint(10, 10));
+ QTRY_COMPARE(window.mousePressEventCount, 1);
+ compositor->sendMouseRelease(surface);
+ QTRY_COMPARE(window.mouseReleaseEventCount, 1);
+
+ window.destroy();
+ QTRY_VERIFY(!compositor->surface());
+}
+
void tst_WaylandClient::createDestroyWindow()
{
TestWindow window;