aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-08-09 15:46:22 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-08-09 15:46:22 +0000
commit98cfcdaecad0fec2bb026f7cafe06491f1765c2e (patch)
treeab18567e10b577d71aecd800ea71cbf9cdd86120 /example
parentef0111fbe76e1556028c302c1fd4c804cccf5b76 (diff)
downloadqxmpp-98cfcdaecad0fec2bb026f7cafe06491f1765c2e.tar.gz
fix and test QDateTime representation in XML-RPC
Diffstat (limited to 'example')
-rw-r--r--example/tests/tests.cpp26
-rw-r--r--example/tests/tests.h1
2 files changed, 18 insertions, 9 deletions
diff --git a/example/tests/tests.cpp b/example/tests/tests.cpp
index 43a7156d..b8ab9c63 100644
--- a/example/tests/tests.cpp
+++ b/example/tests/tests.cpp
@@ -323,15 +323,6 @@ void TestJingle::testRinging()
static void checkVariant(const QVariant &value, const QByteArray &xml)
{
- // parse
- QDomDocument doc;
- QCOMPARE(doc.setContent(xml, true), true);
- QDomElement element = doc.documentElement();
- QStringList errors;
- QVariant test = XMLRPC::demarshall(element, errors);
- QCOMPARE(errors, QStringList());
- QCOMPARE(test, value);
-
// serialise
QBuffer buffer;
buffer.open(QIODevice::ReadWrite);
@@ -340,6 +331,17 @@ static void checkVariant(const QVariant &value, const QByteArray &xml)
qDebug() << "expect " << xml;
qDebug() << "writing" << buffer.data();
QCOMPARE(buffer.data(), xml);
+
+ // parse
+ QDomDocument doc;
+ QCOMPARE(doc.setContent(xml, true), true);
+ QDomElement element = doc.documentElement();
+ QStringList errors;
+ QVariant test = XMLRPC::demarshall(element, errors);
+ if (!errors.isEmpty())
+ qDebug() << errors;
+ QCOMPARE(errors, QStringList());
+ QCOMPARE(test, value);
}
void TestXmlRpc::testBool()
@@ -351,6 +353,12 @@ void TestXmlRpc::testBool()
QByteArray("<value><boolean>true</boolean></value>"));
}
+void TestXmlRpc::testDateTime()
+{
+ checkVariant(QDateTime(QDate(1998, 7, 17), QTime(14, 8, 55)),
+ QByteArray("<value><dateTime.iso8601>1998-07-17T14:08:55</dateTime.iso8601></value>"));
+}
+
void TestXmlRpc::testDouble()
{
checkVariant(double(-12.214),
diff --git a/example/tests/tests.h b/example/tests/tests.h
index cacd72b0..1a536ffc 100644
--- a/example/tests/tests.h
+++ b/example/tests/tests.h
@@ -65,6 +65,7 @@ class TestXmlRpc : public QObject
private slots:
void testBool();
+ void testDateTime();
void testDouble();
void testString();
};