diff options
author | László Németh <nemeth@numbertext.org> | 2023-06-22 17:33:16 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2023-06-23 10:29:33 +0200 |
commit | 952fb2a4386a6ae2187b646e372131a5345f59fe (patch) | |
tree | 9600775ff0219aed8348d2c1b8e571ec70b8232a /sw/qa/uitest | |
parent | bbb104ea2b8f3e48273f316cfad406e904a2f331 (diff) |
tdf#155847 sw tracked table column: fix crash in Manage Changes
In Manage Changes dialog window, accept/Reject multiple tracked
table columns need major tree list update because of not continuous
redline ranges in the child lists of the multiple tree list parents,
otherwise assert/crash could occur.
Follow-up to commit 4a40a42afc3ba551e6e58947fc2e44689979b629
"tdf#155847 sw tracked table column: manage multiple changes".
Change-Id: I3c7f61d35cbb433067c1f4fd28b80ad7da8ba12e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153464
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa/uitest')
-rw-r--r-- | sw/qa/uitest/writer_tests/trackedChanges.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py b/sw/qa/uitest/writer_tests/trackedChanges.py index 0b0c38d27533..8681140bb695 100644 --- a/sw/qa/uitest/writer_tests/trackedChanges.py +++ b/sw/qa/uitest/writer_tests/trackedChanges.py @@ -597,4 +597,69 @@ class trackedchanges(UITestCase): self.assertEqual(0, len(changesList.getChildren())) + def test_tdf155847_multiple_tracked_columns_crash(self): + with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + # accept all changes and insert new columns with change tracking + self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges") + tables = document.getTextTables() + self.assertEqual(2, len(tables)) + self.assertEqual(len(tables[0].getColumns()), 3) + self.xUITest.executeCommand(".uno:InsertColumnsAfter") + self.xUITest.executeCommand(".uno:DeleteColumns") + self.assertEqual(len(tables[0].getColumns()), 4) + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + # check and reject changes + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + changesList = xTrackDlg.getChild("writerchanges") + + # six changes, but only one visible in the Manage Changes dialog window + state = get_state_as_dict(changesList) + self.assertEqual(state['Children'], '6') + + # This was 4 (missing handling of multiple different columns) + self.assertEqual(state['VisibleCount'], '2') + # Now: 2 changes (deleted and inserted columns) + self.assertEqual(2, len(changesList.getChildren())) + + # select second tracked table column in tree list + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + + # while not empty, i.e. starts with CH_TXT_TRACKED_DUMMY_CHAR + while len(get_state_as_dict(xWriterEdit)["SelectedText"]): + xToolkit.processEventsToIdle() + + # reject column insertion + + xAccBtn = xTrackDlg.getChild("reject") + # Without the fix in place, it would have crashed here + xAccBtn.executeAction("CLICK", tuple()) + + # inserted column is removed + + self.assertEqual(len(tables[0].getColumns()), 3) + + # single parent left in the dialog window + self.assertEqual(1, len(changesList.getChildren())) + + # accept column deletion + + xAccBtn = xTrackDlg.getChild("accept") + xAccBtn.executeAction("CLICK", tuple()) + + # deleted column is removed + + self.assertEqual(len(tables[0].getColumns()), 2) + + # no changes in the dialog window + + self.assertEqual(0, len(changesList.getChildren())) + # vim: set shiftwidth=4 softtabstop=4 expandtab: |