summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-10-12 10:19:49 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-10-12 10:21:06 -0400
commit352958b7c6bbfeb8352570b28487cc1713f5a850 (patch)
tree7aad616b137f1f0352965be1b6915d0a8f99747d /sc
parent0b29a16d1dcffd75e49bd7ad3da867b0d0ebfa38 (diff)
fdo#83901: Write a test for this.
Change-Id: If805ba07baa36cbf94ee22f77f98ef4057d8b306
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/ucalc_formula.cxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index d4344e27e35f..45112d111141 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -2541,6 +2541,38 @@ void Test::testFuncROW()
// The cell that references the moved cell should update its value as well.
CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(ScAddress(0,1,0)));
+ // Clear sheet and start over.
+ clearSheet(m_pDoc, 0);
+
+ m_pDoc->SetString(ScAddress(0,1,0), "=ROW(A5)");
+ m_pDoc->SetString(ScAddress(1,1,0), "=ROW(B5)");
+ m_pDoc->SetString(ScAddress(1,2,0), "=ROW(B6)");
+ CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(0,1,0)));
+ CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(1,1,0)));
+ CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(1,2,0)));
+
+ // B2:B3 should be shared.
+ const ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(1,1,0));
+ CPPUNIT_ASSERT(pFC);
+ CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow());
+ CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength());
+
+ // Insert a new row at row 4.
+ ScDocFunc& rFunc = getDocShell().GetDocFunc();
+ ScMarkData aMark;
+ aMark.SelectOneTable(0);
+ rFunc.InsertCells(ScRange(0,3,0,MAXCOL,3,0), &aMark, INS_INSROWS, false, true, false);
+ if (!checkFormula(*m_pDoc, ScAddress(0,1,0), "ROW(A6)"))
+ CPPUNIT_FAIL("Wrong formula!");
+ if (!checkFormula(*m_pDoc, ScAddress(1,1,0), "ROW(B6)"))
+ CPPUNIT_FAIL("Wrong formula!");
+ if (!checkFormula(*m_pDoc, ScAddress(1,2,0), "ROW(B7)"))
+ CPPUNIT_FAIL("Wrong formula!");
+
+ CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(0,1,0)));
+ CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(1,1,0)));
+ CPPUNIT_ASSERT_EQUAL(7.0, m_pDoc->GetValue(ScAddress(1,2,0)));
+
m_pDoc->DeleteTab(0);
}