aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-07-22 01:28:11 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-07-22 01:28:11 +0200
commita50967ee0123eee75711b7f336e453654f2e06af (patch)
tree40278b7844ae8112a8b2a8bee3f9cdac2a7e2eb6 /tests
parent4c8dc9678157cb1c663365f9cbd3b4bc056ba892 (diff)
downloadqxmpp-a50967ee0123eee75711b7f336e453654f2e06af.tar.gz
extend test coverage
Diffstat (limited to 'tests')
-rw-r--r--tests/roster.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/tests/roster.cpp b/tests/roster.cpp
index 96f0fe49..07e926e7 100644
--- a/tests/roster.cpp
+++ b/tests/roster.cpp
@@ -31,18 +31,24 @@ void tst_QXmppRosterIq::testItem_data()
QTest::addColumn<QByteArray>("xml");
QTest::addColumn<int>("subscriptionType");
- QTest::newRow("notset")
- << QByteArray("<item/>")
- << int(QXmppRosterIq::Item::NotSet);
+ QTest::newRow("none")
+ << QByteArray("<item jid=\"foo@example.com\" subscription=\"none\"/>")
+ << int(QXmppRosterIq::Item::None);
QTest::newRow("from")
- << QByteArray("<item subscription=\"from\"/>")
+ << QByteArray("<item jid=\"foo@example.com\" subscription=\"from\"/>")
<< int(QXmppRosterIq::Item::From);
QTest::newRow("to")
- << QByteArray("<item subscription=\"to\"/>")
+ << QByteArray("<item jid=\"foo@example.com\" subscription=\"to\"/>")
<< int(QXmppRosterIq::Item::To);
QTest::newRow("both")
- << QByteArray("<item subscription=\"both\"/>")
+ << QByteArray("<item jid=\"foo@example.com\" subscription=\"both\"/>")
<< int(QXmppRosterIq::Item::Both);
+ QTest::newRow("remove")
+ << QByteArray("<item jid=\"foo@example.com\" subscription=\"remove\"/>")
+ << int(QXmppRosterIq::Item::Remove);
+ QTest::newRow("notset")
+ << QByteArray("<item jid=\"foo@example.com\"/>")
+ << int(QXmppRosterIq::Item::NotSet);
}
void tst_QXmppRosterIq::testItem()
@@ -52,7 +58,11 @@ void tst_QXmppRosterIq::testItem()
QXmppRosterIq::Item item;
parsePacket(item, xml);
+ QCOMPARE(item.bareJid(), QLatin1String("foo@example.com"));
+ QCOMPARE(item.groups(), QSet<QString>());
+ QCOMPARE(item.name(), QString());
QCOMPARE(int(item.subscriptionType()), subscriptionType);
+ QCOMPARE(item.subscriptionStatus(), QString());
serializePacket(item, xml);
}