diff options
author | Eike Rathke <erack@redhat.com> | 2016-11-02 16:15:36 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-11-02 16:16:15 +0100 |
commit | 01875c4514c777a43ee18014d9b0cb3f34eebbba (patch) | |
tree | 05288765eee82ebfac62d31fe26d1d0b7dbfd8bd /sc/qa | |
parent | disable gbuildtoide test on Windows as CI builders are unstable (diff) | |
download | core-01875c4514c777a43ee18014d9b0cb3f34eebbba.tar.gz core-01875c4514c777a43ee18014d9b0cb3f34eebbba.zip |
unit test for tdf#99291, empty array elements match 0.0, not empty
Change-Id: I65cac442583ecd90831ebea01d2be6c0b1e60b9a
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 2780d083c45f..b572c54024c9 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -3924,6 +3924,30 @@ void Test::testFuncCOUNTIF() // We should correctly count with empty string key. CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(0,4,0))); + // Another test case adopted from tdf#99291, empty array elements should + // not match empty cells, but cells with 0. + clearSheet(m_pDoc, 0); + ScMarkData aMark; + aMark.SelectOneTable(0); + m_pDoc->InsertMatrixFormula(0,0, 0,1, aMark, "=COUNTIF(B1:B5;C1:C2)"); + // As we will be testing for 0.0 values, check that formulas are actually present. + OUString aFormula; + m_pDoc->GetFormula(0,0,0, aFormula); + CPPUNIT_ASSERT_EQUAL(OUString("{=COUNTIF(B1:B5;C1:C2)}"), aFormula); + m_pDoc->GetFormula(0,1,0, aFormula); + CPPUNIT_ASSERT_EQUAL(OUString("{=COUNTIF(B1:B5;C1:C2)}"), aFormula); + // The 0.0 results expected. + CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc->GetValue(ScAddress(0,0,0))); + CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc->GetValue(ScAddress(0,1,0))); + // 0.0 in B2, 1.0 in B3 and B4 + m_pDoc->SetValue( ScAddress(1,1,0), 0.0); + m_pDoc->SetValue( ScAddress(1,2,0), 1.0); + m_pDoc->SetValue( ScAddress(1,3,0), 1.0); + // Matched by 0.0 produced by empty cell in array, and 1.0 in C2. + m_pDoc->SetValue( ScAddress(2,1,0), 1.0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("One cell with 0.0", 1.0, m_pDoc->GetValue(ScAddress(0,0,0))); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Two cells with 1.0", 2.0, m_pDoc->GetValue(ScAddress(0,1,0))); + m_pDoc->DeleteTab(0); } |