diff options
Diffstat (limited to 'sw/qa/extras/ooxmlexport/ooxmlexport9.cxx')
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index be729d8ecd33..11d073ec8b9e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -11,6 +11,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> +#include <com/sun/star/table/BorderLine.hpp> #include <com/sun/star/text/XDependentTextField.hpp> #include <com/sun/star/text/XPageCursor.hpp> #include <com/sun/star/text/XTextColumns.hpp> @@ -647,6 +648,42 @@ DECLARE_OOXMLEXPORT_TEST(testGraphicObjectFliph, "graphic-object-fliph.docx") CPPUNIT_ASSERT(getProperty<bool>(getShape(1), "HoriMirroredOnOddPages")); } +DECLARE_OOXMLEXPORT_TEST(testTdf112118, "tdf112118.docx") +{ + auto xStyles = getStyles("PageStyles"); + const std::initializer_list<OUStringLiteral> sides = { + OUStringLiteral("Top"), + OUStringLiteral("Left"), + OUStringLiteral("Bottom"), + OUStringLiteral("Right") + }; + auto testProc = [&](const OUString& sStyleName, sal_Int32 nMargin, sal_Int32 nBorderDistance, + sal_Int16 nBorderWidth) + { + uno::Reference<beans::XPropertySet> xStyle(xStyles->getByName(sStyleName), uno::UNO_QUERY_THROW); + for (const auto& side : sides) + { + table::BorderLine aBorder = getProperty<table::BorderLine>(xStyle, side + "Border"); + CPPUNIT_ASSERT_EQUAL(sal_Int16(nBorderWidth), aBorder.OuterLineWidth); + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), aBorder.InnerLineWidth); + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), aBorder.LineDistance); + + sal_Int32 nMarginActual = getProperty<sal_Int32>(xStyle, side + "Margin"); + CPPUNIT_ASSERT_EQUAL(nMargin, nMarginActual); + + sal_Int32 nBorderDistanceActual = getProperty<sal_Int32>(xStyle, side + "BorderDistance"); + CPPUNIT_ASSERT_EQUAL(nBorderDistance, nBorderDistanceActual); + } + }; + + // For both styles used in document, the total distance from page edge to text must be 2.54 cm. + // The first style uses "from edge" border distance; the second uses "from text" border distance + // Border distances in both cases are 24 pt = 847 mm100; line widths are 6 pt = 212 mm100. + // 1482 + 847 + 212 = 2541 + testProc("Standard", 847, 1482, 212); + testProc("Converted1", 1482, 847, 212); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |