summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ww8export
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-03-18 10:09:18 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-03-18 10:53:45 +0100
commit0da10420ed6e69384498de7404287e8c936fef14 (patch)
treec96124505388cec0ee7bd930b6d4d835b185fee5 /sw/qa/extras/ww8export
parent7dd087002816cdde9a5049a36840446765061fb8 (diff)
sw clearing breaks: add DOC export
Map SwLineBreakClear to sprmCLbcCRJ's LBCOperand. And most importantly, write the newline character: a clearing break was not "downgraded" to a plain line break previously. Change-Id: I3bc11a120af09d5c774df992cb17cfc5ee251e1d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131732 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/qa/extras/ww8export')
-rw-r--r--sw/qa/extras/ww8export/ww8export3.cxx44
1 files changed, 25 insertions, 19 deletions
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index e0eb32ee9f1b..261d74938e70 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -33,6 +33,7 @@
#include <IDocumentSettingAccess.hxx>
#include <docsh.hxx>
#include <unotxdoc.hxx>
+#include <formatlinebreak.hxx>
class Test : public SwModelTestBase
{
@@ -997,29 +998,34 @@ DECLARE_WW8EXPORT_TEST(testTdf79186_noLayoutInCell, "tdf79186_noLayoutInCell.odt
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.doc");
-
// Then make sure that the clear property of the break is not ignored:
- 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;
- // SwLineBreakClear::ALL
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(3), eClear);
+ verify();
+ reload(mpFilter, "clearing-break.doc");
+ // Make sure that that the clear property of the break is not ignored during export:
+ verify();
}
CPPUNIT_PLUGIN_IMPLEMENT();