summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-28 10:43:26 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-29 13:24:24 +0200
commitbeeb10a097cdb44af931b92d2849a7e4d09414c0 (patch)
treeec33840c366d622ff2ac3fe2b66c9cb0928a2b12 /uitest
parent2a1725fbc248ccaccbe754b5f62a02f99e077290 (diff)
uitest: guard execute_dialog_through_command in sd
Mostly done with a script for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac < UITest: introduce guarded context managers > Change-Id: I162dcf802474a27580cfbe9349d1a48d3a111c9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117999 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'uitest')
-rw-r--r--uitest/uitest/test.py10
-rw-r--r--uitest/uitest/uihelper/guarded.py10
2 files changed, 10 insertions, 10 deletions
diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py
index 633e6816e7fd..d4a953715978 100644
--- a/uitest/uitest/test.py
+++ b/uitest/uitest/test.py
@@ -118,6 +118,16 @@ class UITest(object):
return
time.sleep(DEFAULT_SLEEP)
+ # Calls UITest.close_dialog_through_button at exit
+ @contextmanager
+ def execute_dialog_through_command_guarded(self, command, printNames=False, close_button = "ok"):
+ self.execute_dialog_through_command(command, printNames)
+ xDialog = self._xUITest.getTopFocusWindow()
+ try:
+ yield xDialog
+ finally:
+ self.close_dialog_through_button(xDialog.getChild(close_button))
+
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):
diff --git a/uitest/uitest/uihelper/guarded.py b/uitest/uitest/uihelper/guarded.py
index f6e91b0f5088..67a11137357d 100644
--- a/uitest/uitest/uihelper/guarded.py
+++ b/uitest/uitest/uihelper/guarded.py
@@ -19,14 +19,4 @@ def create_doc_in_start_center(testCase, app):
finally:
testCase.ui_test.close_doc()
-# Calls UITest.close_dialog_through_button at exit
-@contextmanager
-def execute_dialog_through_command(testCase, command, printNames=False, close_button = "ok"):
- testCase.ui_test.execute_dialog_through_command(command, printNames)
- xDialog = testCase.xUITest.getTopFocusWindow()
- try:
- yield xDialog
- finally:
- testCase.ui_test.close_dialog_through_button(xDialog.getChild(close_button))
-
# vim: set shiftwidth=4 softtabstop=4 expandtab: