summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-11-25 10:55:43 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-11-25 12:44:17 +0100
commitfabed8f7b9a5e57cbb62e6570349c33f000c2291 (patch)
tree0fd0b6c18ab7e0c59cc1ccb314856163e70cd956 /sc
parent5274554148af5be90935df8ca3f2bb2751e95bfc (diff)
tdf#128914: sc_uicalc: Add unittest
Change-Id: I80d5a9c1ac9b05273f0237b966ad23a11a17a0c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125798 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/uicalc/data/tdf128914.odsbin0 -> 9123 bytes
-rw-r--r--sc/qa/unit/uicalc/uicalc.cxx40
2 files changed, 40 insertions, 0 deletions
diff --git a/sc/qa/unit/uicalc/data/tdf128914.ods b/sc/qa/unit/uicalc/data/tdf128914.ods
new file mode 100644
index 000000000000..7e9bdfd3de62
--- /dev/null
+++ b/sc/qa/unit/uicalc/data/tdf128914.ods
Binary files differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 72b1c6ea1c7b..beaf837bf1a4 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -922,6 +922,46 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf138710)
CPPUNIT_ASSERT_EQUAL(OUString("Total"), pDoc->GetString(ScAddress(0, 0, 1)));
}
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf128914)
+{
+ ScModelObj* pModelObj = createDoc("tdf128914.ods");
+ ScDocument* pDoc = pModelObj->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+
+ CPPUNIT_ASSERT_EQUAL(6.0, pDoc->GetValue(ScAddress(3, 1, 0)));
+
+ goToCell("D2");
+
+ dispatchCommand(mxComponent, ".uno:Copy", {});
+
+ goToCell("D3:D6");
+
+ dispatchCommand(mxComponent, ".uno:Paste", {});
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: 24
+ // - Actual : 6
+ CPPUNIT_ASSERT_EQUAL(24.0, pDoc->GetValue(ScAddress(3, 2, 0)));
+ CPPUNIT_ASSERT_EQUAL(60.0, pDoc->GetValue(ScAddress(3, 3, 0)));
+ CPPUNIT_ASSERT_EQUAL(120.0, pDoc->GetValue(ScAddress(3, 4, 0)));
+ CPPUNIT_ASSERT_EQUAL(210.0, pDoc->GetValue(ScAddress(3, 5, 0)));
+
+ CPPUNIT_ASSERT_EQUAL(6.0, pDoc->GetValue(ScAddress(1, 14, 0)));
+
+ goToCell("B15");
+
+ dispatchCommand(mxComponent, ".uno:Copy", {});
+
+ goToCell("C15:F15");
+
+ dispatchCommand(mxComponent, ".uno:Paste", {});
+
+ CPPUNIT_ASSERT_EQUAL(24.0, pDoc->GetValue(ScAddress(2, 14, 0)));
+ CPPUNIT_ASSERT_EQUAL(60.0, pDoc->GetValue(ScAddress(3, 14, 0)));
+ CPPUNIT_ASSERT_EQUAL(120.0, pDoc->GetValue(ScAddress(4, 14, 0)));
+ CPPUNIT_ASSERT_EQUAL(210.0, pDoc->GetValue(ScAddress(5, 14, 0)));
+}
+
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf108654)
{
ScModelObj* pModelObj = createDoc("tdf108654.ods");