summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdatetime/tst_qdatetime.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qdatetime/tst_qdatetime.cpp')
-rw-r--r--tests/auto/qdatetime/tst_qdatetime.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp
index 6aca996..47c54a5 100644
--- a/tests/auto/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/qdatetime/tst_qdatetime.cpp
@@ -106,6 +106,8 @@ private slots:
void daysTo();
void secsTo_data();
void secsTo();
+ void msecsTo_data();
+ void msecsTo();
void operator_eqeq();
void currentDateTime();
void currentDateTimeUtc();
@@ -910,6 +912,30 @@ void tst_QDateTime::secsTo()
QVERIFY((dt >= result) == (0 >= nsecs));
}
+void tst_QDateTime::msecsTo_data()
+{
+ addMSecs_data();
+}
+
+void tst_QDateTime::msecsTo()
+{
+ QFETCH(QDateTime, dt);
+ QFETCH(int, nsecs);
+ QFETCH(QDateTime, result);
+
+#ifdef Q_OS_IRIX
+ QEXPECT_FAIL("cet4", "IRIX databases say 1970 had DST", Abort);
+#endif
+ QCOMPARE(dt.msecsTo(result), qint64(nsecs) * 1000);
+ QCOMPARE(result.msecsTo(dt), -qint64(nsecs) * 1000);
+ QVERIFY((dt == result) == (0 == (qint64(nsecs) * 1000)));
+ QVERIFY((dt != result) == (0 != (qint64(nsecs) * 1000)));
+ QVERIFY((dt < result) == (0 < (qint64(nsecs) * 1000)));
+ QVERIFY((dt <= result) == (0 <= (qint64(nsecs) * 1000)));
+ QVERIFY((dt > result) == (0 > (qint64(nsecs) * 1000)));
+ QVERIFY((dt >= result) == (0 >= (qint64(nsecs) * 1000)));
+}
+
void tst_QDateTime::currentDateTime()
{
#if defined(Q_OS_WINCE)