diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-07-23 16:48:56 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-07-24 23:29:39 -0400 |
commit | 37e80db5104db83dc2e52bb85d9353987701e8d1 (patch) | |
tree | 7ee73b6e6f278c67a70f8aa754df1da4c79f77de /sc | |
parent | ab24a2c25900948bb71acbedbdecd84bda3217f7 (diff) |
Add test for ROW function.
Change-Id: Ie918d3b9d635febe40ac974a37da0743830b65eb
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 37 |
2 files changed, 39 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 71a3268ddcac..ac17bd9b4801 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -90,6 +90,7 @@ public: void testFormulaRefUpdateRange(); void testFormulaRefUpdateSheets(); void testFuncCOLUMN(); + void testFuncROW(); void testFuncSUM(); void testFuncPRODUCT(); void testFuncN(); @@ -280,6 +281,7 @@ public: CPPUNIT_TEST(testFormulaRefUpdateRange); CPPUNIT_TEST(testFormulaRefUpdateSheets); CPPUNIT_TEST(testFuncCOLUMN); + CPPUNIT_TEST(testFuncROW); 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 0aee2eb01016..c651b6d34cd1 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -855,6 +855,43 @@ void Test::testFuncCOLUMN() // The cell that references the moved cell should update its value as well. CPPUNIT_ASSERT_EQUAL(7.0, m_pDoc->GetValue(ScAddress(0,1,0))); + // Move the column in the other direction. + m_pDoc->DeleteCol(ScRange(5,0,0,5,MAXROW,0)); + + CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(5,10,0))); + + // The cell that references the moved cell should update its value as well. + CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(0,1,0))); + + m_pDoc->DeleteTab(0); +} + +void Test::testFuncROW() +{ + m_pDoc->InsertTab(0, "Formula"); + sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. + + m_pDoc->SetString(ScAddress(5,10,0), "=ROW()"); + CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(ScAddress(5,10,0))); + + m_pDoc->SetString(ScAddress(0,1,0), "=F11"); + CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(ScAddress(0,1,0))); + + // Insert 2 new rows at row 4. + m_pDoc->InsertRow(ScRange(0,3,0,MAXCOL,4,0)); + CPPUNIT_ASSERT_EQUAL(13.0, m_pDoc->GetValue(ScAddress(5,12,0))); + + // The cell that references the moved cell should update its value as well. + CPPUNIT_ASSERT_EQUAL(13.0, m_pDoc->GetValue(ScAddress(0,1,0))); + + // Delete 2 rows to move it back. + m_pDoc->DeleteRow(ScRange(0,3,0,MAXCOL,4,0)); + + CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(ScAddress(5,10,0))); + + // 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))); + m_pDoc->DeleteTab(0); } |