[Pkg-owncloud-commits] [owncloud-client] 465/470: timeAgo test: Fix for qt4, clean up

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu May 12 16:25:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 49a678a26fe02b55437ea0766078795901db1f0e
Author: Christian Kamm <mail at ckamm.de>
Date:   Thu May 12 09:25:15 2016 +0200

    timeAgo test: Fix for qt4, clean up
---
 test/testutility.cpp | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/test/testutility.cpp b/test/testutility.cpp
index a2cfffa..b8f8c1a 100644
--- a/test/testutility.cpp
+++ b/test/testutility.cpp
@@ -136,34 +136,27 @@ private slots:
 
     void testTimeAgo()
     {
-        // Both times in local time
+        // Both times in same timezone
         QDateTime d1 = QDateTime::fromString("2015-01-24T09:20:30+01:00", Qt::ISODate);
         QDateTime d2 = QDateTime::fromString("2015-01-23T09:20:30+01:00", Qt::ISODate);
         QString s = timeAgoInWords(d2, d1);
         QCOMPARE(s, QLatin1String("1 day(s) ago"));
 
-        //
+        // Different timezones
         QDateTime earlyTS = QDateTime::fromString("2015-01-24T09:20:30+01:00", Qt::ISODate);
-        earlyTS.setTimeSpec(Qt::UTC);
-        QDateTime laterTS = earlyTS.toOffsetFromUtc(3600);
-        laterTS.setTimeSpec(Qt::UTC);
+        QDateTime laterTS = QDateTime::fromString("2015-01-24T09:20:30-01:00", Qt::ISODate);
         s = timeAgoInWords(earlyTS, laterTS);
-        QCOMPARE(s, QLatin1String("1 hour(s) ago"));
+        QCOMPARE(s, QLatin1String("2 hour(s) ago"));
 
+        // 'Now' in whatever timezone
         earlyTS = QDateTime::currentDateTime();
-
-        laterTS.setTimeSpec(Qt::LocalTime);
-        laterTS.setTimeZone( QTimeZone("Pacific/Easter") );
         laterTS = earlyTS;
-
         s = timeAgoInWords(earlyTS, laterTS );
         QCOMPARE(s, QLatin1String("now"));
 
         earlyTS = earlyTS.addSecs(-6);
         s = timeAgoInWords(earlyTS, laterTS );
         QCOMPARE(s, QLatin1String("Less than a minute ago"));
-
-
     }
 };
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list