diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-29 22:35:46 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-30 13:17:07 +0200 |
commit | f7300b2f07f308118967c797206dbc4a1e9a61a4 (patch) | |
tree | 6952440b9cb4849e70aafdc6e0f68df4a2767827 /uitest | |
parent | 6e8c9047f4bf6194bd1423422bd2dc9f92c50725 (diff) |
uitest: guard create_doc_in_start_center in sd
Mostly done by a script
for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac
< UITest: introduce guarded context managers >
Change-Id: I314f3e2245bf57538073499f60528a455cba1a91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118138
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/uitest/test.py | 10 | ||||
-rw-r--r-- | uitest/uitest/uihelper/guarded.py | 22 |
2 files changed, 10 insertions, 22 deletions
diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py index 8b7b5a4c98f8..15cdce4654f0 100644 --- a/uitest/uitest/test.py +++ b/uitest/uitest/test.py @@ -175,6 +175,16 @@ class UITest(object): self.close_dialog_through_button(xCancelBtn) return True + # Calls UITest.close_doc at exit + @contextmanager + def create_doc_in_start_center_guarded(self, app): + self.create_doc_in_start_center(app) + component = self.get_component() + try: + yield component + finally: + self.close_doc() + def create_doc_in_start_center(self, app): xStartCenter = self._xUITest.getTopFocusWindow() try: diff --git a/uitest/uitest/uihelper/guarded.py b/uitest/uitest/uihelper/guarded.py deleted file mode 100644 index 67a11137357d..000000000000 --- a/uitest/uitest/uihelper/guarded.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -from contextlib import contextmanager - -# Calls UITest.close_doc at exit -@contextmanager -def create_doc_in_start_center(testCase, app): - testCase.ui_test.create_doc_in_start_center(app) - component = testCase.ui_test.get_component() - try: - yield component - finally: - testCase.ui_test.close_doc() - -# vim: set shiftwidth=4 softtabstop=4 expandtab: |