diff options
author | Eike Rathke <erack@redhat.com> | 2018-03-05 22:50:07 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-03-05 22:53:39 +0100 |
commit | ba490001c2d82c1172854ca16d7099b19e29cb60 (patch) | |
tree | fd319bc35d514ec95c6636ea67ec0af56bda4bc4 /sc | |
parent | a2a15163a6a381957f2cb2ed6fe659577ebde558 (diff) |
Unit test for tdf#116216
Change-Id: Icd2e37c279db43b792e84b3aae64c16db0c4834b
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 19 |
2 files changed, 21 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 630e9b09b0a0..6718e10a4248 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -186,6 +186,7 @@ public: void testFuncNUMBERVALUE(); void testFuncLEN(); void testFuncLOOKUP(); + void testFuncLOOKUParrayWithError(); void testFuncVLOOKUP(); void testFuncMATCH(); void testFuncCELL(); @@ -607,6 +608,7 @@ public: CPPUNIT_TEST(testFuncNUMBERVALUE); CPPUNIT_TEST(testFuncLEN); CPPUNIT_TEST(testFuncLOOKUP); + CPPUNIT_TEST(testFuncLOOKUParrayWithError); CPPUNIT_TEST(testFuncVLOOKUP); CPPUNIT_TEST(testFuncMATCH); CPPUNIT_TEST(testFuncCELL); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index a67ef5063dcd..639dac3527db 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -4773,6 +4773,25 @@ void Test::testFuncLOOKUP() m_pDoc->DeleteTab(0); } +void Test::testFuncLOOKUParrayWithError() +{ + sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); + m_pDoc->InsertTab(0, "Test"); + + std::vector<std::vector<const char*>> aData = { + { "x", "y", "z" }, + { "a", "b", "c" } + }; + insertRangeData(m_pDoc, ScAddress(2,1,0), aData); // C2:E3 + m_pDoc->SetString(0,0,0, "=LOOKUP(2;1/(C2:E2<>\"\");C3:E3)"); // A1 + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should find match for last column.", OUString("c"), m_pDoc->GetString(0,0,0)); + m_pDoc->SetString(4,1,0, ""); // E2 + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should find match for second last column.", OUString("b"), m_pDoc->GetString(0,0,0)); + + m_pDoc->DeleteTab(0); +} + void Test::testFuncVLOOKUP() { // VLOOKUP |