summaryrefslogtreecommitdiffstats
path: root/sw/qa/extras/odfexport/odfexport2.cxx
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 05:03:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 05:09:28 +0000
commit97ac77f067910fa5e8206d75160fa63546a9358d (patch)
treee6fa64b43e8150ef65578afa4f1f40f3e19f7fa3 /sw/qa/extras/odfexport/odfexport2.cxx
parentReleasing progress-linux version 4:24.2.2-3~progress7.99u1. (diff)
downloadlibreoffice-97ac77f067910fa5e8206d75160fa63546a9358d.tar.xz
libreoffice-97ac77f067910fa5e8206d75160fa63546a9358d.zip
Merging upstream version 4:24.2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/qa/extras/odfexport/odfexport2.cxx')
-rw-r--r--sw/qa/extras/odfexport/odfexport2.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx
index 4983608290..f654821acf 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/text/XDocumentIndex.hpp>
#include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
#include <com/sun/star/text/XTextColumns.hpp>
+#include <com/sun/star/text/XTextField.hpp>
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
#include <com/sun/star/text/XTextTable.hpp>
#include <com/sun/star/text/XTextTablesSupplier.hpp>
@@ -1343,6 +1344,35 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159438)
u"bookmark3"_ustr);
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf160700)
+{
+ // Given a document with an empty numbered paragraph, and a cross-reference to it
+ loadAndReload("tdf160700.odt");
+
+ // Refresh fields and ensure cross-reference to numbered para is okay
+ auto xTextFieldsSupplier(mxComponent.queryThrow<text::XTextFieldsSupplier>());
+ auto xFieldsAccess(xTextFieldsSupplier->getTextFields());
+
+ xFieldsAccess.queryThrow<util::XRefreshable>()->refresh();
+
+ auto xFields(xFieldsAccess->createEnumeration());
+ CPPUNIT_ASSERT(xFields->hasMoreElements());
+ auto xTextField(xFields->nextElement().queryThrow<text::XTextField>());
+ // Save must not create markup with text:bookmark-end element before text:bookmark-start
+ // Withoud the fix, this would fail with
+ // - Expected: 1
+ // - Actual : Error: Reference source not found
+ // i.e., the bookmark wasn't imported, and the field had no proper source
+ CPPUNIT_ASSERT_EQUAL(u"1"_ustr, xTextField->getPresentation(false));
+
+ xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
+ // Check that we export the bookmark in the empty paragraph as a single text:bookmark
+ // element. Another walid markup is text:bookmark-start followed by text:bookmark-end
+ // (in that order). The problem was, that text:bookmark-end was before text:bookmark-start.
+ assertXPathChildren(pXmlDoc, "//office:text/text:list/text:list-item/text:p"_ostr, 1);
+ assertXPath(pXmlDoc, "//office:text/text:list/text:list-item/text:p/text:bookmark"_ostr);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */