Add test for cell function COLUMN.

This currently fails.

Change-Id: I6a73bc5a3e966542f4dcc88fc644110ec164dcb3
This commit is contained in:
Kohei Yoshida
2013-07-22 20:51:06 -04:00
parent 3911a42566
commit a5890efca5
2 changed files with 23 additions and 0 deletions

View File

@@ -89,6 +89,7 @@ public:
void testFormulaRefUpdate();
void testFormulaRefUpdateRange();
void testFormulaRefUpdateSheets();
void testFuncCOLUMN();
void testFuncSUM();
void testFuncPRODUCT();
void testFuncN();
@@ -278,6 +279,7 @@ public:
CPPUNIT_TEST(testFormulaRefUpdate);
CPPUNIT_TEST(testFormulaRefUpdateRange);
CPPUNIT_TEST(testFormulaRefUpdateSheets);
CPPUNIT_TEST(testFuncCOLUMN);
CPPUNIT_TEST(testFuncSUM);
CPPUNIT_TEST(testFuncPRODUCT);
CPPUNIT_TEST(testFuncN);

View File

@@ -817,6 +817,27 @@ void Test::testFormulaRefUpdateSheets()
m_pDoc->DeleteTab(0);
}
void Test::testFuncCOLUMN()
{
m_pDoc->InsertTab(0, "Formula");
sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
m_pDoc->SetString(ScAddress(5,10,0), "=COLUMN()");
CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(5,10,0)));
m_pDoc->SetString(ScAddress(0,1,0), "=F11");
CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(0,1,0)));
// Move the formula cell with COLUMN() function to change its value.
m_pDoc->InsertCol(ScRange(5,0,0,5,MAXROW,0));
CPPUNIT_ASSERT_EQUAL(7.0, m_pDoc->GetValue(ScAddress(6,10,0)));
// 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)));
m_pDoc->DeleteTab(0);
}
void Test::testFuncSUM()
{
OUString aTabName("foo");