sw/qa/extras/ww8import/data/changes-in-footnote.doc |binary sw/qa/extras/ww8import/ww8import.cxx | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+)
New commits: commit 1176c982d60b7e97ca063259326772495dbdde2c Author: Caolán McNamara <[email protected]> AuthorDate: Tue Aug 17 11:33:39 2021 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Tue Aug 17 15:32:00 2021 +0200 Related: tdf#142003 add a test for this case Change-Id: I32ca1ccdcf221c0ef6933fa1018b5f2eb753fa7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120571 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/qa/extras/ww8import/data/changes-in-footnote.doc b/sw/qa/extras/ww8import/data/changes-in-footnote.doc new file mode 100644 index 000000000000..789795eb0b81 Binary files /dev/null and b/sw/qa/extras/ww8import/data/changes-in-footnote.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index b653db7ef85c..0a585dc5e43b 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -20,6 +20,7 @@ #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> +#include <editsh.hxx> #include <ndgrf.hxx> #include <docsh.hxx> #include <unotxdoc.hxx> @@ -280,6 +281,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf120761_zOrder) CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), getProperty<sal_uInt32>(xShape, "ZOrder")); } +CPPUNIT_TEST_FIXTURE(Test, testTdf142003) +{ + load(mpTestDocumentPath, "changes-in-footnote.doc"); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + SwEditShell* const pEditShell(pTextDoc->GetDocShell()->GetDoc()->GetEditShell()); + pEditShell->AcceptRedline(0); + + //The changes were offset from where they should have been + uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); + uno::Reference<text::XTextRange> xParagraph(xFootnotes->getByIndex(0), uno::UNO_QUERY); + //before change was incorrect, Loren ipsum , doconsectetur ... + CPPUNIT_ASSERT(xParagraph->getString().startsWith("Lorem ipsum , consectetur adipiscing elit.")); +} // tests should only be added to ww8IMPORT *if* they fail round-tripping in ww8EXPORT
