summaryrefslogtreecommitdiff
path: root/sw/qa/extras/odfexport/odfexport.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/extras/odfexport/odfexport.cxx')
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 80c008e18c18..128689182b0b 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -25,6 +25,7 @@
#include <officecfg/Office/Common.hxx>
#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
+#include <com/sun/star/text/XTextField.hpp>
#include <comphelper/storagehelper.hxx>
#include <comphelper/fileformat.h>
@@ -409,6 +410,35 @@ DECLARE_ODFEXPORT_TEST(testTextframeGradient, "textframe-gradient.odt")
CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_AXIAL, aGradient.Style);
}
+DECLARE_ODFEXPORT_TEST(testDuplicateCrossRefHeadingBookmark, "CrossRefHeadingBookmark.fodt")
+{
+ // the file contains invalid duplicate heading cross reference bookmarks
+ // but we have to round trip them, tdf#94804
+
+ uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent,
+ uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xBookmarks(
+ xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
+ uno::Reference<text::XTextContent> xBookmark1(
+ xBookmarks->getByName("__RefHeading__8284_1826734303"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xBookmark1.is());
+ uno::Reference<text::XTextContent> xBookmark2(
+ xBookmarks->getByName("__RefHeading__1673_25705824"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xBookmark2.is());
+
+ uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<util::XRefreshable>(xTextFieldsSupplier->getTextFields(), uno::UNO_QUERY)->refresh();
+
+ uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
+ uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
+ uno::Any aField1 = xFields->nextElement();
+ uno::Reference<text::XTextField> xField1(aField1, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("1.1"), xField1->getPresentation(false));
+ uno::Any aField2 = xFields->nextElement();
+ uno::Reference<text::XTextField> xField2(aField2, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("1.1"), xField2->getPresentation(false));
+}
+
DECLARE_ODFEXPORT_TEST(testFdo60769, "fdo60769.odt")
{
// Test multi-paragraph comment range feature.