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>
This commit is contained in:
parent
f7e6a478b7
commit
a5c79599c8
@ -140,6 +140,7 @@ private slots:
|
|||||||
void primaryScreen();
|
void primaryScreen();
|
||||||
void screens();
|
void screens();
|
||||||
void windowScreens();
|
void windowScreens();
|
||||||
|
void removePrimaryScreen();
|
||||||
void createDestroyWindow();
|
void createDestroyWindow();
|
||||||
void events();
|
void events();
|
||||||
void backingStore();
|
void backingStore();
|
||||||
@ -211,6 +212,38 @@ void tst_WaylandClient::windowScreens()
|
|||||||
QTRY_VERIFY(!compositor->surface());
|
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()
|
void tst_WaylandClient::createDestroyWindow()
|
||||||
{
|
{
|
||||||
TestWindow window;
|
TestWindow window;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user