summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-07-18 20:51:28 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-07-24 23:29:30 -0400
commit3d7976b1ad31e682d51d3da6f3e89ca80a42a6a7 (patch)
tree34009ffc66bf604bad75f45401c1e95cda6adcdb /sc
parent673ea63df55dae16f2bb2b4e2f1fdad47f15c53c (diff)
Add test for no reference error on reference deletion.
Change-Id: I3e6fd2b41c3bbf0ee12769a507fbf484f9ba833b
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/ucalc_formula.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index e04c7416fcc4..a57c6cfaf420 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -306,9 +306,25 @@ void Test::testFormulaRefUpdate()
if (!checkFormula(*m_pDoc, aPos, "$A$1"))
CPPUNIT_FAIL("Wrong formula in C4.");
+ // Delete row 1 which will delete the value cell (A1).
+ m_pDoc->DeleteRow(ScRange(0,0,0,MAXCOL,0,0));
+
+ aPos = ScAddress(2,1,0);
+ ScFormulaCell* pFC = m_pDoc->GetFormulaCell(aPos);
+ CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC);
+ CPPUNIT_ASSERT_EQUAL(ScErrorCodes::errNoRef, pFC->GetErrCode());
+ aPos = ScAddress(2,2,0);
+ pFC = m_pDoc->GetFormulaCell(aPos);
+ CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC);
+ CPPUNIT_ASSERT_EQUAL(ScErrorCodes::errNoRef, pFC->GetErrCode());
+
// Clear all and start over.
clearRange(m_pDoc, ScRange(0,0,0,10,10,0));
+ // ------------------------------------------
+ // Test range updates
+ // ------------------------------------------
+
// Fill B2:C3 with values.
m_pDoc->SetValue(ScAddress(1,1,0), 1);
m_pDoc->SetValue(ScAddress(1,2,0), 2);
@@ -410,6 +426,18 @@ void Test::testFormulaRefUpdate()
CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(0,5,0)));
CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(0,6,0)));
+ // Delete rows 2:3 to completely remove the referenced range.
+ m_pDoc->DeleteRow(ScRange(0,1,0,MAXCOL,2,0));
+
+ // Both A4 and A5 should show #REF! errors.
+ pFC = m_pDoc->GetFormulaCell(ScAddress(0,3,0));
+ CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC);
+ CPPUNIT_ASSERT_EQUAL(ScErrorCodes::errNoRef, pFC->GetErrCode());
+
+ pFC = m_pDoc->GetFormulaCell(ScAddress(0,4,0));
+ CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC);
+ CPPUNIT_ASSERT_EQUAL(ScErrorCodes::errNoRef, pFC->GetErrCode());
+
m_pDoc->DeleteTab(0);
}