From 10b9e1b6b4deadfa35caefb0c8fdc5b69c63fe0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Tue, 12 Aug 2014 18:00:53 +0100 Subject: Fix QT_NO_REGULAREXPRESSION build Change-Id: Ibf1358733d7c5aa2c14cf46c23a24ba4da14143c Reviewed-by: Marc Mutz --- src/corelib/tools/qregularexpression.cpp | 4 ++++ src/testlib/qtestcase.cpp | 2 ++ src/testlib/qtestcase.h | 2 ++ src/testlib/qtestlog.cpp | 8 ++++++++ src/testlib/qtestlog_p.h | 2 ++ 5 files changed, 18 insertions(+) diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index e1cf82bb8c..257141efdc 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -43,6 +43,8 @@ #include "qregularexpression.h" +#ifndef QT_NO_REGULAREXPRESSION + #include #include #include @@ -2495,3 +2497,5 @@ static const char *pcreCompileErrorCodes[] = #endif // #if 0 QT_END_NAMESPACE + +#endif // QT_NO_REGULAREXPRESSION diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 5d2014b0c5..83cba0d672 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -2617,10 +2617,12 @@ void QTest::ignoreMessage(QtMsgType type, const char *message) \since 5.3 */ +#ifndef QT_NO_REGULAREXPRESSION void QTest::ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern) { QTestLog::ignoreMessage(type, messagePattern); } +#endif /*! \internal */ diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index d9c8a43a2a..2b9acabf95 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -248,7 +248,9 @@ namespace QTest const char *file, int line); Q_TESTLIB_EXPORT void qWarn(const char *message, const char *file = 0, int line = 0); Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const char *message); +#ifndef QT_NO_REGULAREXPRESSION Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern); +#endif Q_TESTLIB_EXPORT QString qFindTestData(const char* basepath, const char* file = 0, int line = 0, const char* builddir = 0); Q_TESTLIB_EXPORT QString qFindTestData(const QString& basepath, const char* file = 0, int line = 0, const char* builddir = 0); diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 8cca892a4d..4ef1113641 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -133,7 +133,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; @@ -359,7 +363,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 +518,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 void QTestLog::setMaxWarnings(int m) { diff --git a/src/testlib/qtestlog_p.h b/src/testlib/qtestlog_p.h index a987c45806..0ed6750f63 100644 --- a/src/testlib/qtestlog_p.h +++ b/src/testlib/qtestlog_p.h @@ -76,7 +76,9 @@ public: static void addBenchmarkResult(const QBenchmarkResult &result); static void ignoreMessage(QtMsgType type, const char *msg); +#ifndef QT_NO_REGULAREXPRESSION static void ignoreMessage(QtMsgType type, const QRegularExpression &expression); +#endif static int unhandledIgnoreMessages(); static void printUnhandledIgnoreMessages(); static void clearIgnoreMessages(); -- cgit v1.2.3