diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-06-15 13:57:15 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-06-19 11:13:11 +0200 |
commit | f81115740bac985cad3cd15348f75c2c78b8843a (patch) | |
tree | 357383d715d68b224991d9ca049ac4e3a1644299 /sw/qa | |
parent | 686c35a3c37674d08c1f8585a621143c959b3f29 (diff) |
indexing: indexing graphics for the IndexingExport
Adds handling of graphics to the IndexingExport with exporting
the alt text and the name to the indexing xml.
Change-Id: I20344dd04c5da4668c8eafbf1f863a26357ad616
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117357
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/indexing/IndexingExportTest.cxx | 28 | ||||
-rw-r--r-- | sw/qa/extras/indexing/data/IndexingExport_Images.odt | bin | 0 -> 14607 bytes |
2 files changed, 25 insertions, 3 deletions
diff --git a/sw/qa/extras/indexing/IndexingExportTest.cxx b/sw/qa/extras/indexing/IndexingExportTest.cxx index 9d943e3b9593..f76850c1a803 100644 --- a/sw/qa/extras/indexing/IndexingExportTest.cxx +++ b/sw/qa/extras/indexing/IndexingExportTest.cxx @@ -26,10 +26,12 @@ private: SwDoc* createDoc(const char* pName = nullptr); public: - void testIndexingExport(); + void testIndexingExport_Paragraphs(); + void testIndexingExport_Images(); CPPUNIT_TEST_SUITE(IndexingExportTest); - CPPUNIT_TEST(testIndexingExport); + CPPUNIT_TEST(testIndexingExport_Paragraphs); + CPPUNIT_TEST(testIndexingExport_Images); CPPUNIT_TEST_SUITE_END(); }; @@ -45,7 +47,7 @@ SwDoc* IndexingExportTest::createDoc(const char* pName) return pTextDoc->GetDocShell()->GetDoc(); } -void IndexingExportTest::testIndexingExport() +void IndexingExportTest::testIndexingExport_Paragraphs() { SwDoc* pDoc = createDoc("IndexingExport_VariousParagraphs.odt"); CPPUNIT_ASSERT(pDoc); @@ -78,6 +80,26 @@ void IndexingExportTest::testIndexingExport() assertXPathContent(pXmlDoc, "/indexing/paragraph[17]", "Bold Italic Underline Strikeout"); } +void IndexingExportTest::testIndexingExport_Images() +{ + SwDoc* pDoc = createDoc("IndexingExport_Images.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/graphic[1]", "alt", "Image_NonCaption - Alternative text"); + assertXPath(pXmlDoc, "/indexing/graphic[1]", "name", "Image_NonCaption"); + assertXPath(pXmlDoc, "/indexing/graphic[2]", "alt", "Image_InCaption - Alternative text"); + assertXPath(pXmlDoc, "/indexing/graphic[2]", "name", "Image_InCaption"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(IndexingExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/indexing/data/IndexingExport_Images.odt b/sw/qa/extras/indexing/data/IndexingExport_Images.odt Binary files differnew file mode 100644 index 000000000000..3bf4120e27b4 --- /dev/null +++ b/sw/qa/extras/indexing/data/IndexingExport_Images.odt |