sc/qa/unit/ucalc.hxx | 2 ++ sc/qa/unit/ucalc_formula.cxx | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+)
New commits: commit bcfad35ee4033e50c351671e9229f9d16c107e67 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri Mar 26 12:01:54 2021 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Mar 26 17:30:49 2021 +0100 tdf#116216: sc_ucalc: Add unittest Change-Id: I07237a491e3018b1d54794ac8456ea0fce3ae07d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113153 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index d5000f042c1e..17422ea8e804 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -206,6 +206,7 @@ public: void testFuncLEN(); void testFuncLOOKUP(); void testFuncLOOKUParrayWithError(); + void testTdf116216(); void testFuncVLOOKUP(); void testFuncMATCH(); void testFuncCELL(); @@ -654,6 +655,7 @@ public: CPPUNIT_TEST(testFuncLEN); CPPUNIT_TEST(testFuncLOOKUP); CPPUNIT_TEST(testFuncLOOKUParrayWithError); + CPPUNIT_TEST(testTdf116216); 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 6ff96cfd4b89..3d1a9a3677d8 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -5538,6 +5538,36 @@ void Test::testFuncLOOKUParrayWithError() m_pDoc->DeleteTab(0); } +void Test::testTdf116216() +{ + sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); + m_pDoc->InsertTab(0, "Test1"); + m_pDoc->InsertTab(1, "Test2"); + + std::vector<std::vector<const char*>> aData = { + { "k1", "value1"}, + { "k2", "value2"}, + { "k3", "value3"} + }; + + insertRangeData(m_pDoc, ScAddress(0,1,1), aData); // A2:B4 + m_pDoc->SetString(4,0,1, "k2"); // E1 + + m_pDoc->SetString(4,1,1, "=LOOKUP(1;1/(A$2:A$4=E$1);1)"); + m_pDoc->SetString(4,2,1, "=LOOKUP(E1;A$2:A$4;B2:B4)"); + m_pDoc->SetString(4,3,1, "=LOOKUP(1;1/(A$2:A$4=E$1);B2:B4)"); + + // Without the fix in place, this test would haved failed with + // - Expected: #N/A + // - Actual : + CPPUNIT_ASSERT_EQUAL(OUString("#N/A"), m_pDoc->GetString(4,1,1)); + CPPUNIT_ASSERT_EQUAL(OUString("value2"), m_pDoc->GetString(4,2,1)); + CPPUNIT_ASSERT_EQUAL(OUString("value2"), m_pDoc->GetString(4,3,1)); + + m_pDoc->DeleteTab(1); + 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