diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-20 00:16:00 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-20 00:29:14 -0500 |
commit | e50f17ace67dc7dc1680494567d74b4c76ce21d3 (patch) | |
tree | e3daa1fee1e25d5da6583b07782534677dc94427 /sc | |
parent | 2be2786879883badd6d0075e63965bacd312ed23 (diff) |
fdo#75228: Add test for this.
Change-Id: Ie89c9f80db0da7d1d0a4a5c06495715aaf555f4c
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 28 |
2 files changed, 30 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index c40469a35bf5..7ceabb4be1fb 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -119,6 +119,7 @@ public: void testFormulaRefUpdateNamedExpression(); void testMultipleOperations(); void testFuncCOLUMN(); + void testFuncCOUNT(); void testFuncROW(); void testFuncSUM(); void testFuncPRODUCT(); @@ -358,6 +359,7 @@ public: CPPUNIT_TEST(testFormulaRefUpdateNamedExpression); CPPUNIT_TEST(testMultipleOperations); CPPUNIT_TEST(testFuncCOLUMN); + CPPUNIT_TEST(testFuncCOUNT); CPPUNIT_TEST(testFuncROW); CPPUNIT_TEST(testFuncSUM); CPPUNIT_TEST(testFuncPRODUCT); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 02dfff22bdb0..35e63698d72f 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -1734,6 +1734,34 @@ void Test::testFuncCOLUMN() m_pDoc->DeleteTab(0); } +void Test::testFuncCOUNT() +{ + m_pDoc->InsertTab(0, "Formula"); + sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. + + m_pDoc->SetValue(ScAddress(0,0,0), 2); // A1 + m_pDoc->SetValue(ScAddress(0,1,0), 4); // A2 + m_pDoc->SetValue(ScAddress(0,2,0), 6); // A3 + + ScAddress aPos(1,0,0); + m_pDoc->SetString(aPos, "=COUNT(A1:A3)"); + CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(aPos)); + + aPos.IncRow(); + m_pDoc->SetString(aPos, "=COUNT(A1:A3;2)"); + CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(aPos)); + + aPos.IncRow(); + m_pDoc->SetString(aPos, "=COUNT(A1:A3;2;4)"); + CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(aPos)); + + aPos.IncRow(); + m_pDoc->SetString(aPos, "=COUNT(A1:A3;2;4;6)"); + CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(aPos)); + + m_pDoc->DeleteTab(0); +} + void Test::testFuncROW() { m_pDoc->InsertTab(0, "Formula"); |