summaryrefslogtreecommitdiff
path: root/sw/qa/extras/layout
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-10-22 16:15:39 +0200
committerLászló Németh <nemeth@numbertext.org>2021-10-26 15:02:32 +0200
commit4c982dbafdac900e233d7b68d95c9c99244defc1 (patch)
tree061ae46050245fe5e38886e262df7f2f484d3ba8 /sw/qa/extras/layout
parent1b6839f59b5aa9bf01674862aa320259ee488f63 (diff)
tdf#145225 sw track changes: fix bad insert at moving
Moving up a list item over a tracked paragraph insertion changed non-tracked text to tracked insertion. Manual test: - Create a 3-element list; - switch on Record Changes and Show Changes; - at the end of the list item 2, press Enter to insert a new list item, and type some text: Item 1 Item 2[ New item] Item 3 where parenthesis shows the boundaries of the tracked insertion; - move up the last list item over list item 2 (the unmodified paragraph text with a tracked paragraph insertion at the end). Paragraph text before the tracked paragraph insertion changed to tracked insertion joining its tracked insertion with the moved list item, resulting only 2 tracked changes: Item 1 [Item 3 Item 2 New item] [Item 3] instead of the requested 3 changes: Item 1 [Item 3] Item 2[ New item] [Item 3] Change-Id: I4716b2d244b57cf86d7d14d972452191549f5fea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124144 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa/extras/layout')
-rw-r--r--sw/qa/extras/layout/layout2.cxx36
1 files changed, 36 insertions, 0 deletions
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index a66baa7f4a81..9f765b1452c7 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -21,6 +21,7 @@
#include <unotxdoc.hxx>
#include <rootfrm.hxx>
#include <docsh.hxx>
+#include <wrtsh.hxx>
#include <IDocumentLayoutAccess.hxx>
#include <textboxhelper.hxx>
#include <frameformats.hxx>
@@ -329,6 +330,41 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMoving)
assertXPath(pXmlDoc, "/metafile/push/push/push/font[@color='#008000']", 11);
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf145225_RedlineMovingWithBadInsertion)
+{
+ SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf42748.fodt");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ // create a 3-element list without change tracking
+ // (because the fixed problem depends on the own changes)
+ SwEditShell* const pEditShell(pDoc->GetEditShell());
+ pEditShell->RejectRedline(0);
+ pEditShell->AcceptRedline(0);
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(0), pEditShell->GetRedlineCount());
+
+ // Show Changes
+ SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+ SwRootFrame* pLayout(pWrtShell->GetLayout());
+ CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
+
+ // insert a tracked paragraph break in middle of the second list item, i.e. split it
+ dispatchCommand(mxComponent, ".uno:GoToStartOfDoc", {});
+ dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+ pWrtShell->Down(false, 1);
+ pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false);
+ pWrtShell->SplitNode(false);
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(1), pEditShell->GetRedlineCount());
+
+ // move up the last list item over the paragraph split
+ dispatchCommand(mxComponent, ".uno:GoToEndOfDoc", {});
+ dispatchCommand(mxComponent, ".uno:MoveUp", {});
+ dispatchCommand(mxComponent, ".uno:MoveUp", {});
+ // This was 2 (the tracked paragraph break joined with the moved list item,
+ // setting the not changed text of the second list item to tracked insertion)
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(3), pEditShell->GetRedlineCount());
+}
+
CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125300)
{
SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf125300.docx");