sc/qa/unit/tiledrendering/tiledrendering.cxx | 37 --------------------------- sc/qa/unit/ucalc.cxx | 19 ++----------- sc/source/core/data/column3.cxx | 28 +++++--------------- 3 files changed, 11 insertions(+), 73 deletions(-)
New commits: commit 85a46d2beefbd3d32fd221e8f9d247ff84adca26 Author: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> AuthorDate: Sat Sep 4 20:29:28 2021 +0300 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Thu Sep 9 09:06:05 2021 +0200 Revert "tdf#142214: autocomplete: do not search across empty blocks" This reverts commit ca2ec443893731093970914feb750b31ea13e47f. Breaks user experience. Removed ScTiledRenderingTest::testAutoInputStringBlock as well. Conflicts: sc/source/core/data/column3.cxx Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121640 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> (cherry picked from commit 223f3a6fac43580114bca86abb34d7cf3219f4bc) Change-Id: Id03bc645d78c29c0aa588b2133fc1cb96f3cceb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121810 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index b9f24ed20afd..f43f3acf8b31 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -116,7 +116,6 @@ public: void testSpellOnlineRenderParameter(); void testPasteIntoWrapTextCell(); void testSortAscendingDescending(); - void testAutoInputStringBlock(); void testAutoInputExactMatch(); void testMoveShapeHandle(); void testEditCursorBounds(); @@ -170,7 +169,6 @@ public: CPPUNIT_TEST(testSpellOnlineRenderParameter); CPPUNIT_TEST(testPasteIntoWrapTextCell); CPPUNIT_TEST(testSortAscendingDescending); - CPPUNIT_TEST(testAutoInputStringBlock); CPPUNIT_TEST(testAutoInputExactMatch); CPPUNIT_TEST(testMoveShapeHandle); CPPUNIT_TEST(testEditCursorBounds); @@ -2640,41 +2638,6 @@ static void lcl_typeCharsInCell(const std::string& aStr, SCCOL nCol, SCROW nRow, Scheduler::ProcessEventsToIdle(); } -void ScTiledRenderingTest::testAutoInputStringBlock() -{ - comphelper::LibreOfficeKit::setActive(); - - ScModelObj* pModelObj = createDoc("empty.ods"); - CPPUNIT_ASSERT(pModelObj); - ScTabViewShell* pView = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current()); - CPPUNIT_ASSERT(pView); - ScDocument* pDoc = pModelObj->GetDocument(); - - pDoc->SetString(ScAddress(0, 3, 0), "ABC"); // A4 - pDoc->SetString(ScAddress(0, 4, 0), "BAC"); // A5 - ScFieldEditEngine& rEE = pDoc->GetEditEngine(); - rEE.SetText("XYZ"); - pDoc->SetEditText(ScAddress(0, 5, 0), rEE.CreateTextObject()); // A6 - pDoc->SetValue(ScAddress(0, 6, 0), 123); - pDoc->SetString(ScAddress(0, 7, 0), "ZZZ"); // A8 - - ScAddress aA1(0, 0, 0); - lcl_typeCharsInCell("X", aA1.Col(), aA1.Row(), pView, pModelObj); // Type 'X' in A1 - CPPUNIT_ASSERT_EQUAL_MESSAGE("A1 should not autocomplete", OUString("X"), pDoc->GetString(aA1)); - - ScAddress aA3(0, 2, 0); // Adjacent to the string "superblock" A4:A8 - lcl_typeCharsInCell("X", aA3.Col(), aA3.Row(), pView, pModelObj); // Type 'X' in A3 - CPPUNIT_ASSERT_EQUAL_MESSAGE("A3 should autocomplete", OUString("XYZ"), pDoc->GetString(aA3)); - - ScAddress aA9(0, 8, 0); // Adjacent to the string "superblock" A4:A8 - lcl_typeCharsInCell("X", aA9.Col(), aA9.Row(), pView, pModelObj); // Type 'X' in A9 - CPPUNIT_ASSERT_EQUAL_MESSAGE("A9 should autocomplete", OUString("XYZ"), pDoc->GetString(aA9)); - - ScAddress aA11(0, 10, 0); - lcl_typeCharsInCell("X", aA11.Col(), aA11.Row(), pView, pModelObj); // Type 'X' in A11 - CPPUNIT_ASSERT_EQUAL_MESSAGE("A11 should not autocomplete", OUString("X"), pDoc->GetString(aA11)); -} - void ScTiledRenderingTest::testAutoInputExactMatch() { comphelper::LibreOfficeKit::setActive(); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 3c21c990cf44..ae28aadeae31 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -534,22 +534,14 @@ void Test::testDataEntries() m_pDoc->SetString(ScAddress(0,5,0), "Andy"); m_pDoc->SetString(ScAddress(0,6,0), "Bruce"); m_pDoc->SetString(ScAddress(0,7,0), "Charlie"); - m_pDoc->SetValue(ScAddress(0,8,0), 100); - m_pDoc->SetValue(ScAddress(0,9,0), 200); m_pDoc->SetString(ScAddress(0,10,0), "Andy"); - m_pDoc->SetValue(ScAddress(0,11,0), 1000); std::vector<ScTypedStrData> aEntries; - m_pDoc->GetDataEntries(0, 0, 0, aEntries); // Try at the top. - std::vector<ScTypedStrData>::const_iterator it = aEntries.begin(); - CPPUNIT_ASSERT_MESSAGE("The entries should be empty.", bool(it == aEntries.end())); - - aEntries.clear(); - m_pDoc->GetDataEntries(0, 4, 0, aEntries); // Try at A5. + m_pDoc->GetDataEntries(0, 0, 0, aEntries); // Try at the very top. // Entries are supposed to be sorted in ascending order, and are all unique. CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aEntries.size()); - it = aEntries.begin(); + std::vector<ScTypedStrData>::const_iterator it = aEntries.begin(); CPPUNIT_ASSERT_EQUAL(OUString("Andy"), it->GetString()); ++it; CPPUNIT_ASSERT_EQUAL(OUString("Bruce"), it->GetString()); @@ -559,7 +551,7 @@ void Test::testDataEntries() CPPUNIT_ASSERT_MESSAGE("The entries should have ended here.", bool(it == aEntries.end())); aEntries.clear(); - m_pDoc->GetDataEntries(0, 12, 0, aEntries); // Try at A13. + m_pDoc->GetDataEntries(0, MAXROW, 0, aEntries); // Try at the very bottom. CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aEntries.size()); // Make sure we get the same set of suggestions. @@ -572,11 +564,6 @@ void Test::testDataEntries() ++it; CPPUNIT_ASSERT_MESSAGE("The entries should have ended here.", bool(it == aEntries.end())); - aEntries.clear(); - m_pDoc->GetDataEntries(0, MAXROW, 0, aEntries); // Try at the bottom. - it = aEntries.begin(); - CPPUNIT_ASSERT_MESSAGE("The entries should be empty.", bool(it == aEntries.end())); - m_pDoc->DeleteTab(0); } diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index b9232f334644..306781a26baf 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2548,11 +2548,6 @@ public: return (maPos.first->type == sc::element_type_string || maPos.first->type == sc::element_type_edittext); } - bool isEmpty() const - { - return maPos.first->type == sc::element_type_empty; - } - bool prev() { if (!has()) @@ -2560,7 +2555,7 @@ public: // Not in a string block. Move back until we hit a string block. while (!has()) { - if (isEmpty() || maPos.first == miBeg) + if (maPos.first == miBeg) return false; --maPos.first; // move to the preceding block. @@ -2586,10 +2581,6 @@ public: // Move to the last cell of the previous block. --maPos.first; maPos.second = maPos.first->size - 1; - - if (isEmpty()) - return false; - if (has()) break; } @@ -2604,9 +2595,6 @@ public: // Not in a string block. Move forward until we hit a string block. while (!has()) { - if (isEmpty()) - return false; - ++maPos.first; if (maPos.first == miEnd) return false; @@ -2628,10 +2616,6 @@ public: return false; maPos.second = 0; - - if (isEmpty()) - return false; - if (has()) break; } @@ -2667,12 +2651,16 @@ bool ScColumn::GetDataEntries( // going upward and downward directions in parallel. The start position // cell must be skipped. - StrCellIterator aItrUp(maCells, nStartRow-1, GetDoc()); + StrCellIterator aItrUp(maCells, nStartRow, GetDoc()); StrCellIterator aItrDown(maCells, nStartRow+1, GetDoc()); bool bMoveUp = aItrUp.valid(); - if (bMoveUp && !aItrUp.has()) - bMoveUp = aItrUp.prev(); // Find the previous string cell position. + if (!bMoveUp) + // Current cell is invalid. + return false; + + // Skip the start position cell. + bMoveUp = aItrUp.prev(); // Find the previous string cell position. bool bMoveDown = aItrDown.valid(); if (bMoveDown && !aItrDown.has())