download.lst | 2 - sc/qa/unit/ucalc.hxx | 2 + sc/qa/unit/ucalc_formula.cxx | 49 ++++++++++++++++++++++++++++++++++++++++ sc/source/core/data/dociter.cxx | 24 +++++++++++++++++-- 4 files changed, 73 insertions(+), 4 deletions(-)
New commits: commit c37c960bffc76f1a6bf8e6fcaa9ca113ab106637 Author: Kohei Yoshida <[email protected]> Date: Fri Jan 3 14:49:55 2014 -0500 Update internal mdds to 0.10.0. Change-Id: I8b69198a00c1f0dc900dfb448d4df520aac39bbf diff --git a/download.lst b/download.lst index b740df7..6ab97a7 100644 --- a/download.lst +++ b/download.lst @@ -80,7 +80,7 @@ export LIBXML_TARBALL := 9c0cfef285d5c4a5c80d00904ddab380-libxml2-2.9.1.tar.gz export LIBXSLT_TARBALL := 9667bf6f9310b957254fdcf6596600b7-libxslt-1.1.28.tar.gz export LPSOLVE_TARBALL := 26b3e95ddf3d9c077c480ea45874b3b8-lp_solve_5.5.tar.gz export MARIADB_TARBALL := 05f84c95b610c21c5fd510d10debcabf-mariadb-native-client-1.0.0.tar.bz2 -export MDDS_TARBALL := 8c853024fbcff39113d9285250dafc66-mdds_0.9.1.tar.bz2 +export MDDS_TARBALL := 26272a8e8c984d21ba800b4edcd3ada8-mdds_0.10.0.tar.bz2 export MYSQLCPPCONN_TARBALL := 0981bda6548a8c8233ffce2b6e4b2a23-mysql-connector-c++-1.1.0.tar.gz export MYTHES_TARBALL := 46e92b68e31e858512b680b3b61dc4c1-mythes-1.2.3.tar.gz export NEON_TARBALL := ff369e69ef0f0143beb5626164e87ae2-neon-0.29.5.tar.gz commit d83e923d06b76c00d29f5fdd687c4b22f6fb5cb2 Author: Kohei Yoshida <[email protected]> Date: Fri Jan 3 09:52:18 2014 -0500 I forgot to add a terminator here. Change-Id: I5fc809c38fe2d2649c9cadab78442eefe8be9ba0 diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 199494a..b19afdc 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -2042,6 +2042,7 @@ void Test::testFuncLOOKUP() { "A", "=LOOKUP(RC[-1];R1C1:R3C1;R1C2:R3C2)" }, { "B", "=LOOKUP(RC[-1];R1C1:R3C1;R1C2:R3C2)" }, { "C", "=LOOKUP(RC[-1];R1C1:R3C1;R1C2:R3C2)" }, + { 0, 0 } // terminator }; // Insert check formulas into A5:B7. commit 64c6d1367c635dd37ff1be9971e98e21748a145c Author: Eike Rathke <[email protected]> Date: Thu Jan 2 20:52:28 2014 +0100 resolved fdo#73113 not string cell does not mean no string at cell Introduced with c008dc483f8c6840803983e7e351cec6fdd32070 the ScQueryCellIterator::BinarySearch() evaluated all non-string cells as not being string, ignoring edit cells and formula cell string results. Change-Id: I43be46dc8db35d6d0677086c345379ed4627b355 diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 565565f..dab4a10 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1547,8 +1547,24 @@ bool ScQueryCellIterator::BinarySearch() continue; // while } + bool bHaveRefCell = false; PositionType aPos = pCol->maCells.position(i); - bool bStr = aPos.first->type == sc::element_type_string; + bool bStr; + switch (aPos.first->type) + { + case sc::element_type_formula: + aCell = sc::toRefCell(aPos.first, aPos.second); + bHaveRefCell = true; + bStr = aCell.hasString(); + break; + case sc::element_type_string: + case sc::element_type_edittext: + bStr = true; + break; + default: + bStr = false; + break; + } nRes = 0; // compares are content<query:-1, content>query:1 @@ -1556,7 +1572,8 @@ bool ScQueryCellIterator::BinarySearch() if (!bStr && !bByString) { double nCellVal; - aCell = sc::toRefCell(aPos.first, aPos.second); + if (!bHaveRefCell) + aCell = sc::toRefCell(aPos.first, aPos.second); switch (aCell.meType) { case CELLTYPE_VALUE : @@ -1611,7 +1628,8 @@ bool ScQueryCellIterator::BinarySearch() { OUString aCellStr; sal_uLong nFormat = pCol->GetNumberFormat(i); - aCell = sc::toRefCell(aPos.first, aPos.second); + if (!bHaveRefCell) + aCell = sc::toRefCell(aPos.first, aPos.second); ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, pDoc); nRes = pCollator->compareString(aCellStr, rEntry.GetQueryItem().maString.getString()); commit 703d55e5a0ac95cecad3872a700be141eb98f8c8 Author: Kohei Yoshida <[email protected]> Date: Fri Jan 3 09:47:01 2014 -0500 fdo#73113: Write unit test for LOOKUP. Change-Id: I1486b6ba9604c97601df142a32b211ce0aec7f09 diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 771a044..c4bc2ac 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -103,6 +103,7 @@ public: void testFuncN(); void testFuncCOUNTIF(); void testFuncNUMBERVALUE(); + void testFuncLOOKUP(); void testFuncVLOOKUP(); void testFuncMATCH(); void testFuncCELL(); @@ -316,6 +317,7 @@ public: CPPUNIT_TEST(testFuncN); CPPUNIT_TEST(testFuncCOUNTIF); CPPUNIT_TEST(testFuncNUMBERVALUE); + CPPUNIT_TEST(testFuncLOOKUP); 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 b07fffc..199494a 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -2017,6 +2017,54 @@ void Test::testFuncNUMBERVALUE() m_pDoc->DeleteTab(0); } +void Test::testFuncLOOKUP() +{ + FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1); + + m_pDoc->InsertTab(0, "Test"); + + // Raw data + const char* aData[][2] = { + { "=CONCATENATE(\"A\")", "1" }, + { "=CONCATENATE(\"B\")", "2" }, + { "=CONCATENATE(\"C\")", "3" }, + { 0, 0 } // terminator + }; + + // Insert raw data into A1:B3. + for (SCROW i = 0; aData[i][0]; ++i) + { + m_pDoc->SetString(0, i, 0, OUString::createFromAscii(aData[i][0])); + m_pDoc->SetString(1, i, 0, OUString::createFromAscii(aData[i][1])); + } + + const char* aData2[][2] = { + { "A", "=LOOKUP(RC[-1];R1C1:R3C1;R1C2:R3C2)" }, + { "B", "=LOOKUP(RC[-1];R1C1:R3C1;R1C2:R3C2)" }, + { "C", "=LOOKUP(RC[-1];R1C1:R3C1;R1C2:R3C2)" }, + }; + + // Insert check formulas into A5:B7. + for (SCROW i = 0; aData2[i][0]; ++i) + { + m_pDoc->SetString(0, i+4, 0, OUString::createFromAscii(aData2[i][0])); + m_pDoc->SetString(1, i+4, 0, OUString::createFromAscii(aData2[i][1])); + } + + printRange(m_pDoc, ScRange(0,4,0,1,6,0), "Data range for LOOKUP."); + + // Values for B5:B7 should be 1, 2, and 3. + CPPUNIT_ASSERT_MESSAGE("This formula should not have an error code.", m_pDoc->GetErrCode(ScAddress(1,4,0)) == 0); + CPPUNIT_ASSERT_MESSAGE("This formula should not have an error code.", m_pDoc->GetErrCode(ScAddress(1,5,0)) == 0); + CPPUNIT_ASSERT_MESSAGE("This formula should not have an error code.", m_pDoc->GetErrCode(ScAddress(1,6,0)) == 0); + + CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(ScAddress(1,4,0))); + CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(1,5,0))); + CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(1,6,0))); + + m_pDoc->DeleteTab(0); +} + void Test::testFuncVLOOKUP() { // VLOOKUP _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
