summaryrefslogtreecommitdiff
path: root/sw/qa/uitest/table/insertTableDialog.py
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-28 21:21:47 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-29 13:25:57 +0200
commit8b961addb7887a8b8dc8dbc6758c3dc7c1068ac4 (patch)
tree7314f1340c336d5fc0e39bd12c5701ed52309bef /sw/qa/uitest/table/insertTableDialog.py
parent279ab35ad07a958b5b8d7d593b9817e7365b9bb5 (diff)
uitest: guard execute_dialog_through_command in sw
Mostly done with a script for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac < UITest: introduce guarded context managers > Change-Id: I9def7e8fd8256c3131ca2904f78976b9cd59aa96 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118037 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/uitest/table/insertTableDialog.py')
-rw-r--r--sw/qa/uitest/table/insertTableDialog.py44
1 files changed, 17 insertions, 27 deletions
diff --git a/sw/qa/uitest/table/insertTableDialog.py b/sw/qa/uitest/table/insertTableDialog.py
index 427920e1985c..ac4d45a10fc4 100644
--- a/sw/qa/uitest/table/insertTableDialog.py
+++ b/sw/qa/uitest/table/insertTableDialog.py
@@ -14,28 +14,24 @@ class WriterInsertTableDialog(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable") as xDialog:
- xNameEdit = xDialog.getChild("nameedit")
+ xNameEdit = xDialog.getChild("nameedit")
- xNameEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xNameEdit.executeAction("TYPE", mkPropertyValues({"TEXT": name}))
+ xNameEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xNameEdit.executeAction("TYPE", mkPropertyValues({"TEXT": name}))
- xColSpin = xDialog.getChild("colspin")
- xColSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xColSpin.executeAction("TYPE", mkPropertyValues({"TEXT": str(cols)}))
+ xColSpin = xDialog.getChild("colspin")
+ xColSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xColSpin.executeAction("TYPE", mkPropertyValues({"TEXT": str(cols)}))
- xRowSpin = xDialog.getChild("rowspin")
- xRowSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xRowSpin.executeAction("TYPE", mkPropertyValues({"TEXT": str(rows)}))
+ xRowSpin = xDialog.getChild("rowspin")
+ xRowSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xRowSpin.executeAction("TYPE", mkPropertyValues({"TEXT": str(rows)}))
- self.assertEqual(get_state_as_dict(xNameEdit)["Text"], name)
- self.assertEqual(get_state_as_dict(xColSpin)["Text"], str(cols))
- self.assertEqual(get_state_as_dict(xRowSpin)["Text"], str(rows))
-
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xNameEdit)["Text"], name)
+ self.assertEqual(get_state_as_dict(xColSpin)["Text"], str(cols))
+ self.assertEqual(get_state_as_dict(xRowSpin)["Text"], str(rows))
document = self.ui_test.get_component()
@@ -53,21 +49,15 @@ class WriterInsertTableDialog(UITestCase):
self.insert_table("Test3", 2, 2)
- self.ui_test.execute_dialog_through_command(".uno:TableNumberFormatDialog")
-
- xNumberFormatDlg = self.xUITest.getTopFocusWindow()
-
- xOkBtn = xNumberFormatDlg.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:TableNumberFormatDialog"):
+ pass
self.ui_test.close_doc()
def test_cancel_button_insert_table_dialog(self):
self.ui_test.create_doc_in_start_center("writer")
- self.ui_test.execute_dialog_through_command(".uno:InsertTable")
- Dialog = self.xUITest.getTopFocusWindow()
- CancelBtn = Dialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(CancelBtn)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:InsertTable", close_button="cancel"):
+ pass
document = self.ui_test.get_component()
tables = document.getTextTables()