summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Godard <lgodard.libre@laposte.net>2015-05-06 16:36:52 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-05-21 15:11:17 +0000
commitfb8377fe404564871d7be8cf777abe2108c74951 (patch)
tree5aafda06f76a99ac2ce676a620afbfddc38469a7
parent2c798538041310294ac7900b110620a8eece9150 (diff)
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@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/CppunitTest_sw_docbookexport.mk58
-rw-r--r--sw/Module_sw.mk1
-rw-r--r--sw/qa/extras/docbookexport/data/simple.docxbin0 -> 3759 bytes
-rw-r--r--sw/qa/extras/docbookexport/data/tdf91095.docxbin0 -> 19141 bytes
-rw-r--r--sw/qa/extras/docbookexport/docbookexport.cxx50
5 files changed, 109 insertions, 0 deletions
diff --git a/sw/CppunitTest_sw_docbookexport.mk b/sw/CppunitTest_sw_docbookexport.mk
new file mode 100644
index 000000000000..9bed3e131169
--- /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 13453b5beb10..ce01e9a0904d 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 000000000000..89081fd3cbb6
--- /dev/null
+++ b/sw/qa/extras/docbookexport/data/simple.docx
Binary files differ
diff --git a/sw/qa/extras/docbookexport/data/tdf91095.docx b/sw/qa/extras/docbookexport/data/tdf91095.docx
new file mode 100644
index 000000000000..fbe23c80e632
--- /dev/null
+++ b/sw/qa/extras/docbookexport/data/tdf91095.docx
Binary files differ
diff --git a/sw/qa/extras/docbookexport/docbookexport.cxx b/sw/qa/extras/docbookexport/docbookexport.cxx
new file mode 100644
index 000000000000..2f5254684bf5
--- /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: */