summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2018-07-18 10:56:28 +0200
committerLászló Németh <nemeth@numbertext.org>2018-07-18 12:21:14 +0200
commit480ac84f2f5049fb4337b36f12fd6796e005761b (patch)
tree93750662be9f9265e7893f3f8767aad5f0de2730
parent9e9138c09bd3d05ff45a6aabf574af897ef93a1e (diff)
tdf#118521 unit test for DOCX import: fix paragraph margin from style
Change-Id: Ifa9d3803ab6440544a027bf35367e3c25faf1fd3 Reviewed-on: https://gerrit.libreoffice.org/57620 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--sw/qa/extras/ooxmlexport/data/margins_from_style.docxbin0 -> 13878 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx17
2 files changed, 17 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/margins_from_style.docx b/sw/qa/extras/ooxmlexport/data/margins_from_style.docx
new file mode 100644
index 000000000000..721982458e4f
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/margins_from_style.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 31a8a70989d8..034f252bad26 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -447,6 +447,23 @@ DECLARE_OOXMLEXPORT_TEST(testOpenDocumentAsReadOnly, "open-as-read-only.docx")
CPPUNIT_ASSERT(pTextDoc->GetDocShell()->IsSecurityOptOpenReadOnly());
}
+DECLARE_OOXMLEXPORT_TEST(testMarginsFromStyle, "margins_from_style.docx")
+{
+ // tdf#118521 paragraphs with direct formatting of top or bottom margins have
+ // lost the other margin comes from paragraph style, getting a bad
+ // margin from the default style
+
+ // from direct formatting
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(35), getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin"));
+ // from paragraph style
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(106), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin"));
+
+ // from paragraph style
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(388), getProperty<sal_Int32>(getParagraph(3), "ParaTopMargin"));
+ // from direct formatting
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(600), getProperty<sal_Int32>(getParagraph(3), "ParaBottomMargin"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */