sc/qa/unit/uicalc/uicalc.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
New commits: commit dcd46a0ff9e3e78fc53ce21e7adf314f6e4a033b Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Dec 14 13:02:16 2023 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Dec 14 16:48:42 2023 +0100 tdf#158551: sc_uicalc: Add unittest Change-Id: I66d62651a8f8295265e4bfbfc5395e0f400d726b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160769 Tested-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 15795baceaa1..930ad6ee7dcb 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -2078,6 +2078,31 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf141440) CPPUNIT_ASSERT_EQUAL(OUString("Note in A1"), pDoc->GetNote(ScAddress(0, 0, 0))->GetText()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf158551) +{ + createScDoc(); + ScDocument* pDoc = getScDoc(); + + insertStringToCell("A1", u"10"); + + // Copy content of A1 to B1 using Formula Add + goToCell("A1"); + dispatchCommand(mxComponent, ".uno:Copy", {}); + goToCell("B1"); + uno::Sequence<beans::PropertyValue> aArgs = comphelper::InitPropertySequence( + { { "Flags", uno::Any(OUString("SVD")) }, + { "FormulaCommand", uno::Any(sal_uInt16(ScPasteFunc::ADD)) }, + { "SkipEmptyCells", uno::Any(false) }, + { "Transpose", uno::Any(false) }, + { "AsLink", uno::Any(false) }, + { "MoveMode", uno::Any(sal_uInt16(InsCellCmd::INS_NONE)) } }); + + // Without the fix in place, this test would have crashed here + dispatchCommand(mxComponent, ".uno:InsertContents", aArgs); + + CPPUNIT_ASSERT_EQUAL(OUString("10"), pDoc->GetString(ScAddress(1, 0, 0))); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testKeyboardMergeRef) { createScDoc();