diff options
author | László Németh <nemeth@numbertext.org> | 2020-10-22 17:49:56 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-10-24 14:26:51 +0200 |
commit | fe1fc9615511994ac128e52f9ad1cda4e86188f5 (patch) | |
tree | 25ccce8221158bfe917a489ed3ea982606cda618 /sw/qa | |
parent | f359366aca6efcf1288ca9ebe5716b370daf31dc (diff) |
tdf#137684 sw ChangesInMargin: fix crash on Undo of characters
deleted by pressing Delete.
Follow-up of commit 62596e7f52492305b49dab70bdf81daf82b930a1
(tdf#137526 sw ChangesInMargin: fix Undo of deleted words).
Change-Id: I1a3c3e446f67de94ff3b750b45421f9bc93e5cc2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104691
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index b59708576b6b..0d3b1aee820c 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1892,6 +1892,39 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137526) CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137684) +{ + load(DATA_DIRECTORY, "tdf132160.odt"); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + // switch on "Show changes in margin" mode + dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {}); + + SwWrtShell* const pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + CPPUNIT_ASSERT(pWrtShell->GetViewOptions()->IsShowChangesInMargin()); + + // select and delete a word letter by letter + for (int i = 0; i <= 10; ++i) + { + dispatchCommand(mxComponent, ".uno:Delete", {}); + } + CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("support")); + + // this would crash due to bad redline range + for (int i = 0; i <= 10; ++i) + { + dispatchCommand(mxComponent, ".uno:Undo", {}); + } + // TODO: fix order of the characters after Undo + CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith(" noitpyrcnE")); + + // switch off "Show changes in margin" mode + dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {}); + CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf52391) { load(DATA_DIRECTORY, "tdf52391.fodt"); |