summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-12-12 13:19:01 +0100
committerLászló Németh <nemeth@numbertext.org>2020-12-12 18:02:43 +0100
commit039b8ab4329a56420ac6da6cd78087d5a42e8dd3 (patch)
tree28d66228615e0277d2d47fa426b76d3d26de27d6 /sw/qa
parent4676c1f079e173664b3c609dce5fa36aa22b1e40 (diff)
tdf#138605 sw change tracking: fix crash with Undo
Regression from commit 469f472fb31c4ef1a57f8ec54ba750c1332feec2 (tdf#138479 tdf#137769 sw ChangesInMargin: fix Undo in paragraphs) Change-Id: I7826b7920e51733da98c00bfdcb8636d42655afc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107637 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit e57d77cb01d3e76a942c5e2bb896135dd900f807) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107620
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 4bbaeee20341..cb33dc0ac5b3 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -1957,6 +1957,36 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137503)
CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138605)
+{
+ SwDoc* const pDoc(createDoc());
+ SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ // turn on red-lining and show changes
+ pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowInsert
+ | RedlineFlags::ShowDelete);
+ CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+ pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+ CPPUNIT_ASSERT_MESSAGE(
+ "redlines should be visible",
+ IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+ // insert a word, delete it with change tracking and try to undo it
+ pWrtShell->Insert("word");
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ dispatchCommand(mxComponent, ".uno:Delete", {});
+ // this crashed due to bad access to the empty redline table
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+
+ // more Undo
+ CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("word"));
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+ CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith(""));
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138135)
{
load(DATA_DIRECTORY, "tdf132160.odt");