summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-07-23 22:29:48 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-07-24 23:29:40 -0400
commit13941df2e7dfdcdcaeeb04b2b2f0967a51f9c3e9 (patch)
tree0ce6823a57fe6fbd4d57391f45c996390d6affda /sc/qa
parentcdc9c6d5780f199418cbed8045790846f0c32521 (diff)
Add test for moving the formula cells that reference stationary range.
Change-Id: I6f996e4c8535371c57c9d43012baa6118160f834
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc_formula.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 69b0374aa275..ebf74e74a16f 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -884,6 +884,29 @@ void Test::testFormulaRefUpdateMove()
if (!checkFormula(*m_pDoc, ScAddress(0,11,0), "$D$6"))
CPPUNIT_FAIL("Wrong formula.");
+ // Move A9:A12 to B10:B13.
+ bMoved = rFunc.MoveBlock(ScRange(0,8,0,0,11,0), ScAddress(1,9,0), true, false, false, false);
+ CPPUNIT_ASSERT_MESSAGE("Failed to move A9:A12 to B10:B13", bMoved);
+
+ // The results of these formula cells should still stay the same.
+ CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(1,9,0));
+ CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(1,10,0));
+ CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(1,11,0));
+ CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(1,12,0));
+
+ // Displayed formulas should stay the same since the referenced range hasn't moved.
+ if (!checkFormula(*m_pDoc, ScAddress(1,9,0), "SUM(D4:D6)"))
+ CPPUNIT_FAIL("Wrong formula.");
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,10,0), "SUM($D$4:$D$6)"))
+ CPPUNIT_FAIL("Wrong formula.");
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,11,0), "D5"))
+ CPPUNIT_FAIL("Wrong formula.");
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,12,0), "$D$6"))
+ CPPUNIT_FAIL("Wrong formula.");
+
m_pDoc->DeleteTab(0);
}