summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-06-18 20:21:20 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-06-19 11:14:31 +0200
commitb3a62ab0a43510cf43c88aa4d6e145e46db7e7e5 (patch)
treec552864a9463e01729253036163cac52e7f699b6 /sw/qa
parentc23408aeafc1f2ce3f7dde685d0b519d8e2daff7 (diff)
indexing: indexing tables for the IndexingExport
Adds handling of tables to the IndexingExport and also handling of the end node (as table node is also a start node), so we know which paragraphs belong to a table. Change-Id: I624ce12a3e810797a37ae2efe5baa552828f75dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117450 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/indexing/IndexingExportTest.cxx64
-rw-r--r--sw/qa/extras/indexing/data/IndexingExport_Tables.odtbin0 -> 10748 bytes
2 files changed, 64 insertions, 0 deletions
diff --git a/sw/qa/extras/indexing/IndexingExportTest.cxx b/sw/qa/extras/indexing/IndexingExportTest.cxx
index 350e75c3d49f..fbc2c9d0ece2 100644
--- a/sw/qa/extras/indexing/IndexingExportTest.cxx
+++ b/sw/qa/extras/indexing/IndexingExportTest.cxx
@@ -30,12 +30,14 @@ public:
void testIndexingExport_Images();
void testIndexingExport_OLE();
void testIndexingExport_Shapes();
+ void testIndexingExport_Tables();
CPPUNIT_TEST_SUITE(IndexingExportTest);
CPPUNIT_TEST(testIndexingExport_Paragraphs);
CPPUNIT_TEST(testIndexingExport_Images);
CPPUNIT_TEST(testIndexingExport_OLE);
CPPUNIT_TEST(testIndexingExport_Shapes);
+ CPPUNIT_TEST(testIndexingExport_Tables);
CPPUNIT_TEST_SUITE_END();
};
@@ -150,6 +152,68 @@ void IndexingExportTest::testIndexingExport_Shapes()
assertXPathContent(pXmlDoc, "/indexing/shape[3]/paragraph[3]", "Para3");
}
+void IndexingExportTest::testIndexingExport_Tables()
+{
+ SwDoc* pDoc = createDoc("IndexingExport_Tables.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/table[1]", "name", "Table1");
+ assertXPathContent(pXmlDoc, "/indexing/table[1]/paragraph[1]", "A");
+ assertXPathContent(pXmlDoc, "/indexing/table[1]/paragraph[2]", "B");
+ assertXPathContent(pXmlDoc, "/indexing/table[1]/paragraph[3]", "1");
+ assertXPathContent(pXmlDoc, "/indexing/table[1]/paragraph[4]", "2");
+
+ assertXPath(pXmlDoc, "/indexing/table[2]", "name", "Table2");
+ assertXPathContent(pXmlDoc, "/indexing/table[2]/paragraph[1]", "A");
+ assertXPathContent(pXmlDoc, "/indexing/table[2]/paragraph[2]", "B");
+ assertXPathContent(pXmlDoc, "/indexing/table[2]/paragraph[3]", "C");
+ assertXPathContent(pXmlDoc, "/indexing/table[2]/paragraph[4]", "1");
+ assertXPathContent(pXmlDoc, "/indexing/table[2]/paragraph[5]", "10");
+ assertXPathContent(pXmlDoc, "/indexing/table[2]/paragraph[6]", "100");
+ assertXPathContent(pXmlDoc, "/indexing/table[2]/paragraph[7]", "2");
+ assertXPathContent(pXmlDoc, "/indexing/table[2]/paragraph[8]", "20");
+ assertXPathContent(pXmlDoc, "/indexing/table[2]/paragraph[9]", "200");
+ assertXPathContent(pXmlDoc, "/indexing/table[2]/paragraph[10]", "3");
+ assertXPathContent(pXmlDoc, "/indexing/table[2]/paragraph[11]", "30");
+ assertXPathContent(pXmlDoc, "/indexing/table[2]/paragraph[12]", "300");
+ assertXPathContent(pXmlDoc, "/indexing/table[2]/paragraph[13]", "4");
+ assertXPathContent(pXmlDoc, "/indexing/table[2]/paragraph[14]", "40");
+ assertXPathContent(pXmlDoc, "/indexing/table[2]/paragraph[15]", "400");
+
+ assertXPath(pXmlDoc, "/indexing/table[3]", "name", "WeirdTable");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[1]", "A1");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[2]", "B1");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[3]", "C1");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[4]", "D1");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[5]", "A2B2");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[6]", "C2D2");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[7]", "A3B3C3D3");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[8]", "A4-1");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[9]", "A4-2");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[10]", "B4-1");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[11]", "C4-1");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[12]", "D4-1");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[13]", "D4-2");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[14]", "");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[15]", "");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[16]", "B4-2");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[17]", "C4-2");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[18]", "");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[19]", "");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[20]", "A5B5C5");
+ assertXPathContent(pXmlDoc, "/indexing/table[3]/paragraph[21]", "D5");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(IndexingExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/qa/extras/indexing/data/IndexingExport_Tables.odt b/sw/qa/extras/indexing/data/IndexingExport_Tables.odt
new file mode 100644
index 000000000000..a15acc7de309
--- /dev/null
+++ b/sw/qa/extras/indexing/data/IndexingExport_Tables.odt
Binary files differ