summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-04-29 13:31:55 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-04-29 13:32:46 -0400
commit1e5b495a882493a81cc82ee34e3339b071bc162d (patch)
tree4a0b1363b5aa84e630dbc89aeeee4d8287f62a99
parentab67b79c7469cea7de82b6eb6ca1f690063c069c (diff)
fdo#76912: Write a test for this.
Change-Id: I3b14447130c32d4b21010380f7901c0d20004ffc
-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 ae65185eee11..efe73a0f3e61 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -1511,6 +1511,29 @@ void Test::testFormulaRefUpdateInsertRows()
if (!checkFormula(*m_pDoc, ScAddress(1,6,0), "SUM(B4:B6)"))
CPPUNIT_FAIL("Wrong formula!");
+ // Clear and start over.
+ clearSheet(m_pDoc, 0);
+
+ // Set raw values in A4:A6.
+ m_pDoc->SetValue(ScAddress(0,3,0), 1.0);
+ m_pDoc->SetValue(ScAddress(0,4,0), 2.0);
+ m_pDoc->SetValue(ScAddress(0,5,0), 3.0);
+
+ // Set formula in A3 to reference A4:A6.
+ m_pDoc->SetString(ScAddress(0,2,0), "=MAX(A4:A6)");
+
+ CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0,2,0)));
+
+ // Insert 3 rows over 2:4. This should push A3:A6 to A6:A9.
+ rFunc.InsertCells(ScRange(0,1,0,MAXCOL,3,0), &aMark, INS_INSROWS, false, true, false);
+ ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(0,5,0));
+ CPPUNIT_ASSERT(pFC);
+ CPPUNIT_ASSERT_MESSAGE("This formula cell should not be an error.", pFC->GetErrCode() == 0);
+ CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0,5,0)));
+
+ if (!checkFormula(*m_pDoc, ScAddress(0,5,0), "MAX(A7:A9)"))
+ CPPUNIT_FAIL("Wrong formula!");
+
m_pDoc->DeleteTab(0);
}