[Libreoffice-commits] core.git: sw/qa

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 14 04:03:28 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf131561_necessaryBorder.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx                   |   16 +++++++++++
 2 files changed, 16 insertions(+)

New commits:
commit c5e4c2603197ecfbc19957da775f80ba06648105
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Thu Jun 4 21:08:10 2020 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Tue Jul 14 06:02:40 2020 +0200

    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 at sil.org>

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<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());


More information about the Libreoffice-commits mailing list