diff options
Diffstat (limited to 'src/testlib/qtestlog.cpp')
-rw-r--r-- | src/testlib/qtestlog.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 8cca892a4d..708a91b557 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__ @@ -133,7 +131,11 @@ namespace QTest { return tp == type && (pattern.type() == QVariant::String ? stringsMatch(pattern.toString(), message) : +#ifndef QT_NO_REGULAREXPRESSION pattern.toRegularExpression().match(message).hasMatch()); +#else + false); +#endif } QtMsgType type; @@ -283,7 +285,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) { @@ -359,7 +361,9 @@ void QTestLog::printUnhandledIgnoreMessages() if (list->pattern.type() == QVariant::String) { message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"'); } else { +#ifndef QT_NO_REGULAREXPRESSION message = QStringLiteral("Did not receive any message matching: \"") + list->pattern.toRegularExpression().pattern() + QLatin1Char('"'); +#endif } QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, message); @@ -512,12 +516,14 @@ void QTestLog::ignoreMessage(QtMsgType type, const char *msg) QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QString::fromLocal8Bit(msg)); } +#ifndef QT_NO_REGULAREXPRESSION void QTestLog::ignoreMessage(QtMsgType type, const QRegularExpression &expression) { QTEST_ASSERT(expression.isValid()); QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QVariant(expression)); } +#endif // QT_NO_REGULAREXPRESSION void QTestLog::setMaxWarnings(int m) { |