summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorVarun <varun.dhall@studentpartner.com>2015-06-24 09:12:39 +0530
committerMichael Stahl <mstahl@redhat.com>2015-06-24 22:04:22 +0000
commit6ec79a6a755e7a4a585e2b93f589bbc92fe0c35b (patch)
treeb0db1b6309ab773fd48537feddacc69fa7c8de83 /sw
parent6f55712e28614ece8c300895493b6c1520782418 (diff)
Add Test for tdf#63214 CrossRefBookmark undo crash
Change-Id: Id47197d9282a408a2d49a3b9de4c8856ad47dec3 Reviewed-on: https://gerrit.libreoffice.org/16441 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index afefed28bcbb..2f5171dc3a43 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -91,6 +91,7 @@ public:
void testFdo87448();
void testTdf68183();
void testCp1000115();
+ void testTdf63214();
void testTdf90003();
void testTdf51741();
void testdelofTableRedlines();
@@ -135,6 +136,7 @@ public:
CPPUNIT_TEST(testFdo87448);
CPPUNIT_TEST(testTdf68183);
CPPUNIT_TEST(testCp1000115);
+ CPPUNIT_TEST(testTdf63214);
CPPUNIT_TEST(testTdf90003);
CPPUNIT_TEST(testTdf51741);
CPPUNIT_TEST(testdelofTableRedlines);
@@ -872,6 +874,31 @@ void SwUiWriterTest::testCp1000115()
xmlXPathFreeObject(pXmlObj);
}
+void SwUiWriterTest::testTdf63214()
+{
+ //This is a crash test
+ SwDoc* pDoc = createDoc();
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
+ pWrtShell->Insert("V");
+ { //limiting the lifetime of SwPaM with a nested scope
+ //the shell cursor are automatically adjusted when nodes are deleted, but the shell doesn't know about an SwPaM on the stack
+ IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
+ SwPaM aPaM( SwNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1) );
+ aPaM.SetMark();
+ aPaM.Move(fnMoveForward, fnGoContent);
+ //Inserting a crossRefBookmark
+ pMarkAccess->makeMark(aPaM, OUString("Bookmark"), IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
+ }
+ //moving cursor to the end of paragraph
+ pWrtShell->EndPara();
+ //inserting paragraph break
+ pWrtShell->SplitNode();
+ rUndoManager.Undo();
+ rUndoManager.Redo();
+}
+
void SwUiWriterTest::testTdf90003()
{
createDoc("tdf90003.odt");