summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-02-19 18:03:59 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-02-19 20:15:29 +0100
commite6fa52c2c371c7adc9c2c2cb18c3a8cf782cfa4b (patch)
treef090c50815727c468bebe50311246ab9424d1250 /sw/qa
parent7448b69b4aaa982940e49c5ace9842f07dd81938 (diff)
sw table cell borders: add optional Word-compatible border collapsing
We always compared border width and other aspects only after that, Word works with border weight according to their implementer notes. So extend svx::frame::Style to be able to collapse borders using weights and opt in for that from sw/ in case a compat mode (which is related to tables, off by default and is set by the DOC/DOCX import) is set. Change-Id: I1f682789302c88a0d326c6c0263ad3007441cb24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89052 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/core/layout/data/border-collapse-compat.docxbin0 -> 12669 bytes
-rw-r--r--sw/qa/core/layout/layout.cxx20
2 files changed, 20 insertions, 0 deletions
diff --git a/sw/qa/core/layout/data/border-collapse-compat.docx b/sw/qa/core/layout/data/border-collapse-compat.docx
new file mode 100644
index 000000000000..a3f29cbe8d1c
--- /dev/null
+++ b/sw/qa/core/layout/data/border-collapse-compat.docx
Binary files differ
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index cbea578be4cc..4c16a3bbcd97 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -43,6 +43,26 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTableFlyOverlap)
CPPUNIT_ASSERT_GREATEREQUAL(nFlyBottom, nTableTop);
}
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBorderCollapseCompat)
+{
+ // Load a document with a border conflict: top cell has a dotted bottom border, bottom cell has
+ // a solid upper border.
+ load(DATA_DIRECTORY, "border-collapse-compat.docx");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDocShell* pShell = pTextDoc->GetDocShell();
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+ MetafileXmlDump aDumper;
+ xmlDocPtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
+
+ // Make sure the solid border has priority.
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1
+ // - Actual : 48
+ // i.e. there was no single cell border with width=20, rather there were 48 border parts
+ // (forming a dotted border), all with width=40.
+ assertXPath(pXmlDoc, "//polyline[@style='solid']", "width", "20");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */