SyncEngineTest: Fix date locale related bug
authorChristian Kamm <mail@ckamm.de>
Wed, 14 Jun 2017 10:01:32 +0000 (12:01 +0200)
committerChristian Kamm <mail@ckamm.de>
Thu, 15 Jun 2017 11:53:57 +0000 (13:53 +0200)
The client is very picky about date strings it accepts. If dates are
formatted with a non-C locale (such as localized weekday names), it
fails to parse it and tests fail in subtle ways.

test/syncenginetestutils.h

index 64b06328402b14610d953afbef9886433b916539..5be71e0f703136fe0eb291e6d51f00c1612589e9 100644 (file)
@@ -346,7 +346,7 @@ public:
                 xml.writeEmptyElement(davUri, QStringLiteral("resourcetype"));
 
             auto gmtDate = fileInfo.lastModified.toTimeZone(QTimeZone(0));
-            auto stringDate = gmtDate.toString("ddd, dd MMM yyyy HH:mm:ss 'GMT'");
+            auto stringDate = QLocale::c().toString(gmtDate, "ddd, dd MMM yyyy HH:mm:ss 'GMT'");
             xml.writeTextElement(davUri, QStringLiteral("getlastmodified"), stringDate);
             xml.writeTextElement(davUri, QStringLiteral("getcontentlength"), QString::number(fileInfo.size));
             xml.writeTextElement(davUri, QStringLiteral("getetag"), fileInfo.etag);