summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-11-22 13:42:06 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-11-22 16:49:36 +0100
commitfc3993c6794e2749400755ecd032165a61d5d959 (patch)
treee2b37e78d70c1ac273c1eb939bff842a7fdc391c /sc
parent937cb97e66b61fa1b9d7f667925f8acae6293922 (diff)
tdf#152014: sc_uicalc: Add unittest
Change-Id: I7be721d9409890fe1f26125f06561e85cb1ddb27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143113 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/uicalc/uicalc.cxx34
1 files changed, 34 insertions, 0 deletions
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 518a219e3a92..4976c19c17f0 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -2903,6 +2903,40 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf149378)
CPPUNIT_ASSERT_EQUAL(OUString("{=ABS({-1;-2})}"), pDoc->GetFormula(8, 0, 0));
}
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf152014)
+{
+ createScDoc();
+
+ insertStringToCell("A1", u"=MATCH(1,A2,0)");
+ insertStringToCell("A2", u"1");
+
+ ScDocument* pDoc = getScDoc();
+ CPPUNIT_ASSERT_EQUAL(OUString("1"), pDoc->GetString(ScAddress(0, 0, 0)));
+
+ goToCell("A1");
+
+ dispatchCommand(mxComponent, ".uno:Copy", {});
+ Scheduler::ProcessEventsToIdle();
+
+ // Create a second document
+ mxComponent2 = loadFromDesktop("private:factory/scalc");
+
+ uno::Reference<frame::XFrames> xFrames = mxDesktop->getFrames();
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xFrames->getCount());
+
+ dispatchCommand(mxComponent2, ".uno:Paste", {});
+ Scheduler::ProcessEventsToIdle();
+
+ ScModelObj* pModelObj2 = dynamic_cast<ScModelObj*>(mxComponent2.get());
+ CPPUNIT_ASSERT(pModelObj2);
+ ScDocument* pDoc2 = pModelObj2->GetDocument();
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: #N/A
+ // - Actual : 1
+ CPPUNIT_ASSERT_EQUAL(OUString("#N/A"), pDoc2->GetString(ScAddress(0, 0, 0)));
+}
+
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126926)
{
createScDoc();