aboutsummaryrefslogtreecommitdiff
path: root/tests/tests.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-07-17 11:33:24 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-07-17 11:33:24 +0200
commita128ad2833e1444e430270b4f312b5a698053a33 (patch)
tree6e66e533dac6e21b37749a153e5fc8b102980720 /tests/tests.cpp
parentb1b30b840cb0930017fcb48bbfa73e746b707001 (diff)
downloadqxmpp-a128ad2833e1444e430270b4f312b5a698053a33.tar.gz
add result-set management to QXmppArchiveIq
Diffstat (limited to 'tests/tests.cpp')
-rw-r--r--tests/tests.cpp35
1 files changed, 32 insertions, 3 deletions
diff --git a/tests/tests.cpp b/tests/tests.cpp
index 501ec184..9f7bbb16 100644
--- a/tests/tests.cpp
+++ b/tests/tests.cpp
@@ -229,9 +229,13 @@ void TestPackets::testArchiveList()
serializePacket(iq, xml);
}
-void TestPackets::testArchiveChat()
+void TestPackets::testArchiveChat_data()
{
- const QByteArray xml(
+ QTest::addColumn<QByteArray>("xml");
+ QTest::addColumn<int>("count");
+
+ QTest::newRow("no rsm") <<
+ QByteArray(
"<iq id=\"chat_1\" type=\"result\">"
"<chat xmlns=\"urn:xmpp:archive\""
" with=\"juliet@capulet.com\""
@@ -243,7 +247,31 @@ void TestPackets::testArchiveChat()
"<to secs=\"11\"><body>Neither, fair saint, if either thee dislike.</body></to>"
"<from secs=\"7\"><body>How cam'st thou hither, tell me, and wherefore?</body></from>"
"</chat>"
- "</iq>");
+ "</iq>") << -1;
+
+ QTest::newRow("with rsm") <<
+ QByteArray(
+ "<iq id=\"chat_1\" type=\"result\">"
+ "<chat xmlns=\"urn:xmpp:archive\""
+ " with=\"juliet@capulet.com\""
+ " start=\"1469-07-21T02:56:15Z\""
+ " subject=\"She speaks!\""
+ " version=\"4\""
+ ">"
+ "<from secs=\"0\"><body>Art thou not Romeo, and a Montague?</body></from>"
+ "<to secs=\"11\"><body>Neither, fair saint, if either thee dislike.</body></to>"
+ "<from secs=\"7\"><body>How cam'st thou hither, tell me, and wherefore?</body></from>"
+ "<set xmlns=\"http://jabber.org/protocol/rsm\">"
+ "<count>3</count>"
+ "</set>"
+ "</chat>"
+ "</iq>") << 3;
+}
+
+void TestPackets::testArchiveChat()
+{
+ QFETCH(QByteArray, xml);
+ QFETCH(int, count);
QXmppArchiveChatIq iq;
parsePacket(iq, xml);
@@ -260,6 +288,7 @@ void TestPackets::testArchiveChat()
QCOMPARE(iq.chat().messages()[2].isReceived(), true);
QCOMPARE(iq.chat().messages()[2].date(), QDateTime(QDate(1469, 7, 21), QTime(2, 56, 33), Qt::UTC));
QCOMPARE(iq.chat().messages()[2].body(), QLatin1String("How cam'st thou hither, tell me, and wherefore?"));
+ QCOMPARE(iq.resultSetReply().count(), count);
serializePacket(iq, xml);
}