diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-12 16:12:54 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-13 20:36:21 -0500 |
commit | 888851bdd7498558af1a74f7e982ad1455ef3a35 (patch) | |
tree | c4fee33967bb1e06f797624c2ce1e59a3cd0a3ef | |
parent | e076b5290e706b8a69abd397a9f255eba6a0cd1a (diff) |
fdo#74558: Add new test case to catch this regression.
Change-Id: Ibef7131172938bd0ced6a3f4deeddaa98e9e7d6c
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 75553aebc3cd..608b81fc608d 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -2291,6 +2291,41 @@ void Test::testFuncVLOOKUP() } } + // Clear the sheet and start over. + clearRange(m_pDoc, ScRange(0,0,0,MAXCOL,MAXROW,0)); + + // Lookup on sorted data intersparsed with empty cells. + + // A1:B8 is the search range. + m_pDoc->SetValue(ScAddress(0,2,0), 1.0); + m_pDoc->SetValue(ScAddress(0,4,0), 2.0); + m_pDoc->SetValue(ScAddress(0,7,0), 4.0); + m_pDoc->SetString(ScAddress(1,2,0), "One"); + m_pDoc->SetString(ScAddress(1,4,0), "Two"); + m_pDoc->SetString(ScAddress(1,7,0), "Four"); + + // D1:D5 contain match values. + m_pDoc->SetValue(ScAddress(3,0,0), 1.0); + m_pDoc->SetValue(ScAddress(3,1,0), 2.0); + m_pDoc->SetValue(ScAddress(3,2,0), 3.0); + m_pDoc->SetValue(ScAddress(3,3,0), 4.0); + m_pDoc->SetValue(ScAddress(3,4,0), 5.0); + + // E1:E5 contain formulas. + m_pDoc->SetString(ScAddress(4,0,0), "=VLOOKUP(D1;$A$1:$B$8;2)"); + m_pDoc->SetString(ScAddress(4,1,0), "=VLOOKUP(D2;$A$1:$B$8;2)"); + m_pDoc->SetString(ScAddress(4,2,0), "=VLOOKUP(D3;$A$1:$B$8;2)"); + m_pDoc->SetString(ScAddress(4,3,0), "=VLOOKUP(D4;$A$1:$B$8;2)"); + m_pDoc->SetString(ScAddress(4,4,0), "=VLOOKUP(D5;$A$1:$B$8;2)"); + m_pDoc->CalcAll(); + + // Check the formula results in E1:E5. + CPPUNIT_ASSERT_EQUAL(OUString("One"), m_pDoc->GetString(ScAddress(4,0,0))); + CPPUNIT_ASSERT_EQUAL(OUString("Two"), m_pDoc->GetString(ScAddress(4,1,0))); + CPPUNIT_ASSERT_EQUAL(OUString("Two"), m_pDoc->GetString(ScAddress(4,2,0))); + CPPUNIT_ASSERT_EQUAL(OUString("Four"), m_pDoc->GetString(ScAddress(4,3,0))); + CPPUNIT_ASSERT_EQUAL(OUString("Four"), m_pDoc->GetString(ScAddress(4,4,0))); + m_pDoc->DeleteTab(0); } |