sc/qa/unit/ucalc.cxx | 6 ++++++ sc/qa/unit/ucalc.hxx | 1 + sc/qa/unit/ucalc_formula.cxx | 18 +++++++++++++++++- sc/source/core/data/dociter.cxx | 4 +++- 4 files changed, 27 insertions(+), 2 deletions(-)
New commits: commit c078d5fef98ba77751b7a9593691d88dfc1c9ba1 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Thu Mar 13 10:22:25 2014 -0400 fdo#75642: Check the high position block correctly. Change-Id: I25deabf69e78c6e0354e8a528ab88891a30f9aec diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 481796c..3a1e7d9 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1538,7 +1538,9 @@ public: // Move to the last position of the previous block. decBlock(aHiPos); - if (aHiPos.first == mrCells.begin()) + // Check the row postion of the end of the previous block, and make sure it's valid. + SCROW nBlockEndRow = aHiPos.first->position + aHiPos.first->size - 1; + if (nBlockEndRow < nStartRow) { mbValid = false; return; commit e5802954853a9ec64fb5fec917f8c3b2daba6526 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Thu Mar 13 09:53:23 2014 -0400 fdo#75642: Add test case for this. Change-Id: I220cc3aeac79325e7664461d3bd5219e9e1f04f7 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 3c809a8..ed5e894 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -5575,6 +5575,12 @@ void Test::clearRange(ScDocument* pDoc, const ScRange& rRange) rRange.aEnd.Col(), rRange.aEnd.Row(), aMarkData, IDF_CONTENTS); } +void Test::clearSheet(ScDocument* pDoc, SCTAB nTab) +{ + ScRange aRange(0,0,nTab,MAXCOL,MAXROW,nTab); + clearRange(pDoc, aRange); +} + void Test::copyToClip(ScDocument* pSrcDoc, const ScRange& rRange, ScDocument* pClipDoc) { ScClipParam aClipParam(rRange, false); diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index d17c8f5..68f5bc4 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -42,6 +42,7 @@ public: static bool insertRangeNames(ScDocument* pDoc, const RangeNameDef* p, const RangeNameDef* pEnd); static void printRange(ScDocument* pDoc, const ScRange& rRange, const char* pCaption); static void clearRange(ScDocument* pDoc, const ScRange& rRange); + static void clearSheet(ScDocument* pDoc, SCTAB nTab); static void copyToClip(ScDocument* pSrcDoc, const ScRange& rRange, ScDocument* pClipDoc); static void pasteFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocument* pClipDoc); static ScUndoPaste* createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange, ScDocument* pUndoDoc); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 3fcc896..8bf8435 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -2458,7 +2458,7 @@ void Test::testFuncVLOOKUP() } // Clear the sheet and start over. - clearRange(m_pDoc, ScRange(0,0,0,MAXCOL,MAXROW,0)); + clearSheet(m_pDoc, 0); // Lookup on sorted data intersparsed with empty cells. @@ -2492,6 +2492,22 @@ void Test::testFuncVLOOKUP() CPPUNIT_ASSERT_EQUAL(OUString("Four"), m_pDoc->GetString(ScAddress(4,3,0))); CPPUNIT_ASSERT_EQUAL(OUString("Four"), m_pDoc->GetString(ScAddress(4,4,0))); + // Start over again. + clearSheet(m_pDoc, 0); + + // Set A,B,....,G to A1:A7. + m_pDoc->SetString(ScAddress(0,0,0), "A"); + m_pDoc->SetString(ScAddress(0,1,0), "B"); + m_pDoc->SetString(ScAddress(0,2,0), "C"); + m_pDoc->SetString(ScAddress(0,3,0), "D"); + m_pDoc->SetString(ScAddress(0,4,0), "E"); + m_pDoc->SetString(ScAddress(0,5,0), "F"); + m_pDoc->SetString(ScAddress(0,6,0), "G"); + + // Set the formula in C1. + m_pDoc->SetString(ScAddress(2,0,0), "=VLOOKUP(\"C\";A1:A16;1)"); + CPPUNIT_ASSERT_EQUAL(OUString("C"), m_pDoc->GetString(ScAddress(2,0,0))); + m_pDoc->DeleteTab(0); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits