diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-09-12 21:16:40 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-09-13 10:38:27 +0200 |
commit | f75bae7082322a2e79997d041ce5f8afd3910107 (patch) | |
tree | e4820226bf00e8b5726a737c568c52961ae1bce9 /uitest | |
parent | 714278ce47692d57965b06e8b83de632e6e97d2d (diff) |
uitest: combine execute_modeless_dialog_through_command methods
Change-Id: Idada1927f6b8b55133e1ff8c776a987699df1dc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122012
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/demo_ui/combobox.py | 2 | ||||
-rw-r--r-- | uitest/demo_ui/edit.py | 4 | ||||
-rw-r--r-- | uitest/demo_ui/tabcontrol.py | 2 | ||||
-rw-r--r-- | uitest/demo_ui/treelist.py | 2 | ||||
-rw-r--r-- | uitest/uitest/test.py | 16 |
5 files changed, 6 insertions, 20 deletions
diff --git a/uitest/demo_ui/combobox.py b/uitest/demo_ui/combobox.py index d2e8491c161c..00080b3fa2b0 100644 --- a/uitest/demo_ui/combobox.py +++ b/uitest/demo_ui/combobox.py @@ -16,7 +16,7 @@ class ComboBoxTest(UITestCase): with self.ui_test.create_doc_in_start_center("calc"): - with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AddName", close_button="cancel") as xAddNameDlg: + with self.ui_test.execute_modeless_dialog_through_command(".uno:AddName", close_button="cancel") as xAddNameDlg: scopeCB = xAddNameDlg.getChild("scope") select_pos(scopeCB, "1") diff --git a/uitest/demo_ui/edit.py b/uitest/demo_ui/edit.py index 94b86c639d0a..e6ac12a7d8e9 100644 --- a/uitest/demo_ui/edit.py +++ b/uitest/demo_ui/edit.py @@ -18,7 +18,7 @@ class EditTest(UITestCase): with self.ui_test.create_doc_in_start_center("calc"): - with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AddName", close_button="cancel") as xAddNameDlg: + with self.ui_test.execute_modeless_dialog_through_command(".uno:AddName", close_button="cancel") as xAddNameDlg: xEdit = xAddNameDlg.getChild("edit") @@ -30,7 +30,7 @@ class EditTest(UITestCase): with self.ui_test.create_doc_in_start_center("calc"): - with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AddName", close_button="cancel") as xAddNameDlg: + with self.ui_test.execute_modeless_dialog_through_command(".uno:AddName", close_button="cancel") as xAddNameDlg: xEdit = xAddNameDlg.getChild("edit") diff --git a/uitest/demo_ui/tabcontrol.py b/uitest/demo_ui/tabcontrol.py index 505bd5690b87..883fecb0890b 100644 --- a/uitest/demo_ui/tabcontrol.py +++ b/uitest/demo_ui/tabcontrol.py @@ -23,7 +23,7 @@ class TabControlTest(UITestCase): enter_text_to_cell(xGridWindow, "B2", "=2+3+4") xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) - with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:FunctionDialog", close_button="cancel") as xFunctionDlg: + with self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog", close_button="cancel") as xFunctionDlg: xTabs = xFunctionDlg.getChild("tabcontrol") diff --git a/uitest/demo_ui/treelist.py b/uitest/demo_ui/treelist.py index eb6a90b8ef1e..a8461ad7f8f3 100644 --- a/uitest/demo_ui/treelist.py +++ b/uitest/demo_ui/treelist.py @@ -23,7 +23,7 @@ class TreeListTest(UITestCase): enter_text_to_cell(xGridWindow, "B2", "=2+3+4") xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) - with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:FunctionDialog", close_button="cancel") as xFunctionDlg: + with self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog", close_button="cancel") as xFunctionDlg: xTabs = xFunctionDlg.getChild("tabcontrol") diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py index 48ddf2833035..2dddd39038c4 100644 --- a/uitest/uitest/test.py +++ b/uitest/uitest/test.py @@ -126,24 +126,10 @@ class UITest(object): time.sleep(DEFAULT_SLEEP) @contextmanager - def execute_modeless_dialog_through_command_guarded(self, command, printNames=False, close_button = "ok"): + def execute_modeless_dialog_through_command(self, command, printNames=False, close_button = "ok"): with self.execute_dialog_through_command(command, printNames, close_button, "ModelessDialogVisible") as xDialog: yield xDialog - def execute_modeless_dialog_through_command(self, command, printNames=False): - with EventListener(self._xContext, "ModelessDialogVisible", printNames = printNames) as event: - if not self._xUITest.executeCommand(command): - raise Exception("Dialog not executed for: " + command) - time_ = 0 - while time_ < MAX_WAIT: - if event.executed: - time.sleep(DEFAULT_SLEEP) - return - time_ += DEFAULT_SLEEP - time.sleep(DEFAULT_SLEEP) - - raise Exception("Dialog not executed for: " + command) - # Calls UITest.close_dialog_through_button at exit @contextmanager def execute_dialog_through_action(self, ui_object, action, parameters = None, event_name = "DialogExecute", close_button = "ok"): |