summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2016-08-25 20:08:26 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-08-30 11:29:03 +0000
commit129f93e46c29b388d38e9097869fd3e72dc40a5e (patch)
treefe59a543022e650c1dc2f53af2f2f1022b3bf15c /sw/qa
parent5758f8a7f8e2e9819ef09f4e1fe38921b247dc65 (diff)
tdf#91083 ww8import: set table keep/split properties if emulated
This applies primarily to multi-row tables. (Single row tables handle don't-split emulation differently). Since .doc doesn't have table options to "don't split table" and "keep with next paragraph", we emulated that and now we detect the emulation and tick those settings again. Change-Id: Ie923195610aeb72927c9d75276ebf92e48969e6e Reviewed-on: https://gerrit.libreoffice.org/28423 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ww8export/data/tdf91083_tableKeep.docbin0 -> 16384 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export.cxx30
2 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf91083_tableKeep.doc b/sw/qa/extras/ww8export/data/tdf91083_tableKeep.doc
new file mode 100644
index 000000000000..2215ab0e92d3
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf91083_tableKeep.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index a0b651eb6c27..f8fc27a5df69 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -701,9 +701,39 @@ DECLARE_WW8EXPORT_TEST(testTableKeep, "tdf91083.odt")
//emulate table "keep with next" -do not split table
CPPUNIT_ASSERT_EQUAL( OUString("Row 1"), parseDump("/root/page[3]/body/tab[1]/row[2]/cell[1]/txt[1]") );
CPPUNIT_ASSERT_EQUAL( OUString("Row 1"), parseDump("/root/page[6]/body/tab[1]/row[2]/cell[1]/txt[1]") );
+
+ // detect and re-enable keep-with-next and dont-split-table settings
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable (xTables->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xTable, "Split"));
}
#endif
+DECLARE_WW8EXPORT_TEST(testTdf91083_tableKeep, "tdf91083_tableKeep.doc")
+{
+ // detect and re-enable keep-with-next and dont-split-table settings
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+
+ // single-row table - kept with next
+ uno::Reference<text::XTextTable> xTable (xTables->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xTable, "Split"));
+ // I don't know how to test for SvxFormatKeepItem
+
+ // complex table - kept with next
+ xTables->getByIndex(1) >>= xTable;
+ CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xTable, "Split"));
+
+ //single row table - do not split
+ xTables->getByIndex(3) >>= xTable;
+ CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xTable, "Split"));
+
+ //multi-row table - do not split
+ xTables->getByIndex(4) >>= xTable;
+ CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xTable, "Split"));
+}
+
DECLARE_WW8EXPORT_TEST(testMoveRange, "fdo66304-1.odt")
{
//the save must survive without asserting