aboutsummaryrefslogtreecommitdiff
path: root/tests/tests.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2011-05-02 13:46:48 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2011-05-02 13:46:48 +0000
commitac9be1b32dad27209476d24249c734ca5aad66e5 (patch)
tree65c34509a5332074dff4a4508e0604435614d29c /tests/tests.cpp
parentd5b59becb1868ea53b5a7f7b61b142c79e37cc04 (diff)
downloadqxmpp-ac9be1b32dad27209476d24249c734ca5aad66e5.tar.gz
add unit tests for MUC presence extensions
Diffstat (limited to 'tests/tests.cpp')
-rw-r--r--tests/tests.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/tests.cpp b/tests/tests.cpp
index 8afc0d32..79bb1937 100644
--- a/tests/tests.cpp
+++ b/tests/tests.cpp
@@ -503,6 +503,36 @@ void TestPackets::testPresenceWithCapability()
serializePacket(presence, xml);
}
+void TestPackets::testPresenceWithMuc()
+{
+ const QByteArray xml(
+ "<presence "
+ "to=\"pistol@shakespeare.lit/harfleur\" "
+ "from=\"harfleur@henryv.shakespeare.lit/pistol\" "
+ "type=\"unavailable\">"
+ "<x xmlns=\"http://jabber.org/protocol/muc#user\">"
+ "<item affiliation=\"none\" role=\"none\">"
+ "<actor jid=\"fluellen@shakespeare.lit\"/>"
+ "<reason>Avaunt, you cullion!</reason>"
+ "</item>"
+ "<status code=\"307\"/>"
+ "</x>"
+ "</presence>");
+
+ QXmppPresence presence;
+ parsePacket(presence, xml);
+ QCOMPARE(presence.to(), QLatin1String("pistol@shakespeare.lit/harfleur"));
+ QCOMPARE(presence.from(), QLatin1String("harfleur@henryv.shakespeare.lit/pistol"));
+ QCOMPARE(presence.type(), QXmppPresence::Unavailable);
+ QCOMPARE(presence.mucItem().actor(), QLatin1String("fluellen@shakespeare.lit"));
+ QCOMPARE(presence.mucItem().affiliation(), QXmppMucItem::NoAffiliation);
+ QCOMPARE(presence.mucItem().jid(), QString());
+ QCOMPARE(presence.mucItem().reason(), QLatin1String("Avaunt, you cullion!"));
+ QCOMPARE(presence.mucItem().role(), QXmppMucItem::NoRole);
+ QCOMPARE(presence.mucStatusCodes(), QList<int>() << 307);
+ serializePacket(presence, xml);
+}
+
void TestPackets::testSession()
{
const QByteArray xml(