summaryrefslogtreecommitdiff
path: root/sw/qa/uitest/writer_tests4/tdf108124.py
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-12-05 16:49:33 +0100
committerMichael Stahl <michael.stahl@cib.de>2019-12-06 13:26:32 +0100
commit91b2325808a75174f284c48c8b8afc118fad74e4 (patch)
treed456e57e6d0d0532592030cb0d3d20585b8fe7a4 /sw/qa/uitest/writer_tests4/tdf108124.py
parent6ed12ab2d0742f86ce25defec3c776562dbfad9a (diff)
tdf#121300 sw: consistent fly at-pargraph selection
As a follow-up to commit 28b77c89dfcafae82cf2a6d85731b643ff9290e5, add IsSelectFrameAnchoredAtPara() function and use it to harmonize at-para fly selection across all relevant operations: * CopyImpl: - it had a pre-existing bugs that would lose a fly anchored to the 2nd (1st fully selected) node of a redline - remove a bunch of code for finding the last node of the body content, which doesn't matter for the remaining at-fly checks - flys that already existed at the insert position need to have their anchors corrected * DeleteRange: - get rid of the bDelFwrd checks * MoveRange: - the ALLFLYS flag would be obsoleted by the new selection, were it not for the writerfiler "special hack", see below * also adapt A11y and UI selection, SwRootFrame::CalcFrameRects() The selection behavior is changed: * the bDelFwrd case is quite odd, some code was checking whether a deletion was "forward" or "backward" and removing only the flys at the point node while retaining the flys at the mark node; this worked in a very non-obvious way relying on sw_GetJoinFlags actually calling Exchange() on the cursor, and then SwUndoDelete stored it in m_bJoinNext, but it turns out that only SwUndoMove also has a m_bJoinNext and it's dead, and no other Undo has such a flag, so this only worked for "delete". It's not obvious what the value of this is, let's just ignore the "direction". * Selections exclude the start and end position except if it's a fully selected node or at the start or end of a section (i.e. Ctrl+A should also select every at-para fly). * An exception is made in case the selection looks like it's a backspace/delete joining 2 paragraphs; flys are not deleted in that case because it seemed annoying (and as it happens, Word does not appear to delete flys in that case), particularly if both of the nodes are already empty. This is done with a heuristic, it's conceivable to pass down some flag from DelLeft()/DelRight() but probably this is good enough. A special hack is needed to keep writerfilter happy for now; it likes to anchor flys at nodes which it then deletes in RemoveLastParagraph(), which likely could be improved there. The ALLFLYS usage in SwRangeRedline::MoveFromSection() could be removed (because the end-of-section check already handles the case) except for this, because it turns out that the ODF import runs SetRedlineFlags with a temporarily reset IsInXMLImport() flag because of its effect in thints.cxx, so during the move IsSelectFrameAnchoredAtPara() can't check it. tdf#108124 scenario works better, now everything that's selected is both copied and deleted. Fixes the problem where an at-para fly at the 2nd node of a redline where the 1st node is partially deleted was lost on ODF export. Change-Id: I168013665e70ff0a5f198e09f3fa3afc06ba0449 Reviewed-on: https://gerrit.libreoffice.org/84576 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/qa/uitest/writer_tests4/tdf108124.py')
-rw-r--r--sw/qa/uitest/writer_tests4/tdf108124.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/sw/qa/uitest/writer_tests4/tdf108124.py b/sw/qa/uitest/writer_tests4/tdf108124.py
index 168f51bff33a..929a3d7b498d 100644
--- a/sw/qa/uitest/writer_tests4/tdf108124.py
+++ b/sw/qa/uitest/writer_tests4/tdf108124.py
@@ -28,11 +28,22 @@ class tdf108124(UITestCase):
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+a"})) # select all
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+c"})) # copy
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+v"})) # paste
- self.assertEqual(document.GraphicObjects.getCount(), 4)
+ self.assertEqual(document.GraphicObjects.getCount(), 2)
+ xObj1Old = document.GraphicObjects[0]
+ xObj2Old = document.GraphicObjects[1]
self.xUITest.executeCommand(".uno:Undo") #Undo
self.assertEqual(document.GraphicObjects.getCount(), 2)
+ xObj1New = document.GraphicObjects[0]
+ xObj2New = document.GraphicObjects[1]
+ # there should be 2 different objects now but they have the same names,
+ # so rely on the object identity for testing...
+ self.assertNotEqual(xObj1Old, xObj1New)
+ self.assertNotEqual(xObj1Old, xObj2New)
+ self.assertNotEqual(xObj2Old, xObj1New)
+ self.assertNotEqual(xObj2Old, xObj2New)
self.xUITest.executeCommand(".uno:Redo") #Redo
- self.assertEqual(document.GraphicObjects.getCount(), 4)
+ self.assertEqual(document.GraphicObjects.getCount(), 2)
self.ui_test.close_doc()
+
# vim: set shiftwidth=4 softtabstop=4 expandtab: