sc/qa/unit/uicalc/data/tdf128914.ods |binary
 sc/qa/unit/uicalc/uicalc.cxx         |   40 +++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

New commits:
commit fabed8f7b9a5e57cbb62e6570349c33f000c2291
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Nov 25 10:55:43 2021 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Nov 25 12:44:17 2021 +0100

    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 <xiscofa...@libreoffice.org>

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
Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf128914.ods 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");

Reply via email to