summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2021-04-09 17:32:56 -0400
committerHenry Castro <hcastro@collabora.com>2021-06-07 20:13:04 +0200
commit7f49c4eea51c6c84ee7adacd5ba45e1e0fc4c1f7 (patch)
tree2b4a22e44836f9cf3020eef505649edf24b070df /uitest
parent6004f17ae68cc6c15ef9cc96cc502dd4a09d6cf1 (diff)
sw/qa/uitest: close the dialog if thrown an exception
if a unit test opens a dialog and exception is thrown if does not exist a control, the terminate() method fails, the unit test will wait indefinitely for the subprocess to terminate. Change-Id: I6dc77b2db8ce042ead78d13ce57e91892cd2db90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113896 Tested-by: Jenkins Reviewed-by: Henry Castro <hcastro@collabora.com>
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: