summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/uibase/shells/shells.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx
index 55b388860adc..c107913e6469 100644
--- a/sw/qa/uibase/shells/shells.cxx
+++ b/sw/qa/uibase/shells/shells.cxx
@@ -25,6 +25,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/propertyvalue.hxx>
#include <unotools/ucbstreamhelper.hxx>
+#include <xmloff/odffields.hxx>
#include <IDocumentContentOperations.hxx>
#include <cmdid.h>
@@ -269,6 +270,32 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testContentControlPageBreak)
CPPUNIT_ASSERT_EQUAL(1, getPages());
}
+CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testInsertTextFormField)
+{
+ // Given an empty document:
+ createSwDoc();
+ SwDoc* pDoc = getSwDoc();
+
+ // When inserting an ODF_UNHANDLED fieldmark:
+ uno::Sequence<css::beans::PropertyValue> aArgs = {
+ comphelper::makePropertyValue("FieldType", uno::Any(OUString(ODF_UNHANDLED))),
+ };
+ dispatchCommand(mxComponent, ".uno:TextFormField", aArgs);
+
+ // Then make sure that it's type/name is correct:
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ SwCursor* pCursor = pWrtShell->GetCursor();
+ pCursor->SttEndDoc(/*bSttDoc=*/true);
+ sw::mark::IFieldmark* pFieldmark
+ = pDoc->getIDocumentMarkAccess()->getFieldmarkAt(*pCursor->GetPoint());
+ CPPUNIT_ASSERT(pFieldmark);
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: vnd.oasis.opendocument.field.UNHANDLED
+ // - Actual : vnd.oasis.opendocument.field.FORMTEXT
+ // i.e. the custom type parameter was ignored.
+ CPPUNIT_ASSERT_EQUAL(OUString(ODF_UNHANDLED), pFieldmark->GetFieldname());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */