Un-blacklist quitOnLastWindowClosedMulti test on macOS in CI
After the recent refactoring in 28b14b966f
this test should run stable on all platforms. However, the way the test
was written made it quite flaky. Simplify it to verify that closing one
window doesn't prevent a second timer to fire (which it would if closing
the first window already quit the application).
Change-Id: I0306792cd7573ebd3418d1aabffe2b78700ec2d9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
8fcfd7f591
commit
6dc587dfdd
@ -1,6 +1,3 @@
|
||||
[focusObject]
|
||||
ubuntu-16.04
|
||||
opensuse-42.3
|
||||
|
||||
[quitOnLastWindowClosedMulti]
|
||||
macos ci
|
||||
|
@ -905,11 +905,7 @@ void tst_QGuiApplication::quitOnLastWindowClosedMulti()
|
||||
QGuiApplication app(argc, nullptr);
|
||||
const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry();
|
||||
|
||||
QTimer timer;
|
||||
timer.setInterval(100);
|
||||
|
||||
QSignalSpy spyAboutToQuit(&app, &QCoreApplication::aboutToQuit);
|
||||
QSignalSpy spyTimeout(&timer, &QTimer::timeout);
|
||||
|
||||
QWindow mainWindow;
|
||||
mainWindow.setTitle(QStringLiteral("quitOnLastWindowClosedMultiMainWindow"));
|
||||
@ -928,15 +924,20 @@ void tst_QGuiApplication::quitOnLastWindowClosedMulti()
|
||||
dialog.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
|
||||
|
||||
timer.start();
|
||||
QTimer::singleShot(1000, &mainWindow, &QWindow::close); // This should not quit the application
|
||||
QTimer::singleShot(2000, &app, &QCoreApplication::quit);
|
||||
bool prematureQuit = true;
|
||||
QTimer::singleShot(100, &mainWindow, [&]{
|
||||
prematureQuit = true; // this should be reset by the other timer
|
||||
mainWindow.close();
|
||||
});
|
||||
QTimer::singleShot(500, &mainWindow, [&]{
|
||||
prematureQuit = false; // if we don't get here, then the app quit prematurely
|
||||
dialog.close();
|
||||
});
|
||||
|
||||
app.exec();
|
||||
|
||||
QCOMPARE(spyAboutToQuit.count(), 1);
|
||||
// Should be around 20 if closing did not cause the quit
|
||||
QVERIFY2(spyTimeout.count() > 15, QByteArray::number(spyTimeout.count()).constData());
|
||||
QVERIFY(!prematureQuit);
|
||||
QCOMPARE(spyAboutToQuit.count(), 1); // fired only once
|
||||
}
|
||||
|
||||
void tst_QGuiApplication::dontQuitOnLastWindowClosed()
|
||||
|
Loading…
Reference in New Issue
Block a user