Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sw / qa / uitest / writer_tests / trackedChanges.py
blob5bc8fecf7b03aacff26a4a84fdf6c6e91f981cb7
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 # tests for tracked changes ; tdf912270
8 from uitest.framework import UITestCase
9 from uitest.debug import sleep
10 import time
11 from uitest.uihelper.common import get_state_as_dict, type_text
13 class trackedchanges(UITestCase):
15 def test_tdf91270(self):
17 self.ui_test.create_doc_in_start_center("writer")
19 xWriterDoc = self.xUITest.getTopFocusWindow()
20 xWriterEdit = xWriterDoc.getChild("writer_edit")
21 type_text(xWriterEdit, "Test")
23 self.xUITest.executeCommand(".uno:TrackChanges")
25 selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text
26 self.xUITest.executeCommand(".uno:Cut") #cut text
28 self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
29 xTrackDlg = self.xUITest.getTopFocusWindow()
30 xCancBtn = xTrackDlg.getChild("close")
31 xCancBtn.executeAction("CLICK", tuple())
33 self.ui_test.close_doc()
35 def test_tracked_changes_accept(self):
37 self.ui_test.create_doc_in_start_center("writer")
38 document = self.ui_test.get_component()
39 xWriterDoc = self.xUITest.getTopFocusWindow()
40 xWriterEdit = xWriterDoc.getChild("writer_edit")
42 self.xUITest.executeCommand(".uno:TrackChanges")
43 type_text(xWriterEdit, "Test LibreOffice")
44 self.xUITest.executeCommand(".uno:ShowTrackedChanges")
46 self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
47 xTrackDlg = self.xUITest.getTopFocusWindow()
48 xAccBtn = xTrackDlg.getChild("accept")
49 xAccBtn.executeAction("CLICK", tuple())
50 xCancBtn = xTrackDlg.getChild("close")
51 xCancBtn.executeAction("CLICK", tuple())
53 self.assertEqual(document.Text.String[0:16], "Test LibreOffice")
54 self.ui_test.close_doc()
56 def test_tracked_changes_acceptall(self):
58 self.ui_test.create_doc_in_start_center("writer")
59 document = self.ui_test.get_component()
60 xWriterDoc = self.xUITest.getTopFocusWindow()
61 xWriterEdit = xWriterDoc.getChild("writer_edit")
63 self.xUITest.executeCommand(".uno:TrackChanges")
64 type_text(xWriterEdit, "Test LibreOffice")
65 self.xUITest.executeCommand(".uno:ShowTrackedChanges")
67 self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
68 xTrackDlg = self.xUITest.getTopFocusWindow()
70 xAccBtn = xTrackDlg.getChild("acceptall")
71 xAccBtn.executeAction("CLICK", tuple())
72 xCancBtn = xTrackDlg.getChild("close")
73 xCancBtn.executeAction("CLICK", tuple())
76 self.assertEqual(document.Text.String[0:16], "Test LibreOffice")
77 self.ui_test.close_doc()
79 def test_tracked_changes_reject(self):
81 self.ui_test.create_doc_in_start_center("writer")
82 document = self.ui_test.get_component()
83 xWriterDoc = self.xUITest.getTopFocusWindow()
84 xWriterEdit = xWriterDoc.getChild("writer_edit")
86 self.xUITest.executeCommand(".uno:TrackChanges")
87 type_text(xWriterEdit, "Test LibreOffice")
88 self.xUITest.executeCommand(".uno:ShowTrackedChanges")
90 self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
91 xTrackDlg = self.xUITest.getTopFocusWindow()
93 xRejBtn = xTrackDlg.getChild("reject")
94 xRejBtn.executeAction("CLICK", tuple())
95 xCancBtn = xTrackDlg.getChild("close")
96 xCancBtn.executeAction("CLICK", tuple())
98 self.assertEqual(document.Text.String[0:1], "")
99 self.ui_test.close_doc()
101 def test_tracked_changes_rejectall(self):
103 self.ui_test.create_doc_in_start_center("writer")
104 document = self.ui_test.get_component()
105 xWriterDoc = self.xUITest.getTopFocusWindow()
106 xWriterEdit = xWriterDoc.getChild("writer_edit")
108 self.xUITest.executeCommand(".uno:TrackChanges")
109 type_text(xWriterEdit, "Test LibreOffice")
110 self.xUITest.executeCommand(".uno:ShowTrackedChanges")
112 self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
113 xTrackDlg = self.xUITest.getTopFocusWindow()
115 xAccBtn = xTrackDlg.getChild("rejectall")
116 xAccBtn.executeAction("CLICK", tuple())
117 xCancBtn = xTrackDlg.getChild("close")
118 xCancBtn.executeAction("CLICK", tuple())
120 self.assertEqual(document.Text.String[0:1], "")
121 self.ui_test.close_doc()
123 def test_tracked_changes_zprev_next(self):
125 self.ui_test.create_doc_in_start_center("writer")
126 document = self.ui_test.get_component()
127 xWriterDoc = self.xUITest.getTopFocusWindow()
128 xWriterEdit = xWriterDoc.getChild("writer_edit")
130 self.xUITest.executeCommand(".uno:TrackChanges")
131 type_text(xWriterEdit, "Test LibreOffice")
132 self.xUITest.executeCommand(".uno:TrackChanges")
133 type_text(xWriterEdit, " Test2")
134 self.xUITest.executeCommand(".uno:TrackChanges")
135 type_text(xWriterEdit, " Test3")
136 self.xUITest.executeCommand(".uno:TrackChanges")
137 type_text(xWriterEdit, " Test4")
138 self.xUITest.executeCommand(".uno:TrackChanges")
139 type_text(xWriterEdit, " Test5")
140 self.xUITest.executeCommand(".uno:PreviousTrackedChange")
141 self.xUITest.executeCommand(".uno:RejectTrackedChange")
142 self.assertEqual(document.Text.String[0:37], "Test LibreOffice Test2 Test3 Test4")
144 self.xUITest.executeCommand(".uno:PreviousTrackedChange")
145 self.xUITest.executeCommand(".uno:PreviousTrackedChange")
146 self.xUITest.executeCommand(".uno:AcceptTrackedChange")
147 self.assertEqual(document.Text.String[0:37], "Test LibreOffice Test2 Test3 Test4")
149 self.xUITest.executeCommand(".uno:NextTrackedChange")
150 self.xUITest.executeCommand(".uno:RejectTrackedChange")
151 self.assertEqual(document.Text.String[0:30], "Test LibreOffice Test2 Test4")
153 self.ui_test.close_doc()
154 # vim: set shiftwidth=4 softtabstop=4 expandtab: