Fix QT_NO_REGULAREXPRESSION build

Change-Id: Ibf1358733d7c5aa2c14cf46c23a24ba4da14143c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Sérgio Martins 2014-08-12 18:00:53 +01:00 committed by Marc Mutz
parent bf9a4ef8b4
commit 10b9e1b6b4
5 changed files with 18 additions and 0 deletions

View File

@ -43,6 +43,8 @@
#include "qregularexpression.h"
#ifndef QT_NO_REGULAREXPRESSION
#include <QtCore/qcoreapplication.h>
#include <QtCore/qmutex.h>
#include <QtCore/qvector.h>
@ -2495,3 +2497,5 @@ static const char *pcreCompileErrorCodes[] =
#endif // #if 0
QT_END_NAMESPACE
#endif // QT_NO_REGULAREXPRESSION

View File

@ -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
*/

View File

@ -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);

View File

@ -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)
{

View File

@ -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();