1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 from uitest
.framework
import UITestCase
11 from uitest
.uihelper
.common
import get_state_as_dict
, get_url_for_data_file
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
14 class tdf150443(UITestCase
):
16 def test_tdf150443(self
):
17 with self
.ui_test
.load_file(get_url_for_data_file("tdf150443.docx")):
18 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
19 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
20 xToolkit
= self
.xContext
.ServiceManager
.createInstance('com.sun.star.awt.Toolkit')
22 # search term "Jump here!"
23 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button
="close") as xDialog
:
24 searchterm
= xDialog
.getChild("searchterm")
25 searchterm
.executeAction("TYPE", mkPropertyValues({"TEXT":"Jump here!"}))
26 xsearch
= xDialog
.getChild("search")
27 xsearch
.executeAction("CLICK", tuple()) #first search
28 xToolkit
.processEventsToIdle()
29 self
.assertEqual(get_state_as_dict(xWriterEdit
)["CurrentPage"], "4")
31 # reject the tracked table row in Manage Changes dialog window
32 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button
="close") as xTrackDlg
:
33 changesList
= xTrackDlg
.getChild("writerchanges")
35 items
= len(changesList
.getChildren())
37 # select tree parent of the actual tracked row deletion in tree list
38 changesList
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
39 xToolkit
.processEventsToIdle()
41 # Without the fix in place, it would have crashed here
42 xAccBtn
= xTrackDlg
.getChild("reject")
43 xAccBtn
.executeAction("CLICK", tuple())
44 self
.assertEqual(items
- 1, len(changesList
.getChildren()))
46 # vim: set shiftwidth=4 softtabstop=4 expandtab: