diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-12-14 13:02:16 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-12-14 16:48:42 +0100 |
commit | dcd46a0ff9e3e78fc53ce21e7adf314f6e4a033b (patch) | |
tree | a3079ac8f01d56c663e3a96cceeabaa50c779b4d | |
parent | 2486eaf671f38ada76c500116ee061e9d8240f4d (diff) |
tdf#158551: sc_uicalc: Add unittest
Change-Id: I66d62651a8f8295265e4bfbfc5395e0f400d726b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160769
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
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(); |