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/.
7 from uitest
.framework
import UITestCase
8 from uitest
.uihelper
.common
import get_state_as_dict
9 from uitest
.uihelper
.common
import select_pos
10 from uitest
.uihelper
.calc
import enter_text_to_cell
11 from libreoffice
.calc
.document
import get_cell_by_position
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
14 #Bug 125051 - EDITING: CRASH when start SpellCheck
16 class tdf125051(UITestCase
):
17 def test_tdf125051_crash_spelling_dialog(self
):
18 calc_doc
= self
.ui_test
.create_doc_in_start_center("calc")
19 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
20 gridwin
= xCalcDoc
.getChild("grid_window")
21 document
= self
.ui_test
.get_component()
22 enter_text_to_cell(gridwin
, "A1", "text")
23 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
24 self
.ui_test
.execute_dialog_through_command(".uno:SpellDialog")
25 xDialog
= self
.xUITest
.getTopFocusWindow() #Spelling dialog
27 xDialog2
= self
.xUITest
.getTopFocusWindow() # info dialog "The spellcheck of this sheet has been completed.-> OK"
28 okBtn
= xDialog
.getChild("ok")
29 self
.ui_test
.close_dialog_through_button(okBtn
)
31 xDialog
= self
.xUITest
.getTopFocusWindow() #Spelling dialog
33 optionsBtn
= xDialog
.getChild("options")
34 def handle_options_dlg(dialog
):
35 #print(dialog.getChildren())
36 xCancelBtn
= dialog
.getChild("cancel")
37 self
.ui_test
.close_dialog_through_button(xCancelBtn
)
39 self
.ui_test
.execute_blocking_action(optionsBtn
.executeAction
, args
=('CLICK', ()),
40 dialog_handler
=handle_options_dlg
)
42 closeBtn
= xDialog
.getChild("close") #close Spelling dialog
43 self
.ui_test
.close_dialog_through_button(closeBtn
)
45 #verify, we didn't crash
46 self
.assertEqual(get_cell_by_position(document
, 0, 0, 0).getString(), "text")
48 self
.ui_test
.close_doc()
50 # vim: set shiftwidth=4 softtabstop=4 expandtab: