summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-03-03 13:31:19 +0100
committerEike Rathke <erack@redhat.com>2016-03-03 13:33:08 +0100
commit6e7e8af8ed2ee873a5c8a8b7b42fe3b99797be90 (patch)
tree7456f89a4eee77a607252413c0c4cb9909f5c95d
parent337f517af60d25351bc89f3814dcaf48f3aaa5b6 (diff)
unit test for tdf#98297, exclude/include error values with COUNT/COUNTA
Change-Id: I2cc7d6ebdcb9411060462d7afa704f9e100c6c5e
-rw-r--r--sc/qa/unit/ucalc_formula.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index ad40ccc8d6f5..63aa7d93eff3 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -3383,6 +3383,18 @@ void Test::testFuncCOUNT()
m_pDoc->SetString(aPos, "=COUNT(A1:A3;2;4;6)");
CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(aPos));
+ // Matrix in C1.
+ ScMarkData aMark;
+ aMark.SelectOneTable(0);
+ m_pDoc->InsertMatrixFormula(2, 0, 2, 0, aMark, "=COUNT(SEARCH(\"a\";{\"a\";\"b\";\"a\"}))");
+ // Check that the #VALUE! error of "a" not found in "b" is not counted.
+ CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(2,0,0)));
+
+ // Matrix in C3.
+ m_pDoc->InsertMatrixFormula(2, 2, 2, 2, aMark, "=COUNTA(SEARCH(\"a\";{\"a\";\"b\";\"a\"}))");
+ // Check that the #VALUE! error of "a" not found in "b" is counted.
+ CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(2,2,0)));
+
m_pDoc->DeleteTab(0);
}