diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-06-10 16:34:41 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-06-17 15:03:03 +0200 |
commit | 1da7d73eeaaff43e4f3e8a61ad77fcec3c7aaed8 (patch) | |
tree | af6d393d443f51525b760f4549765a611b87371c /sw/qa | |
parent | 41ef183bbfcf569eb5995c5436edca3d00050385 (diff) |
indexing: remove indexing changes from html export
Turns out that reusing HTML export wasn't the best way to generate
output XML that can be used for indexing, so reverting those
changes.
The IndexingExportTest and the test file has been moved out of
html to its own folder, so it can be reused.
Change-Id: Ie2b34285775133322c16c05eee9c0e9712c86c3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117354
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/htmlexport/IndexingExport.cxx | 44 | ||||
-rw-r--r-- | sw/qa/extras/indexing/IndexingExportTest.cxx | 55 | ||||
-rw-r--r-- | sw/qa/extras/indexing/data/IndexingExport_VariousParagraphs.odt (renamed from sw/qa/extras/htmlexport/data/IndexingExport_VariousParagraphs.odt) | bin | 11111 -> 11111 bytes |
3 files changed, 55 insertions, 44 deletions
diff --git a/sw/qa/extras/htmlexport/IndexingExport.cxx b/sw/qa/extras/htmlexport/IndexingExport.cxx deleted file mode 100644 index f10c6ec08470..000000000000 --- a/sw/qa/extras/htmlexport/IndexingExport.cxx +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- 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/indexing/IndexingExportTest.cxx b/sw/qa/extras/indexing/IndexingExportTest.cxx new file mode 100644 index 000000000000..eed303c3e97b --- /dev/null +++ b/sw/qa/extras/indexing/IndexingExportTest.cxx @@ -0,0 +1,55 @@ +/* -*- 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 <string_view> +#include <swmodeltestbase.hxx> +#include <docsh.hxx> +#include <unotxdoc.hxx> + +namespace +{ +constexpr OUStringLiteral DATA_DIRECTORY = u"sw/qa/extras/indexing/data/"; +} + +class IndexingExportTest : public SwModelTestBase +{ +private: + SwDoc* createDoc(const char* pName = nullptr); + +public: + void testIndexingExport(); + + CPPUNIT_TEST_SUITE(IndexingExportTest); + CPPUNIT_TEST(testIndexingExport); + CPPUNIT_TEST_SUITE_END(); +}; + +SwDoc* IndexingExportTest::createDoc(const char* pName) +{ + if (!pName) + loadURL("private:factory/swriter", nullptr); + else + load(DATA_DIRECTORY, pName); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + return pTextDoc->GetDocShell()->GetDoc(); +} + +void IndexingExportTest::testIndexingExport() +{ + SwDoc* pDoc = createDoc("IndexingExport_VariousParagraphs.odt"); + CPPUNIT_ASSERT(pDoc); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(IndexingExportTest); +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/indexing/data/IndexingExport_VariousParagraphs.odt Binary files differindex eb8904720f29..eb8904720f29 100644 --- a/sw/qa/extras/htmlexport/data/IndexingExport_VariousParagraphs.odt +++ b/sw/qa/extras/indexing/data/IndexingExport_VariousParagraphs.odt |