diff options
Diffstat (limited to 'src/testlib/qtestlog.cpp')
-rw-r--r-- | src/testlib/qtestlog.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index dca4bc1c10..929ccb370b 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -179,7 +179,7 @@ namespace QTest { static bool handleFailOnWarning(const QMessageLogContext &context, const QString &message) { - // failOnWarnings can be called multiple times per test function, so let + // failOnWarning can be called multiple times per test function, so let // each call cause a failure if required. for (const auto &pattern : failOnWarningList) { if (pattern.metaType() == QMetaType::fromType<QString>()) { @@ -318,7 +318,6 @@ void QTestLog::clearIgnoreMessages() QTest::IgnoreResultList::clearList(QTest::ignoreResultList); } - void QTestLog::clearFailOnWarnings() { QTest::failOnWarningList.clear(); @@ -326,6 +325,8 @@ void QTestLog::clearFailOnWarnings() void QTestLog::clearCurrentTestState() { + clearIgnoreMessages(); + clearFailOnWarnings(); QTest::currentTestState = QTest::Unresolved; } @@ -559,6 +560,21 @@ bool QTestLog::hasLoggers() return !QTest::loggers()->empty(); } +/*! + \internal + + Returns true if all loggers support repeated test runs +*/ +bool QTestLog::isRepeatSupported() +{ + FOREACH_TEST_LOGGER { + if (!logger->isRepeatSupported()) + return false; + } + + return true; +} + bool QTestLog::loggerUsingStdout() { FOREACH_TEST_LOGGER { @@ -613,6 +629,11 @@ void QTestLog::ignoreMessage(QtMsgType type, const QRegularExpression &expressio } #endif // QT_CONFIG(regularexpression) +void QTestLog::failOnWarning() +{ + QTest::failOnWarningList.push_back({}); +} + void QTestLog::failOnWarning(const char *msg) { QTest::failOnWarningList.push_back(QString::fromUtf8(msg)); |