aboutsummaryrefslogtreecommitdiff
path: root/tests/tests.cpp
diff options
context:
space:
mode:
authorManjeet Dahiya <manjeetdahiya@gmail.com>2010-10-05 06:04:51 +0000
committerManjeet Dahiya <manjeetdahiya@gmail.com>2010-10-05 06:04:51 +0000
commite77a0908fa96a9f7c53a00971e5082ac3a39f7d8 (patch)
tree6811b499e48e073e131e8979b3155c499aec420d /tests/tests.cpp
parent96333f97a2884980980453e34824384b49e9b2c9 (diff)
downloadqxmpp-e77a0908fa96a9f7c53a00971e5082ac3a39f7d8.tar.gz
tests for capability
Diffstat (limited to 'tests/tests.cpp')
-rw-r--r--tests/tests.cpp29
1 files changed, 29 insertions, 0 deletions
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(
+ "<presence to=\"foo@example.com/QXmpp\" from=\"bar@example.com/QXmpp\">"
+ "<show>away</show>"
+ "<status>In a meeting</status>"
+ "<priority>5</priority>"
+ "<x xmlns=\"vcard-temp:x:update\">"
+ "<photo>sha1-hash-of-image</photo>"
+ "</x>"
+ "<c xmlns=\"http://jabber.org/protocol/caps\" hash=\"sha-1\" node=\"http://code.google.com/p/qxmpp\" ver=\"QgayPKawpkPSDYmwT/WM94uAlu0=\"/>"
+ "</presence>");
+
+ 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(