From dc534ee2fee6e7907544f4831a3b264c6fd05779 Mon Sep 17 00:00:00 2001 From: Manjeet Dahiya Date: Sun, 12 Sep 2010 08:48:56 +0000 Subject: test Entity Time Iq --- tests/tests.cpp | 39 +++++++++++++++++++++++++++++++++++++++ tests/tests.h | 2 ++ 2 files changed, 41 insertions(+) (limited to 'tests') 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("" + ""); + + 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( + "" + "" + ""); + + 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( diff --git a/tests/tests.h b/tests/tests.h index 3c248645..fccb12f3 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -61,6 +61,8 @@ private slots: void testVCard(); void testVersionGet(); void testVersionResult(); + void testEntityTimeGet(); + void testEntityTimeResult(); }; class TestJingle : public QObject -- cgit v1.2.3