sc/qa/unit/ucalc.hxx | 2 ++ sc/qa/unit/ucalc_formula.cxx | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+)
New commits: commit ba490001c2d82c1172854ca16d7099b19e29cb60 Author: Eike Rathke <er...@redhat.com> Date: Mon Mar 5 22:50:07 2018 +0100 Unit test for tdf#116216 Change-Id: Icd2e37c279db43b792e84b3aae64c16db0c4834b 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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits