summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ooxmlexport
diff options
context:
space:
mode:
authorAdam Seskunas <adamseskunas@gmail.com>2024-08-14 11:52:45 -0700
committerXisco Fauli <xiscofauli@libreoffice.org>2024-08-27 08:58:42 +0200
commit03b31a8ad48e3b8a9e54203ff3856702557757b5 (patch)
treedc07e24f55cb11402e5fa113948c40ad452f99dd /sw/qa/extras/ooxmlexport
parentc387604cc58f3214f4fda9d9c32969115bda7b2e (diff)
tdf#128460 Add Unit Test
Change-Id: Ia83b87db09256aedf8f6e8c04986d4476099b4aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171877 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/extras/ooxmlexport')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf128460.odtbin0 -> 9818 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport21.cxx29
2 files changed, 29 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf128460.odt b/sw/qa/extras/ooxmlexport/data/tdf128460.odt
new file mode 100644
index 000000000000..9d55b6c68c9c
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf128460.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 32892540e734..ce7e68bf3341 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -17,6 +17,7 @@
#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/text/XDocumentIndex.hpp>
#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XTextField.hpp>
#include <com/sun/star/style/LineSpacing.hpp>
#include <com/sun/star/style/LineSpacingMode.hpp>
@@ -1097,6 +1098,34 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf162370)
loadAndSave("too_many_styles.odt");
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf128460)
+{
+ auto verify = [this]() {
+ uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xFieldsAccess(
+ xTextFieldsSupplier->getTextFields());
+ uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
+ uno::Reference<text::XTextField> xField(xFields->nextElement(), uno::UNO_QUERY);
+
+ CPPUNIT_ASSERT_EQUAL(u""_ustr, xField->getPresentation(false));
+ CPPUNIT_ASSERT_EQUAL(u"Input field"_ustr, xField->getPresentation(true));
+
+ xField.set(xFields->nextElement(), uno::UNO_QUERY);
+
+ CPPUNIT_ASSERT_EQUAL(u"text"_ustr, xField->getPresentation(false));
+ CPPUNIT_ASSERT_EQUAL(u"Input field"_ustr, xField->getPresentation(true));
+ };
+ createSwDoc("tdf128460.odt");
+ verify();
+
+ saveAndReload(u"Office Open XML Text"_ustr);
+ // Without the fix in place, the third ASSERT fails with
+ // Expected: text
+ // Actual:
+ // i.e. The second Field is blank when it should have the content of `text`
+ verify();
+}
+
} // end of anonymous namespace
CPPUNIT_PLUGIN_IMPLEMENT();