From c5e4c2603197ecfbc19957da775f80ba06648105 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Thu, 4 Jun 2020 21:08:10 +0300 Subject: 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 --- .../ooxmlexport/data/tdf131561_necessaryBorder.docx | Bin 0 -> 9385 bytes sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 16 ++++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 sw/qa/extras/ooxmlexport/data/tdf131561_necessaryBorder.docx (limited to 'sw') 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 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf131561_necessaryBorder.docx 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 xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference 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(xTable->getCellByName("A1"), "RightBorder"); + table::BorderLine2 aBorderL = getProperty(xTable->getCellByName("B1"), "LeftBorder"); + CPPUNIT_ASSERT_MESSAGE("Border between A1 and B1", (aBorderR.LineWidth + aBorderL.LineWidth) > 0); + aBorderR = getProperty(xTable->getCellByName("A3"), "RightBorder"); + aBorderL = getProperty(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()); -- cgit