diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2024-03-20 10:09:56 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2024-05-06 20:27:41 +0200 |
commit | a2566e139f8b2eed2b8cf7d90bc0a2ae6b289be8 (patch) | |
tree | bc22499c92dd776207d79da1fa03fdcad8f3bbcc /tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp | |
parent | 5a09ade17658f79254140275f030f5348f3921ab (diff) |
Extend QTest::failOnWarning() to a no-parameter fail-on-any-warning
Many users (albeit mostly in qtdeclarative) of failOnWarning() are
passing a catch-all regexp, which is only supported when regular
expression support is enabled. Make their lives easier and those
checks independent of the feature by adding a third overload, taking
no parameter, that fails on any (unanticipated) warning.
Implementation is trivial - just put a null QVariant in
failOnWarningList; it won't match either check on the entry that might
exempt a test from failing on a warning, so any warning at all will
trigger failure.
[ChangeLog][QtTest] QTest::failOnWarning() now has a no-parameter
overload to support the common case of fail-on-any-warning, without
needing to construct a match-everything regular expression.
Change-Id: Ic693f1c8619fd6e495543b85737d566134cf9d20
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp')
-rw-r--r-- | tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp index 5c521ad625..08233a1f7b 100644 --- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -2981,7 +2981,7 @@ void tst_QItemSelectionModel::destroyModel() selectionModel->setCurrentIndex(itemModel->index(1, 0), QItemSelectionModel::Select); QVERIFY(selectionModel->currentIndex().isValid()); - QTest::failOnWarning(QRegularExpression(".*")); + QTest::failOnWarning(); itemModel.reset(); QVERIFY(!selectionModel->currentIndex().isValid()); QVERIFY(selectionModel->selection().isEmpty()); |