diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-06-25 17:34:29 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-09-01 05:09:47 +0200 |
commit | e9e83f118413041d73066b45795ab73ae3c5d25c (patch) | |
tree | 0900971e2daf497247153d18dbf1eb6f7a579187 /sw | |
parent | 27230f51281e3ce608de6632a485cebd4de3a781 (diff) |
indexing: add test case for fontworks and footer/header paragraphs
Change-Id: I7b6879d0e038f8c07ae5853d66c43096c25365e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117841
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit 922e2610a4745c6e33d9e8e808131922a3ea0dc4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121106
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/indexing/IndexingExportTest.cxx | 46 | ||||
-rw-r--r-- | sw/qa/extras/indexing/data/IndexingExport_Fontwork.odt | bin | 0 -> 12090 bytes | |||
-rw-r--r-- | sw/qa/extras/indexing/data/IndexingExport_Header_Footer.odt | bin | 0 -> 9644 bytes |
3 files changed, 46 insertions, 0 deletions
diff --git a/sw/qa/extras/indexing/IndexingExportTest.cxx b/sw/qa/extras/indexing/IndexingExportTest.cxx index f714b50f042a..41cbfa1c9d79 100644 --- a/sw/qa/extras/indexing/IndexingExportTest.cxx +++ b/sw/qa/extras/indexing/IndexingExportTest.cxx @@ -32,6 +32,8 @@ public: void testIndexingExport_Shapes(); void testIndexingExport_Tables(); void testIndexingExport_Sections(); + void testIndexingExport_Fontwork(); + void testIndexingExport_Header_Footer(); CPPUNIT_TEST_SUITE(IndexingExportTest); CPPUNIT_TEST(testIndexingExport_Paragraphs); @@ -40,6 +42,8 @@ public: CPPUNIT_TEST(testIndexingExport_Shapes); CPPUNIT_TEST(testIndexingExport_Tables); CPPUNIT_TEST(testIndexingExport_Sections); + CPPUNIT_TEST(testIndexingExport_Fontwork); + CPPUNIT_TEST(testIndexingExport_Header_Footer); CPPUNIT_TEST_SUITE_END(); }; @@ -245,6 +249,48 @@ void IndexingExportTest::testIndexingExport_Sections() assertXPathContent(pXmlDoc, "/indexing/paragraph[2]", "This is a paragraph outside sections"); } +void IndexingExportTest::testIndexingExport_Fontwork() +{ + SwDoc* pDoc = createDoc("IndexingExport_Fontwork.odt"); + CPPUNIT_ASSERT(pDoc); + + SvMemoryStream aMemoryStream; + sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); + aIndexingExport.runExport(); + aMemoryStream.Seek(0); + + xmlDocUniquePtr pXmlDoc = parseXmlStream(&aMemoryStream); + CPPUNIT_ASSERT(pXmlDoc); + + assertXPath(pXmlDoc, "/indexing"); + + assertXPath(pXmlDoc, "/indexing/shape[1]", "name", "Gray"); + + assertXPathContent(pXmlDoc, "/indexing/shape[1]/paragraph[1]", "Fontwork Text 1"); + assertXPathContent(pXmlDoc, "/indexing/shape[1]/paragraph[2]", "Fontwork Text 2"); +} + +void IndexingExportTest::testIndexingExport_Header_Footer() +{ + SwDoc* pDoc = createDoc("IndexingExport_Header_Footer.odt"); + CPPUNIT_ASSERT(pDoc); + + SvMemoryStream aMemoryStream; + sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); + aIndexingExport.runExport(); + aMemoryStream.Seek(0); + + xmlDocUniquePtr pXmlDoc = parseXmlStream(&aMemoryStream); + CPPUNIT_ASSERT(pXmlDoc); + + assertXPath(pXmlDoc, "/indexing"); + + assertXPathContent(pXmlDoc, "/indexing/paragraph[1]", "Header Text"); + assertXPathContent(pXmlDoc, "/indexing/paragraph[2]", "Footer Text"); + assertXPathContent(pXmlDoc, "/indexing/paragraph[3]", "Paragraph 1"); + assertXPathContent(pXmlDoc, "/indexing/paragraph[4]", "Paragraph 2"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(IndexingExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/indexing/data/IndexingExport_Fontwork.odt b/sw/qa/extras/indexing/data/IndexingExport_Fontwork.odt Binary files differnew file mode 100644 index 000000000000..df1a7aef5d91 --- /dev/null +++ b/sw/qa/extras/indexing/data/IndexingExport_Fontwork.odt diff --git a/sw/qa/extras/indexing/data/IndexingExport_Header_Footer.odt b/sw/qa/extras/indexing/data/IndexingExport_Header_Footer.odt Binary files differnew file mode 100644 index 000000000000..744e6ade4536 --- /dev/null +++ b/sw/qa/extras/indexing/data/IndexingExport_Header_Footer.odt |