sw/qa/extras/indexing/IndexingExportTest.cxx | 46 ++++++++++++ sw/qa/extras/indexing/data/IndexingExport_Fontwork.odt |binary sw/qa/extras/indexing/data/IndexingExport_Header_Footer.odt |binary 3 files changed, 46 insertions(+)
New commits: commit 922e2610a4745c6e33d9e8e808131922a3ea0dc4 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Jun 25 17:34:29 2021 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Sat Jun 26 11:45:06 2021 +0200 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 <qui...@gmail.com> 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 new file mode 100644 index 000000000000..df1a7aef5d91 Binary files /dev/null and b/sw/qa/extras/indexing/data/IndexingExport_Fontwork.odt differ diff --git a/sw/qa/extras/indexing/data/IndexingExport_Header_Footer.odt b/sw/qa/extras/indexing/data/IndexingExport_Header_Footer.odt new file mode 100644 index 000000000000..744e6ade4536 Binary files /dev/null and b/sw/qa/extras/indexing/data/IndexingExport_Header_Footer.odt differ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits