diff options
| author | Manjeet Dahiya <manjeetdahiya@gmail.com> | 2010-09-12 08:48:56 +0000 |
|---|---|---|
| committer | Manjeet Dahiya <manjeetdahiya@gmail.com> | 2010-09-12 08:48:56 +0000 |
| commit | dc534ee2fee6e7907544f4831a3b264c6fd05779 (patch) | |
| tree | 357c9f635f11ed4b325303042c7f1edf392d4c26 /tests/tests.cpp | |
| parent | 9f5bd9419ca84149e7808fe8cf83312abfbcd682 (diff) | |
| download | qxmpp-dc534ee2fee6e7907544f4831a3b264c6fd05779.tar.gz | |
test Entity Time Iq
Diffstat (limited to 'tests/tests.cpp')
| -rw-r--r-- | tests/tests.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/tests.cpp b/tests/tests.cpp index 0d809045..f84aeb6a 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -44,6 +44,7 @@ #include "QXmppVCardIq.h" #include "QXmppVersionIq.h" #include "QXmppGlobal.h" +#include "QXmppEntityTimeIq.h" #include "tests.h" QString getImageType(const QByteArray &contents); @@ -576,6 +577,44 @@ void TestPackets::testVersionResult() serializePacket(verIqResult, xmlResult); } +void TestPackets::testEntityTimeGet() +{ + const QByteArray xml("<iq id=\"time_1\" " + "to=\"juliet@capulet.com/balcony\" " + "from=\"romeo@montague.net/orchard\" type=\"get\">" + "<time xmlns=\"urn:xmpp:time\"/>" + "</iq>"); + + QXmppEntityTimeIq entityTime; + parsePacket(entityTime, xml); + QCOMPARE(entityTime.id(), QLatin1String("time_1")); + QCOMPARE(entityTime.to(), QLatin1String("juliet@capulet.com/balcony")); + QCOMPARE(entityTime.from(), QLatin1String("romeo@montague.net/orchard")); + QCOMPARE(entityTime.type(), QXmppIq::Get); + serializePacket(entityTime, xml); +} + +void TestPackets::testEntityTimeResult() +{ + const QByteArray xml( + "<iq id=\"time_1\" to=\"romeo@montague.net/orchard\" from=\"juliet@capulet.com/balcony\" type=\"result\">" + "<time xmlns=\"urn:xmpp:time\">" + "<tzo>-06:00</tzo>" + "<utc>2006-12-19T17:58:35Z</utc>" + "</time>" + "</iq>"); + + QXmppEntityTimeIq entityTime; + parsePacket(entityTime, xml); + QCOMPARE(entityTime.id(), QLatin1String("time_1")); + QCOMPARE(entityTime.from(), QLatin1String("juliet@capulet.com/balcony")); + QCOMPARE(entityTime.to(), QLatin1String("romeo@montague.net/orchard")); + QCOMPARE(entityTime.type(), QXmppIq::Result); + QCOMPARE(entityTime.tzo(), QString("-06:00")); + QCOMPARE(entityTime.utc(), QString("2006-12-19T17:58:35Z")); + serializePacket(entityTime, xml); +} + void TestJingle::testSession() { const QByteArray xml( |
