diff options
Diffstat (limited to 'sc/qa/uitest/range_name/tdf119954.py')
-rw-r--r-- | sc/qa/uitest/range_name/tdf119954.py | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/sc/qa/uitest/range_name/tdf119954.py b/sc/qa/uitest/range_name/tdf119954.py index 78b844c4ea13..f90c73fe097d 100644 --- a/sc/qa/uitest/range_name/tdf119954.py +++ b/sc/qa/uitest/range_name/tdf119954.py @@ -30,30 +30,23 @@ class tdf119954(UITestCase): # => see that the formula is =aaa instead of =bbb gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") - xDefineNameDlg = self.xUITest.getTopFocusWindow() - - xEntryBox = xDefineNameDlg.getChild("entry") - type_text(xEntryBox, "aaa") - add = xDefineNameDlg.getChild("add") - assign = xDefineNameDlg.getChild("assign") - add.executeAction("CLICK", tuple()) - xOkBtn = xDefineNameDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DefineDBName") as xDefineNameDlg: + xEntryBox = xDefineNameDlg.getChild("entry") + type_text(xEntryBox, "aaa") + add = xDefineNameDlg.getChild("add") + assign = xDefineNameDlg.getChild("assign") + add.executeAction("CLICK", tuple()) gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") - xDefineNameDlg = self.xUITest.getTopFocusWindow() - xEntryBox = xDefineNameDlg.getChild("entry") - assign = xDefineNameDlg.getChild("assign") - select_all(xEntryBox) - type_text(xEntryBox, "bbb") - select_all(assign) - type_text(assign, "$Sheet2.$C$3") - add.executeAction("CLICK", tuple()) - - xOkBtn = xDefineNameDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DefineDBName") as xDefineNameDlg: + xEntryBox = xDefineNameDlg.getChild("entry") + add = xDefineNameDlg.getChild("add") + assign = xDefineNameDlg.getChild("assign") + select_all(xEntryBox) + type_text(xEntryBox, "bbb") + select_all(assign) + type_text(assign, "$Sheet2.$C$3") + add.executeAction("CLICK", tuple()) enter_text_to_cell(gridwin, "B2", "=bbb") gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) @@ -71,9 +64,7 @@ class tdf119954(UITestCase): self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getFormula(), "") # check cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") - xDefineNameDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xDefineNameDlg.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DefineDBName", close_button="cancel"): + pass # vim: set shiftwidth=4 softtabstop=4 expandtab: |