summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-10-18 16:55:04 +0200
committerLászló Németh <nemeth@numbertext.org>2021-10-20 12:37:06 +0200
commitec577f566fa3e6d2666069180f8ec8474054aea9 (patch)
treefe56d87d153122dcfb779bbb9936eaf92f27c34c /sw/qa
parent378e8396223a80b96262d7b638a066eb83ba88d6 (diff)
tdf#145233 sw track changes: show moved text in green color
and with double strikethrough or underlines during change tracking to speed up reviewing, e.g. re-ordered list elements or changed paragraph or sentence order is more visible this way. Note: skip terminating white spaces of the changes during recognition of the text movement, as a workaround for a typical difference resulted by e.g. Writer UX: selecting a sentence or a word, and moving it with the mouse, Writer removes a space at the deletion to avoid double spaces, also inserts a space at the insertion point automatically. Because the result can be different (space before and space after the moved text), compare the changes without terminating spaces. See also commit bcdebc832b272662d28035007a4796e42d1305ae "tdf#104797 DOCX change tracking: handle moveFrom and moveTo". Change-Id: If2a16f1f43315ecab659b24425692ac14bcda619 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123814 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/layout/layout2.cxx35
1 files changed, 33 insertions, 2 deletions
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index fce384cd8f3e..a66baa7f4a81 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -26,6 +26,7 @@
#include <frameformats.hxx>
#include <unotextrange.hxx>
#include <fmtanchr.hxx>
+#include <editsh.hxx>
constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/extras/layout/data/";
@@ -290,14 +291,44 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInNumbering)
CPPUNIT_ASSERT(pXmlDoc);
// Assert the tracked deletion of the number of joined list item and
- // the tracked insertion of the number after a split list item as not black elements
- assertXPath(pXmlDoc, "/metafile/push/push/push/textcolor[not(@color='#000000')]", 6);
+ // the tracked insertion of the number after a split list item as not black
+ // (and not COL_GREEN color of the tracked text movement, see testRedlineMoving) elements
+ assertXPath(
+ pXmlDoc,
+ "/metafile/push/push/push/textcolor[not(@color='#000000') and not(@color='#008000')]", 6);
// tdf#145068 numbering shows changes in the associated list item, not the next one
// This was 1 (black numbering of the first list item previously)
assertXPath(pXmlDoc, "/metafile/push/push/push/font[4][@color='#000000']", 0);
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMoving)
+{
+ SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf42748.fodt");
+ SwDocShell* pShell = pDoc->GetDocShell();
+
+ // create a 3-element list without change tracking
+ SwEditShell* const pEditShell(pDoc->GetEditShell());
+ pEditShell->RejectRedline(0);
+ pEditShell->AcceptRedline(0);
+
+ // move down first list item with track changes
+ dispatchCommand(mxComponent, ".uno:GoToStartOfDoc", {});
+ dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+ dispatchCommand(mxComponent, ".uno:MoveDown", {});
+
+ // Dump the rendering of the first page as an XML file.
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+ MetafileXmlDump dumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ // text and numbering colors show moving of the list item
+ // These were 0 (other color, not COL_GREEN, color of the tracked text movement)
+ assertXPath(pXmlDoc, "/metafile/push/push/push/textcolor[@color='#008000']", 5);
+ assertXPath(pXmlDoc, "/metafile/push/push/push/font[@color='#008000']", 11);
+}
+
CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125300)
{
SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf125300.docx");