aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-10-01 13:56:10 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-10-01 13:56:10 +0200
commit493b98d151f3cd3ed2481fb13703351e67b201d6 (patch)
treeb6d592dba965311b4c30d46122bc2753927757ef /tests
parentb7b7af761e4fe3f35bd8073e652a93b2559a4160 (diff)
downloadqxmpp-493b98d151f3cd3ed2481fb13703351e67b201d6.tar.gz
split QXmppVersionIq tests
Diffstat (limited to 'tests')
-rw-r--r--tests/all/tests.cpp43
-rw-r--r--tests/qxmppversioniq/qxmppversioniq.pro3
-rw-r--r--tests/qxmppversioniq/tst_qxmppversioniq.cpp79
-rw-r--r--tests/tests.pro3
4 files changed, 84 insertions, 44 deletions
diff --git a/tests/all/tests.cpp b/tests/all/tests.cpp
index f79be52b..0965f764 100644
--- a/tests/all/tests.cpp
+++ b/tests/all/tests.cpp
@@ -27,7 +27,6 @@
#include "QXmppSessionIq.h"
#include "QXmppStreamFeatures.h"
#include "QXmppUtils.h"
-#include "QXmppVersionIq.h"
#include "util.h"
class TestPackets : public QObject
@@ -38,8 +37,6 @@ private slots:
void testNonSaslAuth();
void testSession();
void testStreamFeatures();
- void testVersionGet();
- void testVersionResult();
void testEntityTimeGet();
void testEntityTimeResult();
};
@@ -138,46 +135,6 @@ void TestPackets::testStreamFeatures()
serializePacket(features2, xml2);
}
-void TestPackets::testVersionGet()
-{
- const QByteArray xmlGet(
- "<iq id=\"version_1\" to=\"juliet@capulet.com/balcony\" "
- "from=\"romeo@montague.net/orchard\" type=\"get\">"
- "<query xmlns=\"jabber:iq:version\"/></iq>");
-
- QXmppVersionIq verIqGet;
- parsePacket(verIqGet, xmlGet);
- QCOMPARE(verIqGet.id(), QLatin1String("version_1"));
- QCOMPARE(verIqGet.to(), QLatin1String("juliet@capulet.com/balcony"));
- QCOMPARE(verIqGet.from(), QLatin1String("romeo@montague.net/orchard"));
- QCOMPARE(verIqGet.type(), QXmppIq::Get);
- serializePacket(verIqGet, xmlGet);
-}
-
-void TestPackets::testVersionResult()
-{
- const QByteArray xmlResult(
- "<iq id=\"version_1\" to=\"romeo@montague.net/orchard\" "
- "from=\"juliet@capulet.com/balcony\" type=\"result\">"
- "<query xmlns=\"jabber:iq:version\">"
- "<name>qxmpp</name>"
- "<os>Windows-XP</os>"
- "<version>0.2.0</version>"
- "</query></iq>");
-
- QXmppVersionIq verIqResult;
- parsePacket(verIqResult, xmlResult);
- QCOMPARE(verIqResult.id(), QLatin1String("version_1"));
- QCOMPARE(verIqResult.to(), QLatin1String("romeo@montague.net/orchard"));
- QCOMPARE(verIqResult.from(), QLatin1String("juliet@capulet.com/balcony"));
- QCOMPARE(verIqResult.type(), QXmppIq::Result);
- QCOMPARE(verIqResult.name(), QString("qxmpp"));
- QCOMPARE(verIqResult.version(), QString("0.2.0"));
- QCOMPARE(verIqResult.os(), QString("Windows-XP"));
-
- serializePacket(verIqResult, xmlResult);
-}
-
void TestPackets::testEntityTimeGet()
{
const QByteArray xml("<iq id=\"time_1\" "
diff --git a/tests/qxmppversioniq/qxmppversioniq.pro b/tests/qxmppversioniq/qxmppversioniq.pro
new file mode 100644
index 00000000..f018fe01
--- /dev/null
+++ b/tests/qxmppversioniq/qxmppversioniq.pro
@@ -0,0 +1,3 @@
+include(../tests.pri)
+TARGET = tst_qxmppversioniq
+SOURCES += tst_qxmppversioniq.cpp
diff --git a/tests/qxmppversioniq/tst_qxmppversioniq.cpp b/tests/qxmppversioniq/tst_qxmppversioniq.cpp
new file mode 100644
index 00000000..c1371fcd
--- /dev/null
+++ b/tests/qxmppversioniq/tst_qxmppversioniq.cpp
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2008-2012 The QXmpp developers
+ *
+ * Authors:
+ * Jeremy Lainé
+ * Manjeet Dahiya
+ *
+ * Source:
+ * http://code.google.com/p/qxmpp
+ *
+ * This file is a part of QXmpp library.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ */
+
+#include <QObject>
+#include "QXmppVersionIq.h"
+#include "util.h"
+
+class tst_QXmppVersionIq : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void testVersionGet();
+ void testVersionResult();
+};
+
+void tst_QXmppVersionIq::testVersionGet()
+{
+ const QByteArray xmlGet(
+ "<iq id=\"version_1\" to=\"juliet@capulet.com/balcony\" "
+ "from=\"romeo@montague.net/orchard\" type=\"get\">"
+ "<query xmlns=\"jabber:iq:version\"/></iq>");
+
+ QXmppVersionIq verIqGet;
+ parsePacket(verIqGet, xmlGet);
+ QCOMPARE(verIqGet.id(), QLatin1String("version_1"));
+ QCOMPARE(verIqGet.to(), QLatin1String("juliet@capulet.com/balcony"));
+ QCOMPARE(verIqGet.from(), QLatin1String("romeo@montague.net/orchard"));
+ QCOMPARE(verIqGet.type(), QXmppIq::Get);
+ serializePacket(verIqGet, xmlGet);
+}
+
+void tst_QXmppVersionIq::testVersionResult()
+{
+ const QByteArray xmlResult(
+ "<iq id=\"version_1\" to=\"romeo@montague.net/orchard\" "
+ "from=\"juliet@capulet.com/balcony\" type=\"result\">"
+ "<query xmlns=\"jabber:iq:version\">"
+ "<name>qxmpp</name>"
+ "<os>Windows-XP</os>"
+ "<version>0.2.0</version>"
+ "</query></iq>");
+
+ QXmppVersionIq verIqResult;
+ parsePacket(verIqResult, xmlResult);
+ QCOMPARE(verIqResult.id(), QLatin1String("version_1"));
+ QCOMPARE(verIqResult.to(), QLatin1String("romeo@montague.net/orchard"));
+ QCOMPARE(verIqResult.from(), QLatin1String("juliet@capulet.com/balcony"));
+ QCOMPARE(verIqResult.type(), QXmppIq::Result);
+ QCOMPARE(verIqResult.name(), QString("qxmpp"));
+ QCOMPARE(verIqResult.version(), QString("0.2.0"));
+ QCOMPARE(verIqResult.os(), QString("Windows-XP"));
+
+ serializePacket(verIqResult, xmlResult);
+}
+
+QTEST_MAIN(tst_QXmppVersionIq)
+#include "tst_qxmppversioniq.moc"
diff --git a/tests/tests.pro b/tests/tests.pro
index d1d9d235..ff58ebcf 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -19,7 +19,8 @@ SUBDIRS = \
qxmppstanza \
qxmppstunmessage \
qxmpputils \
- qxmppvcardiq
+ qxmppvcardiq \
+ qxmppversioniq
!isEmpty(QXMPP_AUTOTEST_INTERNAL) {
SUBDIRS += qxmppcodec