summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2014-07-10 21:26:20 +0200
committerOlivier Goffart <ogoffart@woboq.com>2014-07-13 18:20:42 +0200
commitb6bce68a64ac25489b5cca825ab6840e3fca21ee (patch)
tree42b21958211febf4acea0beb6a8f7d1eb8010b4d /tests/auto/corelib/global/qlogging/tst_qlogging.cpp
parent9bb493e724e54643eea79f4343ac1d68c3350333 (diff)
Logging: fix support for %{time format} in QT_MESSAGE_PATTERN
This revert commit de1d5815c15ba1f944752cf7d441442efeb0accb which wrongly fixed a typo. There is no typo because we use startsWith with that constant. Also added a test because the %{time} support was added in commit 93563952d00f865b73136f6a316ca2b8732db85f but the test was missing Change-Id: Ic96e6f21f989ca3a2905ec6c89b93d2627b77b40 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'tests/auto/corelib/global/qlogging/tst_qlogging.cpp')
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index 462d56908a..3c1a26c629 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -688,6 +688,19 @@ void tst_qmessagehandler::qMessagePattern_data()
<< "QT_MESSAGE_PATTERN: %{if-*} cannot be nested"
<< "A DEBUG qDebug "
<< "A qWarning ");
+
+ // This test won't work when midnight is too close... wait a bit
+ while (QTime::currentTime() > QTime(23, 59, 30))
+ QTest::qWait(10000);
+ QTest::newRow("time") << "/%{time yyyy - MM - d}/%{message}"
+ << true << (QList<QByteArray>()
+ << ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toUtf8() + "/qDebug"));
+
+ // %{time} should have a padding of 6 so if it takes less than 10 seconds to show
+ // the first message, there should be 5 spaces
+ QTest::newRow("time") << "<%{time}>%{message}" << true << (QList<QByteArray>()
+ << "< ");
+
}