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>
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 0000000..7219824
--- /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 31a8a70..034f252 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: */