diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-05-26 16:46:57 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-05-27 19:18:26 +0200 |
commit | ca8e04f1ab739e14288ab5e0be44723536b9ca4e (patch) | |
tree | 5aca86facd668014363b936130dd2c927cf0723e /sw/qa/extras/uiwriter/uiwriter2.cxx | |
parent | 27d7eedc1d3ea471f40d0a81bd4e957bdcf8d8d7 (diff) |
tdf#132236 sw_redlinehide: fix SwUndoDelete with sections even more
SwUndoDelete::UndoImpl may want to move something like this into the
nodes-array:
[ 9] 0x6356fe0 TextNode "",
[ 10] 0x31cba00 ~DeletedNode ,
[ 11] 0x64d8840 TextNode "Introduction - xzn Overview Of KmneqxziTY\t3",
[ 12] 0x64e9750 TextNode "shell\t20",
[ 13] 0x7a0f0a0 ~DeletedNode ,
The ~DeletedNode become end nodes of section nodes; in this case
m_nSectDiff != 0.
Don't skip these end nodes because in the above "Untitled 1.odt"
example, they are not necessarily consecutive.
Between the 1st and 2nd one a new SwSectionFrame must be created via the
outer section, so adapt InsertCnt_() to check for extra end nodes in the
range and do this.
(regression from 723728cd358693b8f4bc9d913541aa4479f2bd48)
Change-Id: I7bfba9efca1789392495ebec37eb3e5b6138bd07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94883
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/qa/extras/uiwriter/uiwriter2.cxx')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 13e53234b445..74f6c5e30c22 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -289,6 +289,30 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineInHiddenSection) CPPUNIT_ASSERT(pNode->GetNodes()[pNode->GetIndex() + 4]->IsEndNode()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf132236) +{ + load(DATA_DIRECTORY, "tdf132236.odt"); + + SwXTextDocument* const pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + // select everything and delete + SwWrtShell* const pWrtShell(pTextDoc->GetDocShell()->GetWrtShell()); + pWrtShell->Down(true); + pWrtShell->Down(true); + pWrtShell->Down(true); + pWrtShell->Delete(); + SwDoc* const pDoc(pWrtShell->GetDoc()); + sw::UndoManager& rUndoManager(pDoc->GetUndoManager()); + rUndoManager.Undo(); + + // check that the text frames exist inside their sections + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page[1]/body/section[1]/txt", 1); + assertXPath(pXmlDoc, "/root/page[1]/body/section[2]/txt", 2); + assertXPath(pXmlDoc, "/root/page[1]/body/txt", 1); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf54819) { load(DATA_DIRECTORY, "tdf54819.fodt"); |