diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-03-07 19:37:02 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-03-22 10:30:03 +0100 |
commit | b0d2813a1a56834656b01f7ee30186f3c0a1b5f9 (patch) | |
tree | dedb24df9833a781eb43383e94515934f7b2a78f /sw/qa/extras/uiwriter | |
parent | 38f4824ce05ffa61b219becbef21f0e24c4df2b9 (diff) |
tdf#147414 sw_redlinehide: fix cursor position after AutoCorrect
Change-Id: Ia06cd4e1a74a21788e4d0ddb5f0481e8a144d863
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131147
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit e2076b31a91d3882f3deeaa5d3d4659da0e4b17c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131134
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/extras/uiwriter')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index d5f6f045da70..992c10290429 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1545,6 +1545,36 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376) CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM)); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147414) +{ + SwDoc* const pDoc(createSwDoc()); + SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); + + pWrtShell->Insert("Abc"); + + // hide and enable + dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); + dispatchCommand(mxComponent, ".uno:TrackChanges", {}); + + CPPUNIT_ASSERT(pDoc->getIDocumentRedlineAccess().IsRedlineOn()); + CPPUNIT_ASSERT( + IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); + CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines()); + + pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); + // backspace + pWrtShell->DelLeft(); + pWrtShell->AutoCorrect(corr, u' '); + + // problem was this was 1 i.e. before the deleted "b" while " " was inserted after + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), + pWrtShell->getShellCursor(false)->GetPoint()->nContent.GetIndex()); + CPPUNIT_ASSERT_EQUAL( + OUString("Ab c"), + pWrtShell->getShellCursor(false)->GetPoint()->nNode.GetNode().GetTextNode()->GetText()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147310) { SwDoc* pDoc = createSwDoc(); |