summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2020-06-04 21:08:10 +0300
committerJustin Luth <justin_luth@sil.org>2020-07-14 06:02:40 +0200
commitc5e4c2603197ecfbc19957da775f80ba06648105 (patch)
treec0ce7987d1c9e7858f1d9fcc3a68f0db1a5a33dc
parentf7eff4319be741143f6d8d5e0f2995e3ce46b126 (diff)
tdf#131561 writerfilter: pre-emptive unit test
Someone might be tempted to just delete any border on a merged cell, hoping/expecting that the adjoining cell would have a corresponding border. Granted, this test was hand-crafted and is not necessarily something that Word would ever create. At least be aware that any fix that breaks this example is not a complete solution. Change-Id: I438c835b54ec8b33eb48de55f09a7cf2965f6440 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95533 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf131561_necessaryBorder.docxbin0 -> 9385 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport15.cxx16
2 files changed, 16 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf131561_necessaryBorder.docx b/sw/qa/extras/ooxmlexport/data/tdf131561_necessaryBorder.docx
new file mode 100644
index 000000000000..51d1c52022c3
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf131561_necessaryBorder.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 1e13de385fa4..776fe5df0010 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -57,6 +57,22 @@ DECLARE_OOXMLEXPORT_TEST(testTdf129452_excessBorder, "tdf129452_excessBorder.doc
CPPUNIT_ASSERT_EQUAL_MESSAGE("No bottom border on merged cell", sal_uInt32(0), aBorder.LineWidth);
}
+DECLARE_OOXMLEXPORT_TEST(testTdf131561_necessaryBorder, "tdf131561_necessaryBorder.docx")
+{
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+
+ // Hand-crafted pre-emptive test to make sure borders aren't lost.
+ // MS Word is interesting here. 2/3 of the merged cell has the right border, so what to do?
+ table::BorderLine2 aBorderR = getProperty<table::BorderLine2>(xTable->getCellByName("A1"), "RightBorder");
+ table::BorderLine2 aBorderL = getProperty<table::BorderLine2>(xTable->getCellByName("B1"), "LeftBorder");
+ CPPUNIT_ASSERT_MESSAGE("Border between A1 and B1", (aBorderR.LineWidth + aBorderL.LineWidth) > 0);
+ aBorderR = getProperty<table::BorderLine2>(xTable->getCellByName("A3"), "RightBorder");
+ aBorderL = getProperty<table::BorderLine2>(xTable->getCellByName("B3"), "LeftBorder");
+ CPPUNIT_ASSERT_MESSAGE("Border between A3 and B3", (aBorderR.LineWidth + aBorderL.LineWidth) > 0);
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134063.docx")
{
CPPUNIT_ASSERT_EQUAL(2, getPages());