Logging: fix support for %{time format} in QT_MESSAGE_PATTERN
This revert commitbb10de1d5815c1which 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 commit93563952d0but the test was missing Change-Id: Ic96e6f21f989ca3a2905ec6c89b93d2627b77b40 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
parent
9bb493e724
commit
b6bce68a64
|
|
@ -762,7 +762,7 @@ static const char functionTokenC[] = "%{function}";
|
|||
static const char pidTokenC[] = "%{pid}";
|
||||
static const char appnameTokenC[] = "%{appname}";
|
||||
static const char threadidTokenC[] = "%{threadid}";
|
||||
static const char timeTokenC[] = "%{time}";
|
||||
static const char timeTokenC[] = "%{time"; //not a typo: this command has arguments
|
||||
static const char ifCategoryTokenC[] = "%{if-category}";
|
||||
static const char ifDebugTokenC[] = "%{if-debug}";
|
||||
static const char ifWarningTokenC[] = "%{if-warning}";
|
||||
|
|
|
|||
|
|
@ -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>()
|
||||
<< "< ");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue