summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-11-12 15:03:54 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-17 19:10:22 +0100
commit943ae8bb701a8187d295b747ba82025c55ca9add (patch)
treec851d2d4d82d53a5df7f32a175996d425821cc17 /src/testlib/qtestcase.cpp
parent331bc16afd23414493b842819e0b747e8f364243 (diff)
Add overload of QTest::ignoreMessage() taking a QRegularExpression.
Make it possible to match messages by a pattern. Change-Id: I713312e86db5471755459f1ecc43e8f1ac7a95fb Reviewed-by: Jason McDonald <macadder1@gmail.com>
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r--src/testlib/qtestcase.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 755720a98c..b09bd6701c 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -2332,6 +2332,27 @@ void QTest::ignoreMessage(QtMsgType type, const char *message)
QTestLog::ignoreMessage(type, message);
}
+/*!
+ \overload
+
+ Ignores messages created by qDebug() or qWarning(). If the \a message
+ matching \a messagePattern
+ with the corresponding \a type is outputted, it will be removed from the
+ test log. If the test finished and the \a message was not outputted,
+ a test failure is appended to the test log.
+
+ \b {Note:} Invoking this function will only ignore one message.
+ If the message you want to ignore is outputted twice, you have to
+ call ignoreMessage() twice, too.
+
+ \since 5.3
+*/
+
+void QTest::ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern)
+{
+ QTestLog::ignoreMessage(type, messagePattern);
+}
+
/*! \internal
*/