diff options
Diffstat (limited to 'src/testlib/qtestlog.cpp')
-rw-r--r-- | src/testlib/qtestlog.cpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 4ef1113641..b7ed3d0763 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtTest module of the Qt Toolkit. @@ -59,8 +59,6 @@ QT_BEGIN_NAMESPACE -Q_CORE_EXPORT QString qMessageFormatString(QtMsgType type, const QMessageLogContext &context, const QString& msg); - static void saveCoverageTool(const char * appname, bool testfailed, bool installedTestCoverage) { #ifdef __COVERAGESCANNER__ @@ -86,6 +84,7 @@ namespace QTest { int fails = 0; int passes = 0; int skips = 0; + int blacklists = 0; struct IgnoreResultList { @@ -287,7 +286,7 @@ namespace QTest { // the message is expected, so just swallow it. return; - QString msg = qMessageFormatString(type, context, message); + QString msg = qFormatLogMessage(type, context, message); msg.chop(1); // remove trailing newline if (type != QtFatalMsg) { @@ -417,6 +416,25 @@ void QTestLog::addXPass(const char *msg, const char *file, int line) QTest::TestLoggers::addIncident(QAbstractTestLogger::XPass, msg, file, line); } +void QTestLog::addBPass(const char *msg) +{ + QTEST_ASSERT(msg); + + ++QTest::blacklists; + + QTest::TestLoggers::addIncident(QAbstractTestLogger::BlacklistedPass, msg); +} + +void QTestLog::addBFail(const char *msg, const char *file, int line) +{ + QTEST_ASSERT(msg); + QTEST_ASSERT(file); + + ++QTest::blacklists; + + QTest::TestLoggers::addIncident(QAbstractTestLogger::BlacklistedFail, msg, file, line); +} + void QTestLog::addSkip(const char *msg, const char *file, int line) { QTEST_ASSERT(msg); @@ -525,7 +543,7 @@ void QTestLog::ignoreMessage(QtMsgType type, const QRegularExpression &expressio QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QVariant(expression)); } -#endif +#endif // QT_NO_REGULAREXPRESSION void QTestLog::setMaxWarnings(int m) { @@ -554,6 +572,11 @@ int QTestLog::skipCount() return QTest::skips; } +int QTestLog::blacklistCount() +{ + return QTest::blacklists; +} + void QTestLog::resetCounters() { QTest::passes = 0; |