From 5307eb7b1754311184ccf56cf89792544a45f9eb Mon Sep 17 00:00:00 2001 From: Vladimir Belyavsky Date: Thu, 16 Nov 2023 00:03:39 +0300 Subject: [PATCH] TestCase: make failOnWarning() functional on temp objects destruction We need to be able to handle warnings that may occur when temporary objects, that were created in a test function, are destroyed. Now, with 18aa36cf878a52b8fe991392098e9445c3d3bfe3, we need only to wait before calling finishTestDataCleanup() to ensure that the objects marked for deletion are completely deleted. Without this patch, we may not fail on warnings like this: QWARN : tst_controls::Basic::ComboBox::test_mouseHighlight() qrc:/qt-project.org/imports/QtTest/SignalSpy.qml:55: TypeError: Property 'disconnect' of object true is not a function Change-Id: I990d65005ecf88633f25dcd317846804ae9fdfd1 Reviewed-by: Volker Hilsheimer (cherry picked from commit 488abf9abdbb954fb676e9592080a56d076070da) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit a796785d7dc7642b34179ab03b3ac211f5f90d92) --- src/qmltest/TestCase.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qmltest/TestCase.qml b/src/qmltest/TestCase.qml index 5ddce6159e..dec1e84dd7 100644 --- a/src/qmltest/TestCase.qml +++ b/src/qmltest/TestCase.qml @@ -1895,10 +1895,12 @@ Item { qtest_results.finishTestData() qtest_runInternal("cleanup") qtest_destroyTemporaryObjects() - qtest_results.finishTestDataCleanup() + // wait(0) will call processEvents() so objects marked for deletion // in the test function will be deleted. wait(0) + + qtest_results.finishTestDataCleanup() } }