diff options
author | John Layt <jlayt@kde.org> | 2013-02-11 13:44:37 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-23 01:14:03 +0200 |
commit | 55f5b29d7975d7e642ec258e44ca23726e1dfa0d (patch) | |
tree | a962c946ed58690d67bba1982556f3cb97545969 /tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | |
parent | 8af776d4140c19baccb8e2767ed8b57cc79ccb06 (diff) |
QDateTime - Add QTimeZone support
Add support to QDateTime for time zones using the new QTimeZone class.
[ChangeLog][QtCore][QDateTime] Add support for a new Qt::TimeZone
spec to be used with QTimeZone to define times in a specific
time zone.
Change-Id: I21bfa52a8ba8989b55bb74e025d1f2b2b623b2a7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools/qlocale/tst_qlocale.cpp')
-rw-r--r-- | tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index ea0e90a503..8411cfe29b 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -1303,6 +1303,18 @@ void tst_QLocale::formatTimeZone() QSKIP("You must test using Central European (CET/CEST) time zone, e.g. TZ=Europe/Oslo"); } + QDateTime dt6(QDate(2013, 1, 1), QTime(0, 0, 0), QTimeZone("Europe/Berlin")); +#ifdef Q_OS_WIN + QEXPECT_FAIL("", "QTimeZone windows backend only returns long name", Continue); +#endif + QCOMPARE(enUS.toString(dt6, "t"), QString("CET")); + + QDateTime dt7(QDate(2013, 6, 1), QTime(0, 0, 0), QTimeZone("Europe/Berlin")); +#ifdef Q_OS_WIN + QEXPECT_FAIL("", "QTimeZone windows backend only returns long name", Continue); +#endif + QCOMPARE(enUS.toString(dt7, "t"), QString("CEST")); + // Current datetime should return current abbreviation QCOMPARE(enUS.toString(QDateTime::currentDateTime(), "t"), QDateTime::currentDateTime().timeZoneAbbreviation()); |