diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-09-10 11:24:28 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-09-10 14:31:03 +0200 |
commit | f26af764dee862e5c9a689d242ee72d1dac8bc1f (patch) | |
tree | 4cab24c20bcd935e977d51d0e5202fe8f6dc6667 /sc/qa | |
parent | 53ebbad48c8c2a71044917a5cbac9657126e5adc (diff) |
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 <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
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(); |