aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-10-01 14:00:36 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-10-01 14:00:36 +0200
commit10a6e8681fd32d67767f53f4e17166586d567494 (patch)
treee9f55282212f55096be039f9b2d66ba4b10582dd /tests
parent493b98d151f3cd3ed2481fb13703351e67b201d6 (diff)
downloadqxmpp-10a6e8681fd32d67767f53f4e17166586d567494.tar.gz
split QXmppEntityTimeIq tests
Diffstat (limited to 'tests')
-rw-r--r--tests/all/tests.cpp41
-rw-r--r--tests/qxmppentitytimeiq/qxmppentitytimeiq.pro3
-rw-r--r--tests/qxmppentitytimeiq/tst_qxmppentitytimeiq.cpp77
-rw-r--r--tests/tests.pro1
4 files changed, 81 insertions, 41 deletions
diff --git a/tests/all/tests.cpp b/tests/all/tests.cpp
index 0965f764..7ac5c5e7 100644
--- a/tests/all/tests.cpp
+++ b/tests/all/tests.cpp
@@ -22,7 +22,6 @@
*
*/
-#include "QXmppEntityTimeIq.h"
#include "QXmppNonSASLAuth.h"
#include "QXmppSessionIq.h"
#include "QXmppStreamFeatures.h"
@@ -37,8 +36,6 @@ private slots:
void testNonSaslAuth();
void testSession();
void testStreamFeatures();
- void testEntityTimeGet();
- void testEntityTimeResult();
};
void TestPackets::testNonSaslAuth()
@@ -135,43 +132,5 @@ void TestPackets::testStreamFeatures()
serializePacket(features2, xml2);
}
-void TestPackets::testEntityTimeGet()
-{
- const QByteArray xml("<iq id=\"time_1\" "
- "to=\"juliet@capulet.com/balcony\" "
- "from=\"romeo@montague.net/orchard\" type=\"get\">"
- "<time xmlns=\"urn:xmpp:time\"/>"
- "</iq>");
-
- QXmppEntityTimeIq entityTime;
- parsePacket(entityTime, xml);
- QCOMPARE(entityTime.id(), QLatin1String("time_1"));
- QCOMPARE(entityTime.to(), QLatin1String("juliet@capulet.com/balcony"));
- QCOMPARE(entityTime.from(), QLatin1String("romeo@montague.net/orchard"));
- QCOMPARE(entityTime.type(), QXmppIq::Get);
- serializePacket(entityTime, xml);
-}
-
-void TestPackets::testEntityTimeResult()
-{
- const QByteArray xml(
- "<iq id=\"time_1\" to=\"romeo@montague.net/orchard\" from=\"juliet@capulet.com/balcony\" type=\"result\">"
- "<time xmlns=\"urn:xmpp:time\">"
- "<tzo>-06:00</tzo>"
- "<utc>2006-12-19T17:58:35Z</utc>"
- "</time>"
- "</iq>");
-
- QXmppEntityTimeIq entityTime;
- parsePacket(entityTime, xml);
- QCOMPARE(entityTime.id(), QLatin1String("time_1"));
- QCOMPARE(entityTime.from(), QLatin1String("juliet@capulet.com/balcony"));
- QCOMPARE(entityTime.to(), QLatin1String("romeo@montague.net/orchard"));
- QCOMPARE(entityTime.type(), QXmppIq::Result);
- QCOMPARE(entityTime.tzo(), -21600);
- QCOMPARE(entityTime.utc(), QDateTime(QDate(2006, 12, 19), QTime(17, 58, 35), Qt::UTC));
- serializePacket(entityTime, xml);
-}
-
QTEST_MAIN(TestPackets)
#include "tests.moc"
diff --git a/tests/qxmppentitytimeiq/qxmppentitytimeiq.pro b/tests/qxmppentitytimeiq/qxmppentitytimeiq.pro
new file mode 100644
index 00000000..c6b6e91c
--- /dev/null
+++ b/tests/qxmppentitytimeiq/qxmppentitytimeiq.pro
@@ -0,0 +1,3 @@
+include(../tests.pri)
+TARGET = tst_qxmppentitytimeiq
+SOURCES += tst_qxmppentitytimeiq.cpp
diff --git a/tests/qxmppentitytimeiq/tst_qxmppentitytimeiq.cpp b/tests/qxmppentitytimeiq/tst_qxmppentitytimeiq.cpp
new file mode 100644
index 00000000..38ce1592
--- /dev/null
+++ b/tests/qxmppentitytimeiq/tst_qxmppentitytimeiq.cpp
@@ -0,0 +1,77 @@
+/*
+ * 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 "QXmppEntityTimeIq.h"
+#include "util.h"
+
+class tst_QXmppEntityTimeIq : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void testEntityTimeGet();
+ void testEntityTimeResult();
+};
+
+void tst_QXmppEntityTimeIq::testEntityTimeGet()
+{
+ const QByteArray xml("<iq id=\"time_1\" "
+ "to=\"juliet@capulet.com/balcony\" "
+ "from=\"romeo@montague.net/orchard\" type=\"get\">"
+ "<time xmlns=\"urn:xmpp:time\"/>"
+ "</iq>");
+
+ QXmppEntityTimeIq entityTime;
+ parsePacket(entityTime, xml);
+ QCOMPARE(entityTime.id(), QLatin1String("time_1"));
+ QCOMPARE(entityTime.to(), QLatin1String("juliet@capulet.com/balcony"));
+ QCOMPARE(entityTime.from(), QLatin1String("romeo@montague.net/orchard"));
+ QCOMPARE(entityTime.type(), QXmppIq::Get);
+ serializePacket(entityTime, xml);
+}
+
+void tst_QXmppEntityTimeIq::testEntityTimeResult()
+{
+ const QByteArray xml(
+ "<iq id=\"time_1\" to=\"romeo@montague.net/orchard\" from=\"juliet@capulet.com/balcony\" type=\"result\">"
+ "<time xmlns=\"urn:xmpp:time\">"
+ "<tzo>-06:00</tzo>"
+ "<utc>2006-12-19T17:58:35Z</utc>"
+ "</time>"
+ "</iq>");
+
+ QXmppEntityTimeIq entityTime;
+ parsePacket(entityTime, xml);
+ QCOMPARE(entityTime.id(), QLatin1String("time_1"));
+ QCOMPARE(entityTime.from(), QLatin1String("juliet@capulet.com/balcony"));
+ QCOMPARE(entityTime.to(), QLatin1String("romeo@montague.net/orchard"));
+ QCOMPARE(entityTime.type(), QXmppIq::Result);
+ QCOMPARE(entityTime.tzo(), -21600);
+ QCOMPARE(entityTime.utc(), QDateTime(QDate(2006, 12, 19), QTime(17, 58, 35), Qt::UTC));
+ serializePacket(entityTime, xml);
+}
+
+QTEST_MAIN(tst_QXmppEntityTimeIq)
+#include "tst_qxmppentitytimeiq.moc"
diff --git a/tests/tests.pro b/tests/tests.pro
index ff58ebcf..56b23419 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -5,6 +5,7 @@ SUBDIRS = \
qxmppbindiq \
qxmppdataform \
qxmppdiscoveryiq \
+ qxmppentitytimeiq \
qxmppiq \
qxmppjingleiq \
qxmppmessage \