Refactor tst_QDockWidget::closeAndDelete()
The test function was temporarily blacklisted on Ubuntu, but also failing on other Linux platforms (e.g. openSuSE). It tested, whether closing all dock widgets and the main window, would close the application as well. It used one single shot timer, to close the windows and later one to check, whether the application was shut down. While that mechanism must work in an application environment, it is not guaranteed to work in testlib. More specifically, I could happen that the XCB / glib event loop continued to spin and wait for events. => Check the signal QGuiApplication::lastWindowClosed() instead. If the signal is fired, it is proven that all windows have been closed and the application would quit in a production environment. The underlying test case was: Application didn't quit with the last dock widget closed, because there was a dangling QDockWidgetGroupWindow. => finally: Clean up BLACKLIST Pick-to: 6.6 6.5 Change-Id: Ic5fde5967fc8dde70ab64dc30cc7367c908b5c51 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
b6b489db69
commit
0b10b7476c
@ -5,23 +5,22 @@ android
|
||||
# QDockWidget::isFloating() is flaky after state change on these OS
|
||||
[closeAndDelete]
|
||||
macos
|
||||
[floatingTabs]
|
||||
b2qt
|
||||
arm
|
||||
android
|
||||
|
||||
# QTBUG-103091
|
||||
[floatingTabs]
|
||||
arm
|
||||
android
|
||||
qnx
|
||||
macos
|
||||
[closeAndDelete]
|
||||
b2qt
|
||||
[floatingTabs]
|
||||
macos b2qt arm android
|
||||
[closeAndDelete]
|
||||
|
||||
# QTBUG-103091
|
||||
[hoverWithoutDrop]
|
||||
arm
|
||||
android
|
||||
qnx
|
||||
macos
|
||||
b2qt
|
||||
[floatingTabs]
|
||||
arm
|
||||
[closeAndDelete]
|
||||
macos b2qt arm android
|
||||
[floatingTabs]
|
||||
arm
|
||||
[closeAndDelete]
|
||||
android
|
||||
[floatingTabs]
|
||||
android
|
||||
|
@ -1529,7 +1529,6 @@ void tst_QDockWidget::closeAndDelete()
|
||||
QSKIP("Test skipped on Wayland.");
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
// Create a mainwindow with a central widget and two dock widgets
|
||||
QObject localContext;
|
||||
QPointer<QDockWidget> d1;
|
||||
QPointer<QDockWidget> d2;
|
||||
QPointer<QWidget> cent;
|
||||
@ -1555,8 +1554,10 @@ void tst_QDockWidget::closeAndDelete()
|
||||
qWarning("OS flakiness: D2 is docked and reports being floating");
|
||||
|
||||
// Close everything with a single shot. Expected behavior: Event loop stops
|
||||
bool eventLoopStopped = true;
|
||||
QTimer::singleShot(0, &localContext, [mainWindow, d1, d2] {
|
||||
QSignalSpy closeSpy(qApp, &QApplication::lastWindowClosed);
|
||||
QObject localContext;
|
||||
|
||||
QTimer::singleShot(0, &localContext, [&](){
|
||||
mainWindow->close();
|
||||
QTRY_VERIFY(!mainWindow->isVisible());
|
||||
QTRY_VERIFY(d1->isVisible());
|
||||
@ -1565,19 +1566,12 @@ void tst_QDockWidget::closeAndDelete()
|
||||
d2->close();
|
||||
QTRY_VERIFY(!d1->isVisible());
|
||||
QTRY_VERIFY(!d2->isVisible());
|
||||
});
|
||||
|
||||
// Fallback timer to report event loop still running
|
||||
QTimer::singleShot(100, &localContext, [&eventLoopStopped] {
|
||||
qCDebug(lcTestDockWidget) << "Last dock widget hasn't shout down event loop!";
|
||||
eventLoopStopped = false;
|
||||
QTRY_COMPARE(closeSpy.count(), 1);
|
||||
QApplication::quit();
|
||||
});
|
||||
|
||||
QApplication::exec();
|
||||
|
||||
QTRY_VERIFY(eventLoopStopped);
|
||||
|
||||
// Check heap cleanup
|
||||
qCDebug(lcTestDockWidget) << "Deleting mainWindow";
|
||||
up_mainWindow.reset();
|
||||
|
Loading…
Reference in New Issue
Block a user