summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestresult.cpp
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2021-10-08 13:58:27 +0200
committerMitch Curtis <mitch.curtis@qt.io>2021-11-26 04:47:24 +0100
commitefb283fb7f72e950c8ecf755b960a3c1b36b5507 (patch)
tree361930e1f30586e93f3b4165a9893cdd381d2517 /src/testlib/qtestresult.cpp
parent1edf153a6bc28e127531e852a0856025ca5d91b0 (diff)
Add QTest::failOnWarning
This solves the long-standing problem of not being able to easily fail a test when a certain warning is output. [ChangeLog][QtTest] Added QTest::failOnWarning. When called in a test function, any warning that matches the given pattern will cause a test failure. The test will continue execution when a failure is added. All patterns are cleared at the end of each test function. Fixes: QTBUG-70029 Change-Id: I5763f8d4acf1cee8178be43a503619fbfb0f4f36 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/testlib/qtestresult.cpp')
-rw-r--r--src/testlib/qtestresult.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/testlib/qtestresult.cpp b/src/testlib/qtestresult.cpp
index 899f5358b5..ae40164392 100644
--- a/src/testlib/qtestresult.cpp
+++ b/src/testlib/qtestresult.cpp
@@ -191,6 +191,7 @@ void QTestResult::finishedCurrentTestData()
addFailure("Not all expected messages were received");
}
QTestLog::clearIgnoreMessages();
+ QTestLog::clearFailOnWarnings();
}
/*!