diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-29 11:35:20 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-29 13:26:30 +0200 |
commit | 8fe4a2cb1ad3b4819e069179cc11430c5127613c (patch) | |
tree | f8265029a84d6a97b9abbe90ab66599749892fa0 /svx/qa | |
parent | 8b961addb7887a8b8dc8dbc6758c3dc7c1068ac4 (diff) |
uitest: guard remaining execute_dialog_through_command
Mostly done with a script
for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac
< UITest: introduce guarded context managers >
Change-Id: Ib8e7c5f5e2c9b8a7756fe533ea4f30349dd68761
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118076
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svx/qa')
-rw-r--r-- | svx/qa/uitest/table/tablecontroller.py | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/svx/qa/uitest/table/tablecontroller.py b/svx/qa/uitest/table/tablecontroller.py index 607df44a3a4f..1b6989f039dd 100644 --- a/svx/qa/uitest/table/tablecontroller.py +++ b/svx/qa/uitest/table/tablecontroller.py @@ -22,14 +22,12 @@ class SvxTableControllerTest(UITestCase): self.xUITest.executeCommand(".uno:InsertTable?Columns:short=2&Rows:short=2") # Enable shadow. - self.ui_test.execute_dialog_through_command(".uno:TableDialog") - tableDialog = self.xUITest.getTopFocusWindow() - tabs = tableDialog.getChild("tabcontrol") - # Select "shadow". - select_pos(tabs, "4") - shadowCheckbox = tableDialog.getChild("TSB_SHOW_SHADOW") - shadowCheckbox.executeAction("CLICK", tuple()) - self.ui_test.close_dialog_through_button(tableDialog.getChild("ok")) + with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as tableDialog: + tabs = tableDialog.getChild("tabcontrol") + # Select "shadow". + select_pos(tabs, "4") + shadowCheckbox = tableDialog.getChild("TSB_SHOW_SHADOW") + shadowCheckbox.executeAction("CLICK", tuple()) # Check if the shadow was enabled. component = self.ui_test.get_component() @@ -61,14 +59,12 @@ class SvxTableControllerTest(UITestCase): impress.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+TAB"})) impress.executeAction("TYPE", mkPropertyValues({"TEXT": "A3"})) self.xUITest.executeCommand(".uno:SelectAll") - self.ui_test.execute_dialog_through_command(".uno:TableDialog") - tableDialog = self.xUITest.getTopFocusWindow() - tabs = tableDialog.getChild("tabcontrol") - # Select "shadow". - select_pos(tabs, "4") - shadowCheckbox = tableDialog.getChild("TSB_SHOW_SHADOW") - shadowCheckbox.executeAction("CLICK", tuple()) - self.ui_test.close_dialog_through_button(tableDialog.getChild("ok")) + with self.ui_test.execute_dialog_through_command_guarded(".uno:TableDialog") as tableDialog: + tabs = tableDialog.getChild("tabcontrol") + # Select "shadow". + select_pos(tabs, "4") + shadowCheckbox = tableDialog.getChild("TSB_SHOW_SHADOW") + shadowCheckbox.executeAction("CLICK", tuple()) # Then make sure we don't crash: # Without the accompanying fix in place, this test would have failed crashed due to a |