From 95a225b32b71fc84d9ace084427c9980d5908200 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Thu, 27 Sep 2012 21:21:16 +0200 Subject: split some more tests --- tests/all/tests.cpp | 170 +--------------------------------------------------- 1 file changed, 1 insertion(+), 169 deletions(-) (limited to 'tests/all/tests.cpp') diff --git a/tests/all/tests.cpp b/tests/all/tests.cpp index 230fbf6f..48f0480c 100644 --- a/tests/all/tests.cpp +++ b/tests/all/tests.cpp @@ -22,16 +22,15 @@ * */ -#include "QXmppArchiveIq.h" #include "QXmppBindIq.h" #include "QXmppDiscoveryIq.h" +#include "QXmppEntityTimeIq.h" #include "QXmppNonSASLAuth.h" #include "QXmppPubSubIq.h" #include "QXmppSessionIq.h" #include "QXmppStreamFeatures.h" #include "QXmppUtils.h" #include "QXmppVersionIq.h" -#include "QXmppEntityTimeIq.h" #include "util.h" class TestPackets : public QObject @@ -39,13 +38,6 @@ class TestPackets : public QObject Q_OBJECT private slots: - void testArchiveList_data(); - void testArchiveList(); - void testArchiveChat_data(); - void testArchiveChat(); - void testArchiveRemove(); - void testArchiveRetrieve_data(); - void testArchiveRetrieve(); void testBindNoResource(); void testBindResource(); void testBindResult(); @@ -60,166 +52,6 @@ private slots: void testEntityTimeResult(); }; -void TestPackets::testArchiveList_data() -{ - QTest::addColumn("xml"); - QTest::addColumn("max"); - - QTest::newRow("no rsm") << - QByteArray( - "" - "" - "") << -1; - - QTest::newRow("with rsm") << - QByteArray( - "" - "" - "" - "30" - "" - "" - "") << 30; -} - -void TestPackets::testArchiveList() -{ - QFETCH(QByteArray, xml); - QFETCH(int, max); - - QXmppArchiveListIq iq; - parsePacket(iq, xml); - QCOMPARE(iq.type(), QXmppIq::Get); - QCOMPARE(iq.id(), QLatin1String("list_1")); - QCOMPARE(iq.with(), QLatin1String("juliet@capulet.com")); - QCOMPARE(iq.start(), QDateTime(QDate(1469, 7, 21), QTime(2, 0, 0), Qt::UTC)); - QCOMPARE(iq.end(), QDateTime(QDate(1479, 7, 21), QTime(4, 0, 0), Qt::UTC)); - QCOMPARE(iq.resultSetQuery().max(), max); - serializePacket(iq, xml); -} - -void TestPackets::testArchiveChat_data() -{ - QTest::addColumn("xml"); - QTest::addColumn("count"); - - QTest::newRow("no 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?" - "" - "") << -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); - QCOMPARE(iq.type(), QXmppIq::Result); - QCOMPARE(iq.id(), QLatin1String("chat_1")); - QCOMPARE(iq.chat().with(), QLatin1String("juliet@capulet.com")); - QCOMPARE(iq.chat().messages().size(), 3); - QCOMPARE(iq.chat().messages()[0].isReceived(), true); - QCOMPARE(iq.chat().messages()[0].body(), QLatin1String("Art thou not Romeo, and a Montague?")); - QCOMPARE(iq.chat().messages()[0].date(), QDateTime(QDate(1469, 7, 21), QTime(2, 56, 15), Qt::UTC)); - QCOMPARE(iq.chat().messages()[1].isReceived(), false); - QCOMPARE(iq.chat().messages()[1].date(), QDateTime(QDate(1469, 7, 21), QTime(2, 56, 26), Qt::UTC)); - QCOMPARE(iq.chat().messages()[1].body(), QLatin1String("Neither, fair saint, if either thee dislike.")); - 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); -} - -void TestPackets::testArchiveRemove() -{ - const QByteArray xml( - "" - "" - ""); - - QXmppArchiveRemoveIq iq; - parsePacket(iq, xml); - QCOMPARE(iq.type(), QXmppIq::Set); - QCOMPARE(iq.id(), QLatin1String("remove_1")); - QCOMPARE(iq.with(), QLatin1String("juliet@capulet.com")); - QCOMPARE(iq.start(), QDateTime(QDate(1469, 7, 21), QTime(2, 0, 0), Qt::UTC)); - QCOMPARE(iq.end(), QDateTime(QDate(1479, 7, 21), QTime(4, 0, 0), Qt::UTC)); - serializePacket(iq, xml); -} - -void TestPackets::testArchiveRetrieve_data() -{ - QTest::addColumn("xml"); - QTest::addColumn("max"); - - QTest::newRow("no rsm") << - QByteArray( - "" - "" - "") << -1; - - QTest::newRow("with rsm") << - QByteArray( - "" - "" - "" - "30" - "" - "" - "") << 30; -} - -void TestPackets::testArchiveRetrieve() -{ - QFETCH(QByteArray, xml); - QFETCH(int, max); - - QXmppArchiveRetrieveIq iq; - parsePacket(iq, xml); - QCOMPARE(iq.type(), QXmppIq::Get); - QCOMPARE(iq.id(), QLatin1String("retrieve_1")); - QCOMPARE(iq.with(), QLatin1String("juliet@capulet.com")); - QCOMPARE(iq.start(), QDateTime(QDate(1469, 7, 21), QTime(2, 0, 0), Qt::UTC)); - QCOMPARE(iq.resultSetQuery().max(), max); - serializePacket(iq, xml); -} - void TestPackets::testBindNoResource() { const QByteArray xml( -- cgit v1.2.3