tests/CMakeLists.txt tests/parsingtest.cpp tests/parsingtest.h tests/testfiles

Christian Mollekopf mollekopf at kolabsys.com
Wed May 9 21:20:56 CEST 2012


 tests/CMakeLists.txt              |    4 ++++
 tests/parsingtest.cpp             |   38 ++++++++++++++++++++++++++++++++++++++
 tests/parsingtest.h               |   35 +++++++++++++++++++++++++++++++++++
 tests/testfiles/vcard/contact.xml |   32 ++++++++++++++++++++++++++++++++
 4 files changed, 109 insertions(+)

New commits:
commit 9a40bd8deb99d7c3f41dcc71c1fc262443a76fe9
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Wed May 9 21:20:38 2012 +0200

    Parsingtest

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c3ae38c..06165d3 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -14,6 +14,10 @@ if (QT4_FOUND)
     QT4_AUTOMOC(conversiontest.cpp)
     add_executable(conversiontest conversiontest.cpp ${CMAKE_CURRENT_BINARY_DIR}/${CONVERSIONTEST_MOC})
     target_link_libraries(conversiontest ${QT_QTTEST_LIBRARY} ${QT_QTCORE_LIBRARY} kolabxml ${XERCES_C})
+
+    QT4_AUTOMOC(parsingtest.cpp)
+    add_executable(parsingtest parsingtest.cpp ${CMAKE_CURRENT_BINARY_DIR}/${CONVERSIONTEST_MOC})
+    target_link_libraries(parsingtest ${QT_QTTEST_LIBRARY} ${QT_QTCORE_LIBRARY} kolabxml ${XERCES_C})
 else()
     message(WARNING "Could not build tests because qt is missing")
 endif()
diff --git a/tests/parsingtest.cpp b/tests/parsingtest.cpp
new file mode 100644
index 0000000..c6619f0
--- /dev/null
+++ b/tests/parsingtest.cpp
@@ -0,0 +1,38 @@
+/*
+    Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
+
+    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.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#include "parsingtest.h"
+
+#include <QTest>
+#include <iostream>
+
+#include "src/kolabformat.h"
+
+#define TESTFILEDIR "../../tests/testfiles/"
+
+void ParsingTest::vcardParsingTest()
+{
+    const Kolab::Contact &contact = Kolab::readContact(TESTFILEDIR "vcard/contact.xml", true);
+    QCOMPARE(Kolab::error(), Kolab::NoError);
+    std::cout << Kolab::writeContact(contact);
+}
+
+
+QTEST_MAIN( ParsingTest )
+
+#include "parsingtest.moc"
\ No newline at end of file
diff --git a/tests/parsingtest.h b/tests/parsingtest.h
new file mode 100644
index 0000000..7d6784d
--- /dev/null
+++ b/tests/parsingtest.h
@@ -0,0 +1,35 @@
+/*
+    Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
+
+    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.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+
+#ifndef PARSINGTEST_H
+#define PARSINGTEST_H
+
+#include <QObject>
+
+class ParsingTest: public QObject
+{
+    Q_OBJECT
+private slots:
+
+//     void vcardParsingTest_data();
+    void vcardParsingTest();
+
+};
+
+#endif
diff --git a/tests/testfiles/vcard/contact.xml b/tests/testfiles/vcard/contact.xml
new file mode 100644
index 0000000..19e5941
--- /dev/null
+++ b/tests/testfiles/vcard/contact.xml
@@ -0,0 +1,32 @@
+<vcards xmlns="urn:ietf:params:xml:ns:vcard-4.0">
+
+  <vcard>
+    <uid>
+      <uri>urn:uuid:K4pNZM8dES</uri>
+    </uid>
+    <x-kolab-version>
+      <text>3.0dev1</text>
+    </x-kolab-version>
+    <prodid>
+      <text>Libkolabxml-0.3.0</text>
+    </prodid>
+    <rev>
+      <timestamp>20120422T231004Z</timestamp>
+    </rev>
+    <kind>
+      <text>individual</text>
+    </kind>
+    <fn>
+      <text>Testcontact</text>
+    </fn>
+    <n>
+      <surname>Testcontact</surname>
+      <given/>
+      <additional/>
+      <prefix/>
+      <suffix/>
+    </n>
+  </vcard>
+
+</vcards>
+





More information about the commits mailing list