From f78a21df119603cd6db03f8544871c7a41f16864 Mon Sep 17 00:00:00 2001 From: László Németh Date: Tue, 20 Jul 2021 09:51:47 +0200 Subject: tdf#143399 DOCX import: fix lost endnotes or footnotes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in a document containing both of them. Regression from commit 7dd8f8aace536a8e60e87e61ee1d90d61fba15eb "tdf#120351 DOCX import: fix slow endnote import". Change-Id: I0fe764f3b48dd2688afa4b7cf0ee6658737ef9fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119239 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 732b08b22eee2682351a9295be29188852fb0489) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119187 Tested-by: Jenkins --- sw/qa/extras/ooxmlexport/data/tdf143399.docx | Bin 0 -> 14354 bytes sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 17 +++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 sw/qa/extras/ooxmlexport/data/tdf143399.docx (limited to 'sw') diff --git a/sw/qa/extras/ooxmlexport/data/tdf143399.docx b/sw/qa/extras/ooxmlexport/data/tdf143399.docx new file mode 100644 index 000000000000..191e46f36bb1 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf143399.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index e383984c1170..9944636960c0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -1160,6 +1160,23 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf141548, "tdf141548.docx") assertXPathContent(pXml, "/w:endnotes/w:endnote[4]/w:p/w:r[2]/w:t[2]", "new line"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf143399, "tdf143399.docx") +{ + xmlDocUniquePtr pXml = parseExport("word/footnotes.xml"); + CPPUNIT_ASSERT(pXml); + // These were 0 (lost text content of documents both with footnotes and endnotes) + assertXPath(pXml, "/w:footnotes/w:footnote[3]/w:p/w:r[3]/w:t", 1); + assertXPathContent(pXml, "/w:footnotes/w:footnote[3]/w:p/w:r[3]/w:t", "Footnotes_graphic2"); + assertXPath(pXml, "/w:footnotes/w:footnote[4]/w:p/w:r[3]/w:t", 1); + assertXPathContent(pXml, "/w:footnotes/w:footnote[4]/w:p/w:r[3]/w:t", "Footnotes_grahic"); + + xmlDocUniquePtr pXml2 = parseExport("word/endnotes.xml"); + CPPUNIT_ASSERT(pXml); + // This was 0 (lost text content of the run with endnoteRef) + assertXPath(pXml2, "/w:endnotes/w:endnote[3]/w:p/w:r[3]/w:t", 1); + assertXPathContent(pXml2, "/w:endnotes/w:endnote[3]/w:p/w:r[3]/w:t[1]", "Endnotes"); +} + DECLARE_OOXMLEXPORT_TEST(testContSectBreakHeaderFooter, "cont-sect-break-header-footer.docx") { // Load a document with a continuous section break on page 2. -- cgit v1.2.3