summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
Diffstat (limited to 'uitest')
-rw-r--r--uitest/uitest/uihelper/guarded.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/uitest/uitest/uihelper/guarded.py b/uitest/uitest/uihelper/guarded.py
index b7e5ce099d1e..871fa697d584 100644
--- a/uitest/uitest/uihelper/guarded.py
+++ b/uitest/uitest/uihelper/guarded.py
@@ -28,4 +28,14 @@ def execute_dialog_through_action(testCase, ui_object, action, parameters = None
finally:
testCase.ui_test.close_dialog_through_button(xDialog.getChild(close_button))
+# Calls UITest.close_dialog_through_button at exit
+@contextmanager
+def execute_dialog_through_command(testCase, unoCommand, close_button = "ok"):
+ testCase.ui_test.execute_dialog_through_command(unoCommand)
+ 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: