From 91c60f25e0a9b09471c1f6780b821f6545aa25d4 Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Tue, 25 Mar 2025 10:24:42 +0100 Subject: [PATCH] tst_QWidget: Improve diagnostic output in cleanup() Use QTRY_COMPARE to have the size of topLevelWidgets() in logs. Add a warning if QApplication::allWidgets() isn't empty. Task-number: QTBUG-135138 Change-Id: I40bc3e5054776cb1b751218d9b9d1c46b349ccc7 Reviewed-by: Richard Moe Gustavsen --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 119bb7a7859..5c2553ce832 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -725,7 +725,9 @@ void tst_QWidget::initTestCase() void tst_QWidget::cleanup() { - QTRY_VERIFY(QApplication::topLevelWidgets().isEmpty()); + QTRY_COMPARE(QApplication::topLevelWidgets(), QWidgetList()); + if (!QApplication::allWidgets().isEmpty()) + qWarning() << "Test function has leaked" << QApplication::allWidgets(); } template