Fix QtTestlib build under QT_NO_REGULAREXPRESSION
Change-Id: I4458226e814641269062990f272a40ca577bc9db Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
77425eefec
commit
4c14fa607f
@ -2601,6 +2601,7 @@ void QTest::ignoreMessage(QtMsgType type, const char *message)
|
|||||||
QTestLog::ignoreMessage(type, message);
|
QTestLog::ignoreMessage(type, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_REGULAREXPRESSION
|
||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
|
|
||||||
@ -2621,6 +2622,7 @@ void QTest::ignoreMessage(QtMsgType type, const QRegularExpression &messagePatte
|
|||||||
{
|
{
|
||||||
QTestLog::ignoreMessage(type, messagePattern);
|
QTestLog::ignoreMessage(type, messagePattern);
|
||||||
}
|
}
|
||||||
|
#endif // QT_NO_REGULAREXPRESSION
|
||||||
|
|
||||||
/*! \internal
|
/*! \internal
|
||||||
*/
|
*/
|
||||||
|
@ -248,7 +248,9 @@ namespace QTest
|
|||||||
const char *file, int line);
|
const char *file, int line);
|
||||||
Q_TESTLIB_EXPORT void qWarn(const char *message, const char *file = 0, int line = 0);
|
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);
|
Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const char *message);
|
||||||
|
#ifndef QT_NO_REGULAREXPRESSION
|
||||||
Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern);
|
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 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);
|
Q_TESTLIB_EXPORT QString qFindTestData(const QString& basepath, const char* file = 0, int line = 0, const char* builddir = 0);
|
||||||
|
@ -133,7 +133,11 @@ namespace QTest {
|
|||||||
return tp == type
|
return tp == type
|
||||||
&& (pattern.type() == QVariant::String ?
|
&& (pattern.type() == QVariant::String ?
|
||||||
stringsMatch(pattern.toString(), message) :
|
stringsMatch(pattern.toString(), message) :
|
||||||
|
#ifndef QT_NO_REGULAREXPRESSION
|
||||||
pattern.toRegularExpression().match(message).hasMatch());
|
pattern.toRegularExpression().match(message).hasMatch());
|
||||||
|
#else
|
||||||
|
false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QtMsgType type;
|
QtMsgType type;
|
||||||
@ -359,7 +363,9 @@ void QTestLog::printUnhandledIgnoreMessages()
|
|||||||
if (list->pattern.type() == QVariant::String) {
|
if (list->pattern.type() == QVariant::String) {
|
||||||
message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"');
|
message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"');
|
||||||
} else {
|
} else {
|
||||||
|
#ifndef QT_NO_REGULAREXPRESSION
|
||||||
message = QStringLiteral("Did not receive any message matching: \"") + list->pattern.toRegularExpression().pattern() + QLatin1Char('"');
|
message = QStringLiteral("Did not receive any message matching: \"") + list->pattern.toRegularExpression().pattern() + QLatin1Char('"');
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, message);
|
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));
|
QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QString::fromLocal8Bit(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_REGULAREXPRESSION
|
||||||
void QTestLog::ignoreMessage(QtMsgType type, const QRegularExpression &expression)
|
void QTestLog::ignoreMessage(QtMsgType type, const QRegularExpression &expression)
|
||||||
{
|
{
|
||||||
QTEST_ASSERT(expression.isValid());
|
QTEST_ASSERT(expression.isValid());
|
||||||
|
|
||||||
QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QVariant(expression));
|
QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QVariant(expression));
|
||||||
}
|
}
|
||||||
|
#endif // QT_NO_REGULAREXPRESSION
|
||||||
|
|
||||||
void QTestLog::setMaxWarnings(int m)
|
void QTestLog::setMaxWarnings(int m)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user