From 7511697efe31f57d66f77729413f05d6dafc0059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 24 Jan 2019 12:18:15 +0100 Subject: testlib: Format durations using C locale XML expects '.' as the decimal separator, but when using normal %f formatting we end up depending on the user's current locale. By using QString::number() we tap into qt_doubleToAscii which forces the use of the C locale, giving predictable output. Fixes: QTBUG-73227 Change-Id: I04d1adae2ef079442605e962007e5ce3fce896b7 Reviewed-by: Frederik Gladhorn --- src/testlib/qxmltestlogger.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/testlib/qxmltestlogger.cpp b/src/testlib/qxmltestlogger.cpp index 72cb53bca7..7153c016c5 100644 --- a/src/testlib/qxmltestlogger.cpp +++ b/src/testlib/qxmltestlogger.cpp @@ -136,8 +136,9 @@ void QXmlTestLogger::startLogging() void QXmlTestLogger::stopLogging() { QTestCharBuffer buf; - QTest::qt_asprintf(&buf, - "\n", QTestLog::msecsTotalTime()); + + QTest::qt_asprintf(&buf, "\n", + QString::number(QTestLog::msecsTotalTime()).toUtf8().constData()); outputString(buf.constData()); if (xmlmode == QXmlTestLogger::Complete) { outputString("\n"); @@ -159,9 +160,9 @@ void QXmlTestLogger::leaveTestFunction() { QTestCharBuffer buf; QTest::qt_asprintf(&buf, - " \n" + " \n" "\n", - QTestLog::msecsFunctionTime()); + QString::number(QTestLog::msecsFunctionTime()).toUtf8().constData()); outputString(buf.constData()); } -- cgit v1.2.3