diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-11-08 09:20:04 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-11-08 09:20:04 +0000 |
| commit | cb8b6cb286e923dfc8b7fe0fa9d30a4da3b84e95 (patch) | |
| tree | 16b51d09ce95ac239ac112f65e4d81d41549dc04 /tests | |
| parent | 28e7ee24b62c06c64e63d49c24bf6e4337a6941c (diff) | |
| download | qxmpp-cb8b6cb286e923dfc8b7fe0fa9d30a4da3b84e95.tar.gz | |
add methods for parsing/serialising timezone offsets
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/tests.cpp | 15 | ||||
| -rw-r--r-- | tests/tests.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/tests.cpp b/tests/tests.cpp index 0e985b74..53e499fc 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -138,6 +138,21 @@ void TestUtils::testLibVersion() QCOMPARE(QXmppVersion(), QString("0.2.90")); } +void TestUtils::testTimezoneOffset() +{ + // parsing + QCOMPARE(timezoneOffsetFromString("Z"), 0); + QCOMPARE(timezoneOffsetFromString("+00:00"), 0); + QCOMPARE(timezoneOffsetFromString("-00:00"), 0); + QCOMPARE(timezoneOffsetFromString("+01:30"), 5400); + QCOMPARE(timezoneOffsetFromString("-01:30"), -5400); + + // serialization + QCOMPARE(timezoneOffsetToString(0), QLatin1String("Z")); + QCOMPARE(timezoneOffsetToString(5400), QLatin1String("+01:30")); + QCOMPARE(timezoneOffsetToString(-5400), QLatin1String("-01:30")); +} + template <class T> static void parsePacket(T &packet, const QByteArray &xml) { diff --git a/tests/tests.h b/tests/tests.h index 5be6b0af..59a5b23d 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -35,6 +35,7 @@ private slots: void testJid(); void testMime(); void testLibVersion(); + void testTimezoneOffset(); }; class TestPackets : public QObject |
