[Libreoffice-commits] core.git: sw/CppunitTest_sw_docbookexport.mk sw/Module_sw.mk sw/qa

Laurent Godard lgodard.libre at laposte.net
Thu May 21 08:11:45 PDT 2015


 sw/CppunitTest_sw_docbookexport.mk            |   58 ++++++++++++++++++++++++++
 sw/Module_sw.mk                               |    1 
 sw/qa/extras/docbookexport/data/simple.docx   |binary
 sw/qa/extras/docbookexport/data/tdf91095.docx |binary
 sw/qa/extras/docbookexport/docbookexport.cxx  |   50 ++++++++++++++++++++++
 5 files changed, 109 insertions(+)

New commits:
commit fb8377fe404564871d7be8cf777abe2108c74951
Author: Laurent Godard <lgodard.libre at laposte.net>
Date:   Wed May 6 16:36:52 2015 +0200

    unit test for tdf#91095
    
    and ready for any docbook export tests
    
    Change-Id: Ia1c7a5066fc72c502c3b0ebb5811910797943742
    Reviewed-on: https://gerrit.libreoffice.org/15653
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/CppunitTest_sw_docbookexport.mk b/sw/CppunitTest_sw_docbookexport.mk
new file mode 100644
index 0000000..9bed3e13
--- /dev/null
+++ b/sw/CppunitTest_sw_docbookexport.mk
@@ -0,0 +1,58 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sw_docbookexport))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_docbookexport, \
+    sw/qa/extras/docbookexport/docbookexport \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sw_docbookexport, \
+    comphelper \
+    cppu \
+	cppuhelper \
+	i18nlangtag \
+    sal \
+    sw \
+    test \
+	tl \
+    unotest \
+    utl \
+    vcl \
+	$(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sw_docbookexport,\
+	boost_headers \
+    libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_docbookexport,\
+    -I$(SRCDIR)/sw/inc \
+    -I$(SRCDIR)/sw/source/core/inc \
+    -I$(SRCDIR)/sw/source/uibase/inc \
+	-I$(SRCDIR)/sw/qa/extras/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sw_docbookexport,\
+    offapi \
+    udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sw_docbookexport))
+$(eval $(call gb_CppunitTest_use_vcl,sw_docbookexport))
+
+$(eval $(call gb_CppunitTest_use_rdb,sw_docbookexport,services))
+
+$(eval $(call gb_CppunitTest_use_configuration,sw_docbookexport))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 13453b5..ce01e9a 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -48,6 +48,7 @@ endif
 $(eval $(call gb_Module_add_slowcheck_targets,sw,\
 	$(if $(and $(filter $(COM),MSC),$(MERGELIBS)),, \
 		CppunitTest_sw_uwriter) \
+    CppunitTest_sw_docbookexport \
     CppunitTest_sw_htmlexport \
     CppunitTest_sw_htmlimport \
     CppunitTest_sw_macros_test \
diff --git a/sw/qa/extras/docbookexport/data/simple.docx b/sw/qa/extras/docbookexport/data/simple.docx
new file mode 100644
index 0000000..89081fd
Binary files /dev/null and b/sw/qa/extras/docbookexport/data/simple.docx differ
diff --git a/sw/qa/extras/docbookexport/data/tdf91095.docx b/sw/qa/extras/docbookexport/data/tdf91095.docx
new file mode 100644
index 0000000..fbe23c8
Binary files /dev/null and b/sw/qa/extras/docbookexport/data/tdf91095.docx differ
diff --git a/sw/qa/extras/docbookexport/docbookexport.cxx b/sw/qa/extras/docbookexport/docbookexport.cxx
new file mode 100644
index 0000000..2f52546
--- /dev/null
+++ b/sw/qa/extras/docbookexport/docbookexport.cxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <swmodeltestbase.hxx>
+
+#include <swmodule.hxx>
+#include <swdll.hxx>
+#include <usrpref.hxx>
+
+#include <test/xmltesttools.hxx>
+
+class DocbookExportTest : public SwModelTestBase
+{
+private:
+    FieldUnit m_eUnit;
+
+public:
+    DocbookExportTest() :
+        SwModelTestBase("/sw/qa/extras/docbookexport/data/", "DocBook File"),
+        m_eUnit(FUNIT_NONE)
+    {}
+};
+
+#define DECLARE_DOCBOOKEXPORT_TEST(TestName, filename) DECLARE_SW_EXPORT_TEST(TestName, filename, DocbookExportTest)
+
+DECLARE_DOCBOOKEXPORT_TEST(testsimple, "simple.docx")
+{
+    xmlDocPtr pDoc = parseXml(maTempFile);
+    CPPUNIT_ASSERT(pDoc);
+
+    assertXPathContent(pDoc, "/article/para", "aaaa");
+}
+
+/* the test actually should crash with this file */
+DECLARE_DOCBOOKEXPORT_TEST(testtdf91095, "tdf91095.docx")
+{
+    xmlDocPtr pDoc = parseXml(maTempFile);
+    CPPUNIT_ASSERT(pDoc);
+}
+
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list