diff options
author | Deena Francis <deena.francis@gmail.com> | 2019-12-13 19:49:36 +0530 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-12-16 08:09:01 +0100 |
commit | 1ca0986bcc82e9fcfad055617359b619af53c794 (patch) | |
tree | 24fa835391ad66a63e096d664f07a30efcc8cf4b /sc/qa | |
parent | 8de197a982f6b588ee65ab5e2f4bdb879e73e51f (diff) |
tdf#120948: row deltas should be stored as SCROW...
instead of SCCOL, else it may cause overflows.
Also included a unit test for protecting the fix.
Change-Id: I8f735b23b7f95ecf34ccae86f00c76b82b0d668f
Reviewed-on: https://gerrit.libreoffice.org/85118
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit 3b8e554b69de349a20d10ec90b27ab71a013b464)
Reviewed-on: https://gerrit.libreoffice.org/85180
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index d5b0bdf7ab28..777dc4a51389 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -562,6 +562,7 @@ public: void testProtectedSheetEditByColumn(); void testFuncRowsHidden(); void testInsertColCellStoreEventSwap(); + void testFormulaAfterDeleteRows(); CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testCollator); @@ -862,6 +863,7 @@ public: CPPUNIT_TEST(testProtectedSheetEditByColumn); CPPUNIT_TEST(testFuncRowsHidden); CPPUNIT_TEST(testInsertColCellStoreEventSwap); + CPPUNIT_TEST(testFormulaAfterDeleteRows); CPPUNIT_TEST_SUITE_END(); private: diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 6bbe59d067ea..c7de928a3de9 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -8992,4 +8992,24 @@ void Test::testInsertColCellStoreEventSwap() m_pDoc->DeleteTab(0); } +void Test::testFormulaAfterDeleteRows() +{ + sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. + m_pDoc->InsertTab(0, "Test"); + + // Fill A1:A70000 with 1.0 + std::vector<double> aVals(70000, 1.0); + m_pDoc->SetValues(ScAddress(0, 0, 0), aVals); + // Set A70001 with formula "=SUM(A1:A70000)" + m_pDoc->SetString(0, 70000, 0, "=SUM(A1:A70000)"); + + // Delete rows 2:69998 + m_pDoc->DeleteRow(ScRange(0, 1, 0, m_pDoc->MaxCol(), 69997, 0)); + + const ScAddress aPos(0, 3, 0); // A4 + ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM(A1:A3)", "Wrong formula in A4."); + + ASSERT_DOUBLES_EQUAL_MESSAGE("Wrong value at A4", 3.0, m_pDoc->GetValue(aPos)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |