diff options
Diffstat (limited to 'sw/qa/extras/rtfexport/rtfexport4.cxx')
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport4.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index 26426654d54a..058972ef09e0 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -23,6 +23,7 @@ #include <pam.hxx> #include <fmtanchr.hxx> #include <frameformats.hxx> +#include <formatlinebreak.hxx> using namespace css; @@ -429,6 +430,38 @@ CPPUNIT_TEST_FIXTURE(Test, testGutterTop) CPPUNIT_ASSERT(bGutterAtTop); } +CPPUNIT_TEST_FIXTURE(Test, testClearingBreak) +{ + auto verify = [this]() { + uno::Reference<container::XEnumerationAccess> xParagraph(getParagraph(1), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xPortions = xParagraph->createEnumeration(); + xPortions->nextElement(); + xPortions->nextElement(); + // Without the accompanying fix in place, this test would have failed with: + // An uncaught exception of type com.sun.star.container.NoSuchElementException + // i.e. the first para was just a fly + text portion, the clearing break was lost. + uno::Reference<beans::XPropertySet> xPortion(xPortions->nextElement(), uno::UNO_QUERY); + OUString aPortionType; + xPortion->getPropertyValue("TextPortionType") >>= aPortionType; + CPPUNIT_ASSERT_EQUAL(OUString("LineBreak"), aPortionType); + uno::Reference<text::XTextContent> xLineBreak; + xPortion->getPropertyValue("LineBreak") >>= xLineBreak; + sal_Int16 eClear{}; + uno::Reference<beans::XPropertySet> xLineBreakProps(xLineBreak, uno::UNO_QUERY); + xLineBreakProps->getPropertyValue("Clear") >>= eClear; + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(SwLineBreakClear::ALL), eClear); + }; + + // Given a document with a clearing break: + // When loading that file: + load(mpTestDocumentPath, "clearing-break.rtf"); + // Then make sure that the clear property of the break is not ignored: + verify(); + reload(mpFilter, "clearing-break.rtf"); + // Make sure that that the clear property of the break is not ignored during export: + verify(); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |