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 /src/testlib/qtestcase.h | |
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 'src/testlib/qtestcase.h')
-rw-r--r-- | src/testlib/qtestcase.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index 0ae1a787e2..a855ace6a9 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -435,6 +435,7 @@ namespace QTest #if QT_CONFIG(regularexpression) Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern); #endif + Q_TESTLIB_EXPORT void failOnWarning(); Q_TESTLIB_EXPORT void failOnWarning(const char *message); #if QT_CONFIG(regularexpression) Q_TESTLIB_EXPORT void failOnWarning(const QRegularExpression &messagePattern); |