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 <volker.hilsheimer@qt.io>
(cherry picked from commit 488abf9abd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit a796785d7d)
This commit is contained in:
Vladimir Belyavsky 2023-11-16 00:03:39 +03:00 committed by Qt Cherry-pick Bot
parent 2c57f0ba4b
commit 5307eb7b17
1 changed files with 3 additions and 1 deletions

View File

@ -1895,10 +1895,12 @@ Item {
qtest_results.finishTestData() qtest_results.finishTestData()
qtest_runInternal("cleanup") qtest_runInternal("cleanup")
qtest_destroyTemporaryObjects() qtest_destroyTemporaryObjects()
qtest_results.finishTestDataCleanup()
// wait(0) will call processEvents() so objects marked for deletion // wait(0) will call processEvents() so objects marked for deletion
// in the test function will be deleted. // in the test function will be deleted.
wait(0) wait(0)
qtest_results.finishTestDataCleanup()
} }
} }