summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-01-19 08:19:46 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-01-19 08:56:55 +0000
commit04d988d3c368fe07ae3c44c536a4513e424f104e (patch)
tree4803f8408a4b61a57a5bd45190a5d10844a12475 /sw/qa
parent17c68fad2aef917adfdd3d4d651da786e620699c (diff)
sw, .uno:InsertField: handle Endnote as a value for the Wrapper parameter
This is similar to commit 43d80906c8693ca27c5b3077fbaa259df4004924 (sw: .uno:TextFormField: handle Endnote as a value for the Wrapper parameter, 2023-01-17), but that was for fieldmarks & endnotes, this is for refmarks & endnotes. Change-Id: I46512dd973508f51f7093521c40ad4100dd39ae6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145762 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/uibase/shells/textfld.cxx29
1 files changed, 29 insertions, 0 deletions
diff --git a/sw/qa/uibase/shells/textfld.cxx b/sw/qa/uibase/shells/textfld.cxx
index ef4da3aa65b1..6f9fa0c1c2f6 100644
--- a/sw/qa/uibase/shells/textfld.cxx
+++ b/sw/qa/uibase/shells/textfld.cxx
@@ -58,4 +58,33 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertRefmarkFootnote)
CPPUNIT_ASSERT_EQUAL(OUString("content"), rFormatNote.GetFootnoteText(*pWrtShell->GetLayout()));
}
+CPPUNIT_TEST_FIXTURE(Test, testInsertRefmarkEndnote)
+{
+ // Given an empty document:
+ createSwDoc();
+
+ // When inserting a refmark inside an endnote:
+ uno::Sequence<css::beans::PropertyValue> aArgs = {
+ comphelper::makePropertyValue("TypeName", uno::Any(OUString("SetRef"))),
+ comphelper::makePropertyValue("Name", uno::Any(OUString("myref"))),
+ comphelper::makePropertyValue("Content", uno::Any(OUString("content"))),
+ comphelper::makePropertyValue("Wrapper", uno::Any(OUString("Endnote"))),
+ };
+ dispatchCommand(mxComponent, ".uno:InsertField", aArgs);
+
+ // Then make sure that the note body contains the refmark:
+ SwDoc* pDoc = getSwDoc();
+ SwFootnoteIdxs& rNotes = pDoc->GetFootnoteIdxs();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1
+ // - Actual : 0
+ // i.e. no endnote was inserted.
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rNotes.size());
+ SwTextFootnote* pNote = rNotes[0];
+ const SwFormatFootnote& rNote = pNote->GetFootnote();
+ CPPUNIT_ASSERT(rNote.IsEndNote());
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ CPPUNIT_ASSERT_EQUAL(OUString("content"), rNote.GetFootnoteText(*pWrtShell->GetLayout()));
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */