From a128ad2833e1444e430270b4f312b5a698053a33 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Tue, 17 Jul 2012 11:33:24 +0200 Subject: add result-set management to QXmppArchiveIq --- tests/tests.cpp | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'tests/tests.cpp') 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("xml"); + QTest::addColumn("count"); + + QTest::newRow("no rsm") << + QByteArray( "" "Neither, fair saint, if either thee dislike." "How cam'st thou hither, tell me, and wherefore?" "" - ""); + "") << -1; + + QTest::newRow("with rsm") << + QByteArray( + "" + "" + "Art thou not Romeo, and a Montague?" + "Neither, fair saint, if either thee dislike." + "How cam'st thou hither, tell me, and wherefore?" + "" + "3" + "" + "" + "") << 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); } -- cgit v1.2.3