summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-09-12 21:13:00 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-09-13 10:37:55 +0200
commit714278ce47692d57965b06e8b83de632e6e97d2d (patch)
tree0303b88c76abdba5c2d16bacc21aef94a22df831 /uitest
parent1301d8461ec5112ad8bc672dd1ac141238a29cef (diff)
uitest: guard the remaining execute_modeless_dialog_through_command
Change-Id: I239fe94cc8983e679c82aa43d74d8099b13e73b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122011 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'uitest')
-rw-r--r--uitest/demo_ui/combobox.py9
-rw-r--r--uitest/demo_ui/edit.py28
-rw-r--r--uitest/demo_ui/tabcontrol.py9
-rw-r--r--uitest/demo_ui/treelist.py17
4 files changed, 24 insertions, 39 deletions
diff --git a/uitest/demo_ui/combobox.py b/uitest/demo_ui/combobox.py
index 50aa2b40d6ff..d2e8491c161c 100644
--- a/uitest/demo_ui/combobox.py
+++ b/uitest/demo_ui/combobox.py
@@ -16,14 +16,11 @@ class ComboBoxTest(UITestCase):
with self.ui_test.create_doc_in_start_center("calc"):
- self.ui_test.execute_modeless_dialog_through_command(".uno:AddName")
- xAddNameDlg = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AddName", close_button="cancel") as xAddNameDlg:
- scopeCB = xAddNameDlg.getChild("scope")
- select_pos(scopeCB, "1")
+ scopeCB = xAddNameDlg.getChild("scope")
+ select_pos(scopeCB, "1")
- xCancelBtn = xAddNameDlg.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/edit.py b/uitest/demo_ui/edit.py
index 75d20b6afc6f..94b86c639d0a 100644
--- a/uitest/demo_ui/edit.py
+++ b/uitest/demo_ui/edit.py
@@ -18,36 +18,30 @@ class EditTest(UITestCase):
with self.ui_test.create_doc_in_start_center("calc"):
- self.ui_test.execute_modeless_dialog_through_command(".uno:AddName")
- xAddNameDlg = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AddName", close_button="cancel") as xAddNameDlg:
- xEdit = xAddNameDlg.getChild("edit")
+ xEdit = xAddNameDlg.getChild("edit")
- type_text(xEdit, "simpleRangeName")
+ type_text(xEdit, "simpleRangeName")
- xAddBtn = xAddNameDlg.getChild("cancel")
- self.ui_test.close_dialog_through_button(xAddBtn)
def test_select_text(self):
with self.ui_test.create_doc_in_start_center("calc"):
- self.ui_test.execute_modeless_dialog_through_command(".uno:AddName")
- xAddNameDlg = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AddName", close_button="cancel") as xAddNameDlg:
- xEdit = xAddNameDlg.getChild("edit")
+ xEdit = xAddNameDlg.getChild("edit")
- type_text(xEdit, "simpleRangeName")
- xEdit.executeAction("SELECT", mkPropertyValues({"FROM": "2", "TO": "9"}))
- type_text(xEdit, "otherChars")
- self.assertEqual("siotherCharsgeName", get_state_as_dict(xEdit)["Text"])
+ type_text(xEdit, "simpleRangeName")
+ xEdit.executeAction("SELECT", mkPropertyValues({"FROM": "2", "TO": "9"}))
+ type_text(xEdit, "otherChars")
+ self.assertEqual("siotherCharsgeName", get_state_as_dict(xEdit)["Text"])
- select_text(xEdit, from_pos="2", to="12")
- self.assertEqual("otherChars", get_state_as_dict(xEdit)["SelectedText"])
+ select_text(xEdit, from_pos="2", to="12")
+ self.assertEqual("otherChars", get_state_as_dict(xEdit)["SelectedText"])
- xAddBtn = xAddNameDlg.getChild("cancel")
- self.ui_test.close_dialog_through_button(xAddBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/tabcontrol.py b/uitest/demo_ui/tabcontrol.py
index eb93339eb391..505bd5690b87 100644
--- a/uitest/demo_ui/tabcontrol.py
+++ b/uitest/demo_ui/tabcontrol.py
@@ -23,15 +23,12 @@ class TabControlTest(UITestCase):
enter_text_to_cell(xGridWindow, "B2", "=2+3+4")
xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"}))
- self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog")
+ with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:FunctionDialog", close_button="cancel") as xFunctionDlg:
- xFunctionDlg = self.xUITest.getTopFocusWindow()
- xTabs = xFunctionDlg.getChild("tabcontrol")
- select_pos(xTabs, "1")
+ xTabs = xFunctionDlg.getChild("tabcontrol")
+ select_pos(xTabs, "1")
- xCancelBtn = xFunctionDlg.getChild("cancel")
- xCancelBtn.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/treelist.py b/uitest/demo_ui/treelist.py
index baea77cf4ef6..eb6a90b8ef1e 100644
--- a/uitest/demo_ui/treelist.py
+++ b/uitest/demo_ui/treelist.py
@@ -23,23 +23,20 @@ class TreeListTest(UITestCase):
enter_text_to_cell(xGridWindow, "B2", "=2+3+4")
xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"}))
- self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog")
+ with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:FunctionDialog", close_button="cancel") as xFunctionDlg:
- xFunctionDlg = self.xUITest.getTopFocusWindow()
- xTabs = xFunctionDlg.getChild("tabcontrol")
- select_pos(xTabs, "1")
+ xTabs = xFunctionDlg.getChild("tabcontrol")
+ select_pos(xTabs, "1")
- xTreelist = xTabs.getChild("struct")
+ xTreelist = xTabs.getChild("struct")
- xTreeEntry = xTreelist.getChild('0')
+ xTreeEntry = xTreelist.getChild('0')
- xTreeEntry.executeAction("COLLAPSE", tuple())
+ xTreeEntry.executeAction("COLLAPSE", tuple())
- xTreeEntry.executeAction("EXPAND", tuple())
+ xTreeEntry.executeAction("EXPAND", tuple())
- xCancelBtn = xFunctionDlg.getChild("cancel")
- xCancelBtn.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab: