summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2013-02-19 15:19:23 (GMT)
committerChristian Mollekopf <mollekopf@kolabsys.com>2013-02-19 15:19:23 (GMT)
commit221cae6c555732334f2709ffdcc6e09d83e4362e (patch)
tree01538c6278f404f1a3baa52b4ed08eb209e42a38 /tests
parent5b814e701be22e9840453a832c2dacbf5672ccbf (diff)
downloadlibkolab-221cae6c555732334f2709ffdcc6e09d83e4362e.tar.gz
Basic functionality check for the xmlobject interface.
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/xmlobjecttest.cpp65
-rw-r--r--tests/xmlobjecttest.h31
3 files changed, 97 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index b3aa7ac..6f71a0c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -21,3 +21,4 @@ addTest(icalendartest)
addTest(freebusytest)
addTest(kolabobjecttest)
addTest(timezonetest)
+addTest(xmlobjecttest)
diff --git a/tests/xmlobjecttest.cpp b/tests/xmlobjecttest.cpp
new file mode 100644
index 0000000..a004cd9
--- /dev/null
+++ b/tests/xmlobjecttest.cpp
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2012 Christian Mollekopf <mollekopf@kolabsys.com>
+ *
+ * This program 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "xmlobjecttest.h"
+
+#include <QTest>
+#include <iostream>
+
+#include "kolabformat/xmlobject.h"
+
+void XMLObjectTest::testEvent()
+{
+ Kolab::Event event;
+ event.setStart(Kolab::cDateTime(2012,01,01));
+
+ Kolab::XMLObject xmlobject;
+ const std::string output = xmlobject.writeEvent(event, Kolab::KolabV2, "productid");
+ QVERIFY(!output.empty());
+ std::cout << output;
+
+ const Kolab::Event resultEvent = xmlobject.readEvent(output, Kolab::KolabV2);
+ QVERIFY(resultEvent.isValid());
+
+}
+
+void XMLObjectTest::testDontCrash()
+{
+ Kolab::XMLObject ob;
+ ob.writeEvent(Kolab::Event(), Kolab::KolabV2, "");
+ ob.writeTodo(Kolab::Todo(), Kolab::KolabV2, "");
+ ob.writeJournal(Kolab::Journal(), Kolab::KolabV2, "");
+ ob.writeFreebusy(Kolab::Freebusy(), Kolab::KolabV2, "");
+ ob.writeContact(Kolab::Contact(), Kolab::KolabV2, "");
+ ob.writeDistlist(Kolab::DistList(), Kolab::KolabV2, "");
+ ob.writeNote(Kolab::Note(), Kolab::KolabV2, "");
+ ob.writeConfiguration(Kolab::Configuration(), Kolab::KolabV2, "");
+
+ ob.readEvent("", Kolab::KolabV2);
+ ob.readTodo("", Kolab::KolabV2);
+ ob.readJournal("", Kolab::KolabV2);
+ ob.readFreebusy("", Kolab::KolabV2);
+ ob.readContact("", Kolab::KolabV2);
+ ob.readDistlist("", Kolab::KolabV2);
+ ob.readNote("", Kolab::KolabV2);
+ ob.readConfiguration("", Kolab::KolabV2);
+
+}
+
+QTEST_MAIN( XMLObjectTest )
+
+#include "xmlobjecttest.moc"
diff --git a/tests/xmlobjecttest.h b/tests/xmlobjecttest.h
new file mode 100644
index 0000000..0471e5d
--- /dev/null
+++ b/tests/xmlobjecttest.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2012 Christian Mollekopf <mollekopf@kolabsys.com>
+ *
+ * This program 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef XMLOBJECTTEST_H
+#define XMLOBJECTTEST_H
+
+#include <QObject>
+
+class XMLObjectTest: public QObject
+{
+ Q_OBJECT
+private slots:
+ void testEvent();
+ void testDontCrash();
+};
+
+#endif // XMLOBJECTTEST_H