summaryrefslogtreecommitdiff
path: root/sw/qa/extras/htmlexport
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-05-31 22:55:02 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-06-03 23:05:45 +0200
commited984f8e68996bcbdcf590814c41479ba76907f2 (patch)
tree61daaf9803f65a437d91a0ac0a9a9bfc0c8ff566 /sw/qa/extras/htmlexport
parentabcfae0b64e6733b1de469414fe3c73f94f9a39a (diff)
indexing: start of Indexing Export impl. based on (X)HTML export
This adds a indexing output/export to HTML code, which will output a xml document that will be used for indexing of the document. It is based on HTML to reuse the traversal through the doc. model. It is enabled by setting the "IndexingOutput" export parameter. This commit only adds in the groundwork, but the output is still more or less the same as html and the follow up commits will add more indexing specific changes. The only change is to use "indexing" as the top level element and the document is a valid xml (has the xml header). Also add basic test that the indexing output/export works and can be parsed as an xml with "indexing" top level element. Change-Id: I153b1a70da7cbcf0d33b8610d962e6b7ae23ad23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116631 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw/qa/extras/htmlexport')
-rw-r--r--sw/qa/extras/htmlexport/IndexingExport.cxx44
-rw-r--r--sw/qa/extras/htmlexport/data/IndexingExport_VariousParagraphs.odtbin0 -> 11111 bytes
2 files changed, 44 insertions, 0 deletions
diff --git a/sw/qa/extras/htmlexport/IndexingExport.cxx b/sw/qa/extras/htmlexport/IndexingExport.cxx
new file mode 100644
index 000000000000..f10c6ec08470
--- /dev/null
+++ b/sw/qa/extras/htmlexport/IndexingExport.cxx
@@ -0,0 +1,44 @@
+/* -*- 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 <memory>
+#include <swmodeltestbase.hxx>
+
+#include <test/htmltesttools.hxx>
+
+class IndexingExportTest : public SwModelTestBase
+{
+public:
+ IndexingExportTest()
+ : SwModelTestBase("/sw/qa/extras/htmlexport/data/", "HTML (StarWriter)")
+ {
+ }
+
+private:
+ virtual std::unique_ptr<Resetter> preTest(const char*) override
+ {
+ setFilterOptions("IndexingOutput");
+ return nullptr;
+ }
+};
+
+#define DECLARE_INDEXINGEXPORT_TEST(TestName, filename) \
+ DECLARE_SW_EXPORT_TEST(TestName, filename, nullptr, IndexingExportTest)
+
+DECLARE_INDEXINGEXPORT_TEST(testIndexingSimpleParagraph, "IndexingExport_VariousParagraphs.odt")
+{
+ xmlDocUniquePtr pDoc = parseXml(maTempFile);
+ CPPUNIT_ASSERT(pDoc);
+
+ assertXPath(pDoc, "/indexing", 1);
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/htmlexport/data/IndexingExport_VariousParagraphs.odt b/sw/qa/extras/htmlexport/data/IndexingExport_VariousParagraphs.odt
new file mode 100644
index 000000000000..eb8904720f29
--- /dev/null
+++ b/sw/qa/extras/htmlexport/data/IndexingExport_VariousParagraphs.odt
Binary files differ