From e77a0908fa96a9f7c53a00971e5082ac3a39f7d8 Mon Sep 17 00:00:00 2001 From: Manjeet Dahiya Date: Tue, 5 Oct 2010 06:04:51 +0000 Subject: tests for capability --- tests/tests.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests/tests.cpp') diff --git a/tests/tests.cpp b/tests/tests.cpp index 8d0f75af..177d025e 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -452,6 +452,35 @@ void TestPackets::testPresenceWithVCardUpdate() serializePacket(presence, xml); } +void TestPackets::testPresenceWithCapability() +{ + const QByteArray xml( + "" + "away" + "In a meeting" + "5" + "" + "sha1-hash-of-image" + "" + "" + ""); + + QXmppPresence presence; + parsePacket(presence, xml); + QCOMPARE(presence.to(), QString("foo@example.com/QXmpp")); + QCOMPARE(presence.from(), QString("bar@example.com/QXmpp")); + QCOMPARE(presence.status().type(), QXmppPresence::Status::Away); + QCOMPARE(presence.status().statusText(), QString("In a meeting")); + QCOMPARE(presence.status().priority(), 5); + QCOMPARE(presence.photoHash(), QByteArray("sha1-hash-of-image")); + QCOMPARE(presence.vCardUpdateType(), QXmppPresence::PhotoAdvertised); + QCOMPARE(presence.capabilityHash(), QString("sha-1")); + QCOMPARE(presence.capabilityNode(), QString("http://code.google.com/p/qxmpp")); + QCOMPARE(presence.capabilityVer(), QString("QgayPKawpkPSDYmwT/WM94uAlu0=")); + + serializePacket(presence, xml); +} + void TestPackets::testSession() { const QByteArray xml( -- cgit v1.2.3