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 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'tests/tests.cpp') 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( -- cgit v1.2.3