diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-10-31 13:41:20 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-10-31 18:14:33 +0100 |
commit | d40c2be38aaf56116f4dc7be9e78f4e9695407fc (patch) | |
tree | 3f45ea21d6d8d84b6829cbf22367b61bf6e3db2c /sw | |
parent | 94890fdc3402d1b62a22824235e557d191332bd9 (diff) |
tdf#125038 DOCX import: better support for linebreaks in IF fields
IF fields can't contain linebreaks, so instead of just calling
finishParagraph() and hoping it does something sane, explicitly handle
them: remember the properties and perform the call only once the field
is closed.
Change-Id: I676aa2c83f12cb600829177a0eb25558822b1d94
Reviewed-on: https://gerrit.libreoffice.org/81847
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 2c2d94821acf..27317edd1615 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -56,7 +56,13 @@ DECLARE_OOXMLIMPORT_TEST(testTdf125038b, "tdf125038b.docx") uno::Reference<container::XEnumerationAccess> xParagraphAccess(xTextDocument->getText(), uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParagraphs = xParagraphAccess->createEnumeration(); CPPUNIT_ASSERT(xParagraphs->hasMoreElements()); - xParagraphs->nextElement(); + uno::Reference<text::XTextRange> xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: phone: 1234 + // - Actual : + // i.e. the the first paragraph was empty and the second paragraph had the content. + CPPUNIT_ASSERT_EQUAL(OUString("phone: 1234"), xParagraph->getString()); CPPUNIT_ASSERT(xParagraphs->hasMoreElements()); xParagraphs->nextElement(); |