aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-09-27 15:06:55 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-09-27 15:06:55 +0200
commitdb2f84e966682c1072cd579baa9511906a276ab0 (patch)
tree6554c194b2cf52e19e7940ed31f9c64c9d540569
parent40c1ce264991447522e8296ad86a55ca5c3b81d1 (diff)
downloadqxmpp-db2f84e966682c1072cd579baa9511906a276ab0.tar.gz
start splitting tests
-rw-r--r--tests/all/all.pro40
-rw-r--r--tests/all/codec.cpp (renamed from tests/codec.cpp)0
-rw-r--r--tests/all/codec.h (renamed from tests/codec.h)0
-rw-r--r--tests/all/dataform.cpp (renamed from tests/dataform.cpp)2
-rw-r--r--tests/all/dataform.h (renamed from tests/dataform.h)0
-rw-r--r--tests/all/iq.cpp (renamed from tests/iq.cpp)2
-rw-r--r--tests/all/iq.h (renamed from tests/iq.h)0
-rw-r--r--tests/all/jingle.cpp (renamed from tests/jingle.cpp)2
-rw-r--r--tests/all/jingle.h (renamed from tests/jingle.h)0
-rw-r--r--tests/all/message.cpp (renamed from tests/message.cpp)2
-rw-r--r--tests/all/message.h (renamed from tests/message.h)0
-rw-r--r--tests/all/presence.cpp (renamed from tests/presence.cpp)2
-rw-r--r--tests/all/presence.h (renamed from tests/presence.h)0
-rw-r--r--tests/all/register.cpp (renamed from tests/register.cpp)2
-rw-r--r--tests/all/register.h (renamed from tests/register.h)0
-rw-r--r--tests/all/roster.cpp (renamed from tests/roster.cpp)2
-rw-r--r--tests/all/roster.h (renamed from tests/roster.h)0
-rw-r--r--tests/all/rpc.cpp (renamed from tests/rpc.cpp)2
-rw-r--r--tests/all/rpc.h (renamed from tests/rpc.h)0
-rw-r--r--tests/all/rsm.cpp (renamed from tests/rsm.cpp)2
-rw-r--r--tests/all/rsm.h (renamed from tests/rsm.h)0
-rw-r--r--tests/all/rtp.cpp (renamed from tests/rtp.cpp)0
-rw-r--r--tests/all/rtp.h (renamed from tests/rtp.h)0
-rw-r--r--tests/all/sasl.cpp (renamed from tests/sasl.cpp)2
-rw-r--r--tests/all/sasl.h (renamed from tests/sasl.h)0
-rw-r--r--tests/all/si.cpp (renamed from tests/si.cpp)2
-rw-r--r--tests/all/si.h (renamed from tests/si.h)0
-rw-r--r--tests/all/stanza.cpp (renamed from tests/stanza.cpp)2
-rw-r--r--tests/all/stanza.h (renamed from tests/stanza.h)0
-rw-r--r--tests/all/stun.cpp (renamed from tests/stun.cpp)2
-rw-r--r--tests/all/stun.h (renamed from tests/stun.h)0
-rw-r--r--tests/all/test.bmp (renamed from tests/test.bmp)bin174 -> 174 bytes
-rw-r--r--tests/all/test.gif (renamed from tests/test.gif)bin50 -> 50 bytes
-rw-r--r--tests/all/test.jpg (renamed from tests/test.jpg)bin352 -> 352 bytes
-rw-r--r--tests/all/test.mng (renamed from tests/test.mng)bin220 -> 220 bytes
-rw-r--r--tests/all/test.png (renamed from tests/test.png)bin179 -> 179 bytes
-rw-r--r--tests/all/test.svg (renamed from tests/test.svg)0
-rw-r--r--tests/all/test.xpm (renamed from tests/test.xpm)0
-rw-r--r--tests/all/tests.cpp (renamed from tests/tests.cpp)1
-rw-r--r--tests/all/tests.h (renamed from tests/tests.h)24
-rw-r--r--tests/all/tests.qrc (renamed from tests/tests.qrc)0
-rw-r--r--tests/all/vcard.cpp (renamed from tests/vcard.cpp)2
-rw-r--r--tests/all/vcard.h (renamed from tests/vcard.h)0
-rw-r--r--tests/qxmppiq/qxmppiq.pro3
-rw-r--r--tests/qxmppiq/tst_qxmppiq.cpp74
-rwxr-xr-xtests/run.py19
-rw-r--r--tests/tests.pri8
-rw-r--r--tests/tests.pro49
-rw-r--r--tests/util.h48
49 files changed, 201 insertions, 93 deletions
diff --git a/tests/all/all.pro b/tests/all/all.pro
new file mode 100644
index 00000000..1e821b03
--- /dev/null
+++ b/tests/all/all.pro
@@ -0,0 +1,40 @@
+include(../tests.pri)
+
+TARGET = tst_all
+
+RESOURCES += tests.qrc
+SOURCES += \
+ dataform.cpp \
+ iq.cpp \
+ jingle.cpp \
+ message.cpp \
+ presence.cpp \
+ register.cpp \
+ roster.cpp \
+ rpc.cpp \
+ rsm.cpp \
+ rtp.cpp \
+ stanza.cpp \
+ stun.cpp \
+ tests.cpp \
+ vcard.cpp
+HEADERS += \
+ dataform.h \
+ iq.h \
+ jingle.h \
+ message.h \
+ presence.h \
+ register.h \
+ roster.h \
+ rpc.h \
+ rsm.h \
+ rtp.h \
+ stanza.h \
+ stun.h \
+ tests.h \
+ vcard.h
+
+!isEmpty(QXMPP_AUTOTEST_INTERNAL) {
+ HEADERS += codec.h sasl.h si.h
+ SOURCES += codec.cpp sasl.cpp si.cpp
+}
diff --git a/tests/codec.cpp b/tests/all/codec.cpp
index cc76297e..cc76297e 100644
--- a/tests/codec.cpp
+++ b/tests/all/codec.cpp
diff --git a/tests/codec.h b/tests/all/codec.h
index 035e5098..035e5098 100644
--- a/tests/codec.h
+++ b/tests/all/codec.h
diff --git a/tests/dataform.cpp b/tests/all/dataform.cpp
index fd9d0c9d..da9f62b6 100644
--- a/tests/dataform.cpp
+++ b/tests/all/dataform.cpp
@@ -25,7 +25,7 @@
#include "QXmppDataForm.h"
#include "dataform.h"
-#include "tests.h"
+#include "util.h"
void tst_QXmppDataForm::testSimple()
{
diff --git a/tests/dataform.h b/tests/all/dataform.h
index d5461237..d5461237 100644
--- a/tests/dataform.h
+++ b/tests/all/dataform.h
diff --git a/tests/iq.cpp b/tests/all/iq.cpp
index 6b4e3203..fa46c149 100644
--- a/tests/iq.cpp
+++ b/tests/all/iq.cpp
@@ -23,7 +23,7 @@
#include "QXmppIq.h"
#include "iq.h"
-#include "tests.h"
+#include "util.h"
void tst_QXmppIq::testBasic_data()
{
diff --git a/tests/iq.h b/tests/all/iq.h
index 5d382b31..5d382b31 100644
--- a/tests/iq.h
+++ b/tests/all/iq.h
diff --git a/tests/jingle.cpp b/tests/all/jingle.cpp
index 842f0dd9..90aa3797 100644
--- a/tests/jingle.cpp
+++ b/tests/all/jingle.cpp
@@ -24,7 +24,7 @@
#include "QXmppJingleIq.h"
#include "jingle.h"
-#include "tests.h"
+#include "util.h"
void TestJingle::testSession()
{
diff --git a/tests/jingle.h b/tests/all/jingle.h
index 9098e8da..9098e8da 100644
--- a/tests/jingle.h
+++ b/tests/all/jingle.h
diff --git a/tests/message.cpp b/tests/all/message.cpp
index b7198a82..fbdb5234 100644
--- a/tests/message.cpp
+++ b/tests/all/message.cpp
@@ -24,7 +24,7 @@
#include "QXmppMessage.h"
#include "message.h"
-#include "tests.h"
+#include "util.h"
void tst_QXmppMessage::testBasic_data()
{
diff --git a/tests/message.h b/tests/all/message.h
index 08c71283..08c71283 100644
--- a/tests/message.h
+++ b/tests/all/message.h
diff --git a/tests/presence.cpp b/tests/all/presence.cpp
index 8cf92ba1..c2762622 100644
--- a/tests/presence.cpp
+++ b/tests/all/presence.cpp
@@ -25,7 +25,7 @@
#include "QXmppPresence.h"
#include "presence.h"
-#include "tests.h"
+#include "util.h"
void tst_QXmppPresence::testPresence_data()
{
diff --git a/tests/presence.h b/tests/all/presence.h
index 74bd7ee8..74bd7ee8 100644
--- a/tests/presence.h
+++ b/tests/all/presence.h
diff --git a/tests/register.cpp b/tests/all/register.cpp
index deff7d80..9dfe2fcb 100644
--- a/tests/register.cpp
+++ b/tests/all/register.cpp
@@ -23,7 +23,7 @@
#include "QXmppRegisterIq.h"
-#include "tests.h"
+#include "util.h"
#include "register.h"
void tst_QXmppRegisterIq::testGet()
diff --git a/tests/register.h b/tests/all/register.h
index 4c54e8c7..4c54e8c7 100644
--- a/tests/register.h
+++ b/tests/all/register.h
diff --git a/tests/roster.cpp b/tests/all/roster.cpp
index 718dbbb8..2b664212 100644
--- a/tests/roster.cpp
+++ b/tests/all/roster.cpp
@@ -24,7 +24,7 @@
#include "QXmppRosterIq.h"
#include "roster.h"
-#include "tests.h"
+#include "util.h"
void tst_QXmppRosterIq::testItem_data()
{
diff --git a/tests/roster.h b/tests/all/roster.h
index 83240ec3..83240ec3 100644
--- a/tests/roster.h
+++ b/tests/all/roster.h
diff --git a/tests/rpc.cpp b/tests/all/rpc.cpp
index a5136f65..c0714957 100644
--- a/tests/rpc.cpp
+++ b/tests/all/rpc.cpp
@@ -24,7 +24,7 @@
#include "QXmppRpcIq.h"
#include "rpc.h"
-#include "tests.h"
+#include "util.h"
static void checkVariant(const QVariant &value, const QByteArray &xml)
{
diff --git a/tests/rpc.h b/tests/all/rpc.h
index f3a0c5e0..f3a0c5e0 100644
--- a/tests/rpc.h
+++ b/tests/all/rpc.h
diff --git a/tests/rsm.cpp b/tests/all/rsm.cpp
index fde8711f..ca5438ad 100644
--- a/tests/rsm.cpp
+++ b/tests/all/rsm.cpp
@@ -25,7 +25,7 @@
#include "QXmppResultSet.h"
#include "rsm.h"
-#include "tests.h"
+#include "util.h"
void tst_QXmppResultSet::testQuery_data()
{
diff --git a/tests/rsm.h b/tests/all/rsm.h
index 120ea625..120ea625 100644
--- a/tests/rsm.h
+++ b/tests/all/rsm.h
diff --git a/tests/rtp.cpp b/tests/all/rtp.cpp
index cc7ee112..cc7ee112 100644
--- a/tests/rtp.cpp
+++ b/tests/all/rtp.cpp
diff --git a/tests/rtp.h b/tests/all/rtp.h
index 479a1a87..479a1a87 100644
--- a/tests/rtp.h
+++ b/tests/all/rtp.h
diff --git a/tests/sasl.cpp b/tests/all/sasl.cpp
index 3df81e59..b276ddcd 100644
--- a/tests/sasl.cpp
+++ b/tests/all/sasl.cpp
@@ -24,7 +24,7 @@
#include "QXmppSasl_p.h"
#include "sasl.h"
-#include "tests.h"
+#include "util.h"
void tst_QXmppSasl::testParsing()
{
diff --git a/tests/sasl.h b/tests/all/sasl.h
index f70ff9af..f70ff9af 100644
--- a/tests/sasl.h
+++ b/tests/all/sasl.h
diff --git a/tests/si.cpp b/tests/all/si.cpp
index 39959c17..cdfc4568 100644
--- a/tests/si.cpp
+++ b/tests/all/si.cpp
@@ -26,7 +26,7 @@
#include "QXmppTransferManager.h"
#include "si.h"
-#include "tests.h"
+#include "util.h"
void tst_QXmppStreamInitiationIq::testFileInfo_data()
{
diff --git a/tests/si.h b/tests/all/si.h
index 97e325b8..97e325b8 100644
--- a/tests/si.h
+++ b/tests/all/si.h
diff --git a/tests/stanza.cpp b/tests/all/stanza.cpp
index ddc18078..f1de73a4 100644
--- a/tests/stanza.cpp
+++ b/tests/all/stanza.cpp
@@ -24,7 +24,7 @@
#include "QXmppStanza.h"
#include "stanza.h"
-#include "tests.h"
+#include "util.h"
void tst_QXmppStanza::testExtendedAddress_data()
{
diff --git a/tests/stanza.h b/tests/all/stanza.h
index 8bd57d90..8bd57d90 100644
--- a/tests/stanza.h
+++ b/tests/all/stanza.h
diff --git a/tests/stun.cpp b/tests/all/stun.cpp
index 7238f05f..8fa09d7f 100644
--- a/tests/stun.cpp
+++ b/tests/all/stun.cpp
@@ -24,7 +24,7 @@
#include "QXmppStun.h"
#include "stun.h"
-#include "tests.h"
+#include "util.h"
void TestStun::testFingerprint()
{
diff --git a/tests/stun.h b/tests/all/stun.h
index 1b0141d2..1b0141d2 100644
--- a/tests/stun.h
+++ b/tests/all/stun.h
diff --git a/tests/test.bmp b/tests/all/test.bmp
index de301a62..de301a62 100644
--- a/tests/test.bmp
+++ b/tests/all/test.bmp
Binary files differ
diff --git a/tests/test.gif b/tests/all/test.gif
index f39871a0..f39871a0 100644
--- a/tests/test.gif
+++ b/tests/all/test.gif
Binary files differ
diff --git a/tests/test.jpg b/tests/all/test.jpg
index 684693b6..684693b6 100644
--- a/tests/test.jpg
+++ b/tests/all/test.jpg
Binary files differ
diff --git a/tests/test.mng b/tests/all/test.mng
index 454977da..454977da 100644
--- a/tests/test.mng
+++ b/tests/all/test.mng
Binary files differ
diff --git a/tests/test.png b/tests/all/test.png
index 372cf93f..372cf93f 100644
--- a/tests/test.png
+++ b/tests/all/test.png
Binary files differ
diff --git a/tests/test.svg b/tests/all/test.svg
index b2838872..b2838872 100644
--- a/tests/test.svg
+++ b/tests/all/test.svg
diff --git a/tests/test.xpm b/tests/all/test.xpm
index ef56e2c6..ef56e2c6 100644
--- a/tests/test.xpm
+++ b/tests/all/test.xpm
diff --git a/tests/tests.cpp b/tests/all/tests.cpp
index 0937afb1..2406813e 100644
--- a/tests/tests.cpp
+++ b/tests/all/tests.cpp
@@ -60,6 +60,7 @@
#include "stanza.h"
#include "stun.h"
#include "tests.h"
+#include "util.h"
#include "vcard.h"
void TestUtils::testCrc32()
diff --git a/tests/tests.h b/tests/all/tests.h
index 67e3f6cf..1a32b6a3 100644
--- a/tests/tests.h
+++ b/tests/all/tests.h
@@ -22,31 +22,7 @@
*
*/
-#include <QDomDocument>
#include <QObject>
-#include <QtTest/QtTest>
-
-template <class T>
-static void parsePacket(T &packet, const QByteArray &xml)
-{
- //qDebug() << "parsing" << xml;
- QDomDocument doc;
- QCOMPARE(doc.setContent(xml, true), true);
- QDomElement element = doc.documentElement();
- packet.parse(element);
-}
-
-template <class T>
-static void serializePacket(T &packet, const QByteArray &xml)
-{
- QBuffer buffer;
- buffer.open(QIODevice::ReadWrite);
- QXmlStreamWriter writer(&buffer);
- packet.toXml(&writer);
- qDebug() << "expect " << xml;
- qDebug() << "writing" << buffer.data();
- QCOMPARE(buffer.data(), xml);
-}
class TestUtils : public QObject
{
diff --git a/tests/tests.qrc b/tests/all/tests.qrc
index 6bc9605e..6bc9605e 100644
--- a/tests/tests.qrc
+++ b/tests/all/tests.qrc
diff --git a/tests/vcard.cpp b/tests/all/vcard.cpp
index 92c1c5ee..350e8a7e 100644
--- a/tests/vcard.cpp
+++ b/tests/all/vcard.cpp
@@ -23,7 +23,7 @@
#include "QXmppVCardIq.h"
-#include "tests.h"
+#include "util.h"
#include "vcard.h"
void tst_QXmppVCardIq::testAddress_data()
diff --git a/tests/vcard.h b/tests/all/vcard.h
index 29a1dcad..29a1dcad 100644
--- a/tests/vcard.h
+++ b/tests/all/vcard.h
diff --git a/tests/qxmppiq/qxmppiq.pro b/tests/qxmppiq/qxmppiq.pro
new file mode 100644
index 00000000..5a2e162a
--- /dev/null
+++ b/tests/qxmppiq/qxmppiq.pro
@@ -0,0 +1,3 @@
+include(../tests.pri)
+TARGET = tst_qxmppiq
+SOURCES += tst_qxmppiq.cpp
diff --git a/tests/qxmppiq/tst_qxmppiq.cpp b/tests/qxmppiq/tst_qxmppiq.cpp
new file mode 100644
index 00000000..2c7141fd
--- /dev/null
+++ b/tests/qxmppiq/tst_qxmppiq.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2008-2012 The QXmpp developers
+ *
+ * Author:
+ * Jeremy Lainé
+ *
+ * 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 "QXmppIq.h"
+#include "util.h"
+
+class tst_QXmppIq : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void testBasic_data();
+ void testBasic();
+};
+
+void tst_QXmppIq::testBasic_data()
+{
+ QTest::addColumn<QByteArray>("xml");
+ QTest::addColumn<int>("type");
+
+ QTest::newRow("get")
+ << QByteArray("<iq to=\"foo@example.com/QXmpp\" from=\"bar@example.com/QXmpp\" type=\"get\"/>")
+ << int(QXmppIq::Get);
+
+ QTest::newRow("set")
+ << QByteArray("<iq to=\"foo@example.com/QXmpp\" from=\"bar@example.com/QXmpp\" type=\"set\"/>")
+ << int(QXmppIq::Set);
+
+ QTest::newRow("result")
+ << QByteArray("<iq to=\"foo@example.com/QXmpp\" from=\"bar@example.com/QXmpp\" type=\"result\"/>")
+ << int(QXmppIq::Result);
+
+ QTest::newRow("error")
+ << QByteArray("<iq to=\"foo@example.com/QXmpp\" from=\"bar@example.com/QXmpp\" type=\"error\"/>")
+ << int(QXmppIq::Error);
+}
+
+void tst_QXmppIq::testBasic()
+{
+ QFETCH(QByteArray, xml);
+ QFETCH(int, type);
+
+ QXmppIq iq;
+ parsePacket(iq, xml);
+ QCOMPARE(iq.to(), QString("foo@example.com/QXmpp"));
+ QCOMPARE(iq.from(), QString("bar@example.com/QXmpp"));
+ QCOMPARE(int(iq.type()), type);
+ serializePacket(iq, xml);
+}
+
+QTEST_MAIN(tst_QXmppIq)
+#include "tst_qxmppiq.moc"
diff --git a/tests/run.py b/tests/run.py
index 1a077716..9ccff741 100755
--- a/tests/run.py
+++ b/tests/run.py
@@ -36,11 +36,14 @@ else:
os.environ['LD_LIBRARY_PATH'] = path
# run tests
-if platform.system() == 'Darwin':
- prog = os.path.join(root, 'qxmpp-tests.app', 'Contents', 'MacOS', 'qxmpp-tests')
-else:
- prog = os.path.join(root, 'qxmpp-tests.app')
-if report_path:
- os.system('%s -xunitxml -o %s/%s.xml' % (prog, report_path, test))
-else:
- os.system(prog)
+for test in os.listdir(root):
+ test_path = os.path.join(root, test)
+ if os.path.isdir(test_path):
+ if platform.system() == 'Darwin':
+ prog = os.path.join(test_path, 'tst_' + test + '.app', 'Contents', 'MacOS', 'tst_' + test)
+ else:
+ prog = os.path.join(test_path, 'tst_' + test)
+ if report_path:
+ os.system('%s -xunitxml -o %s/%s.xml' % (prog, report_path, test))
+ else:
+ os.system(prog)
diff --git a/tests/tests.pri b/tests/tests.pri
new file mode 100644
index 00000000..4098bb45
--- /dev/null
+++ b/tests/tests.pri
@@ -0,0 +1,8 @@
+include(../qxmpp.pri)
+
+QT -= gui
+QT += testlib
+
+QMAKE_LIBDIR += ../../src
+INCLUDEPATH += $$PWD $$QXMPP_INCLUDEPATH
+LIBS += $$QXMPP_LIBS
diff --git a/tests/tests.pro b/tests/tests.pro
index d857621f..0e5e4904 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -1,47 +1,2 @@
-include(../qxmpp.pri)
-
-QT -= gui
-QT += testlib
-
-TARGET = qxmpp-tests
-
-RESOURCES += tests.qrc
-SOURCES += \
- dataform.cpp \
- iq.cpp \
- jingle.cpp \
- message.cpp \
- presence.cpp \
- register.cpp \
- roster.cpp \
- rpc.cpp \
- rsm.cpp \
- rtp.cpp \
- stanza.cpp \
- stun.cpp \
- tests.cpp \
- vcard.cpp
-HEADERS += \
- dataform.h \
- iq.h \
- jingle.h \
- message.h \
- presence.h \
- register.h \
- roster.h \
- rpc.h \
- rsm.h \
- rtp.h \
- stanza.h \
- stun.h \
- tests.h \
- vcard.h
-
-!isEmpty(QXMPP_AUTOTEST_INTERNAL) {
- HEADERS += codec.h sasl.h si.h
- SOURCES += codec.cpp sasl.cpp si.cpp
-}
-
-QMAKE_LIBDIR += ../src
-INCLUDEPATH += $$QXMPP_INCLUDEPATH
-LIBS += $$QXMPP_LIBS
+TEMPLATE = subdirs
+SUBDIRS = all qxmppiq
diff --git a/tests/util.h b/tests/util.h
new file mode 100644
index 00000000..982561d3
--- /dev/null
+++ b/tests/util.h
@@ -0,0 +1,48 @@
+/*
+ * 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 <QDomDocument>
+#include <QtTest>
+
+template <class T>
+static void parsePacket(T &packet, const QByteArray &xml)
+{
+ //qDebug() << "parsing" << xml;
+ QDomDocument doc;
+ QCOMPARE(doc.setContent(xml, true), true);
+ QDomElement element = doc.documentElement();
+ packet.parse(element);
+}
+
+template <class T>
+static void serializePacket(T &packet, const QByteArray &xml)
+{
+ QBuffer buffer;
+ buffer.open(QIODevice::ReadWrite);
+ QXmlStreamWriter writer(&buffer);
+ packet.toXml(&writer);
+ qDebug() << "expect " << xml;
+ qDebug() << "writing" << buffer.data();
+ QCOMPARE(buffer.data(), xml);
+}