[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Wed Feb 19 21:28:48 PST 2014
sc/qa/unit/ucalc.hxx | 2 ++
sc/qa/unit/ucalc_formula.cxx | 28 ++++++++++++++++++++++++++++
sc/source/core/tool/interpr6.cxx | 1 +
3 files changed, 31 insertions(+)
New commits:
commit 9e183fbfdbfbe364d17f9d36a0b33d2fae89862d
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Feb 20 00:28:06 2014 -0500
fdo#75228: We still need to get the value only to pop value from the stack.
Change-Id: Iad231aa97ed35f91b96cddf8157ebcd9af0f8ec9
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index f404561..a32b3c1 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -891,6 +891,7 @@ void ScInterpreter::ScCount()
}
break;
case svDouble :
+ GetDouble();
nCount++;
nFuncFmtType = NUMBERFORMAT_NUMBER;
break;
commit e50f17ace67dc7dc1680494567d74b4c76ce21d3
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Feb 20 00:16:00 2014 -0500
fdo#75228: Add test for this.
Change-Id: Ie89c9f80db0da7d1d0a4a5c06495715aaf555f4c
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index c40469a..7ceabb4 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 02dfff2..35e6369 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");
More information about the Libreoffice-commits
mailing list