sc/qa/unit/tiledrendering/tiledrendering.cxx | 37 +++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
New commits: commit f26af764dee862e5c9a689d242ee72d1dac8bc1f Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri Sep 10 11:24:28 2021 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Sep 10 14:31:03 2021 +0200 tdf#142214: reintroduce unittest and adapt it to the expected behaviour The test was added in ca2ec443893731093970914feb750b31ea13e47f < tdf#142214: autocomplete: do not search across empty blocks > and later reverted in 85a46d2beefbd3d32fd221e8f9d247ff84adca26 < Revert "tdf#142214: autocomplete: do not search across empty blocks" > Change-Id: I5ca19ea9513740bfb6a197fe0a27860fa3cb6770 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121871 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index dc5813740167..60d67e5d6a39 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -114,6 +114,7 @@ public: void testSpellOnlineRenderParameter(); void testPasteIntoWrapTextCell(); void testSortAscendingDescending(); + void testAutoInputStringBlock(); void testAutoInputExactMatch(); void testMoveShapeHandle(); void testEditCursorBounds(); @@ -167,6 +168,7 @@ public: CPPUNIT_TEST(testSpellOnlineRenderParameter); CPPUNIT_TEST(testPasteIntoWrapTextCell); CPPUNIT_TEST(testSortAscendingDescending); + CPPUNIT_TEST(testAutoInputStringBlock); CPPUNIT_TEST(testAutoInputExactMatch); CPPUNIT_TEST(testMoveShapeHandle); CPPUNIT_TEST(testEditCursorBounds); @@ -2650,6 +2652,41 @@ void lcl_typeCharsInCell(const std::string& aStr, SCCOL nCol, SCROW nRow, ScTabV 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 autocomplete", OUString("XYZ"), 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 autocomplete", OUString("XYZ"), pDoc->GetString(aA11)); +} + void ScTiledRenderingTest::testAutoInputExactMatch() { comphelper::LibreOfficeKit::setActive();