sc/qa/unit/ucalc.hxx | 2 ++ sc/qa/unit/ucalc_formula.cxx | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+)
New commits: commit 6612a6f1ed561f98d5502704b90fb9a9800973e5 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Thu Jul 18 21:35:22 2013 -0400 Add test for resizing range references. To be expanded later. Change-Id: I886d190dd2533b89185dbc24d0b9043941618802 diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 440230c..09e3891 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -87,6 +87,7 @@ public: void testFormulaRefData(); void testFormulaCompiler(); void testFormulaRefUpdate(); + void testFormulaRefUpdateRange(); void testFuncSUM(); void testFuncPRODUCT(); void testFuncN(); @@ -274,6 +275,7 @@ public: CPPUNIT_TEST(testFormulaRefData); CPPUNIT_TEST(testFormulaCompiler); CPPUNIT_TEST(testFormulaRefUpdate); + CPPUNIT_TEST(testFormulaRefUpdateRange); CPPUNIT_TEST(testFuncSUM); CPPUNIT_TEST(testFuncPRODUCT); CPPUNIT_TEST(testFuncN); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index a57c6cf..a902cae 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -441,6 +441,44 @@ void Test::testFormulaRefUpdate() m_pDoc->DeleteTab(0); } +void Test::testFormulaRefUpdateRange() +{ + m_pDoc->InsertTab(0, "Formula"); + + sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. + + // Set values to B2:C5. + m_pDoc->SetValue(ScAddress(1,1,0), 1); + m_pDoc->SetValue(ScAddress(1,2,0), 2); + m_pDoc->SetValue(ScAddress(1,3,0), 3); + m_pDoc->SetValue(ScAddress(1,4,0), 4); + m_pDoc->SetValue(ScAddress(2,1,0), 5); + m_pDoc->SetValue(ScAddress(2,2,0), 6); + m_pDoc->SetValue(ScAddress(2,3,0), 7); + m_pDoc->SetValue(ScAddress(2,4,0), 8); + + // Set formula cells to A7 and A8. + m_pDoc->SetString(ScAddress(0,6,0), "=SUM(B2:C5)"); + m_pDoc->SetString(ScAddress(0,7,0), "=SUM($B$2:$C$5)"); + + if (!checkFormula(*m_pDoc, ScAddress(0,6,0), "SUM(B2:C5)")) + CPPUNIT_FAIL("Wrong formula in A7."); + + if (!checkFormula(*m_pDoc, ScAddress(0,7,0), "SUM($B$2:$C$5)")) + CPPUNIT_FAIL("Wrong formula in A8."); + + // Delete row 3. This should shrink the range references by one row. + m_pDoc->DeleteRow(ScRange(0,2,0,MAXCOL,2,0)); + + if (!checkFormula(*m_pDoc, ScAddress(0,5,0), "SUM(B2:C4)")) + CPPUNIT_FAIL("Wrong formula in A6."); + + if (!checkFormula(*m_pDoc, ScAddress(0,6,0), "SUM($B$2:$C$4)")) + CPPUNIT_FAIL("Wrong formula in A7."); + + m_pDoc->DeleteTab(0); +} + void Test::testFuncSUM() { OUString aTabName("foo"); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits