diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-25 19:39:17 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-26 07:25:59 +0200 |
commit | 1db375e06516d0532f01f9585986617aa3079866 (patch) | |
tree | ea65aaa7220940510f86c37533e1c6d89b3c89e1 /uitest | |
parent | f2e781c92bb96d626cf7a75c134f339a8a95d183 (diff) |
uitest: introduce load_empty_file
to make sure the documents are closed in inverse order when
different documents are used in the same test
Change-Id: I97ff33f9f91423d06f4e74bba6fc6a5312b24a17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117914
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/uitest/test.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py index e8238f790d6b..633e6816e7fd 100644 --- a/uitest/uitest/test.py +++ b/uitest/uitest/test.py @@ -74,8 +74,8 @@ class UITest(object): raise Exception("Property not updated: " + childName) @contextmanager - def wait_until_component_loaded(self): - with EventListener(self._xContext, "OnLoad") as event: + def wait_until_component_loaded(self, eventName="OnLoad"): + with EventListener(self._xContext, eventName) as event: yield time_ = 0 while time_ < MAX_WAIT: @@ -99,6 +99,15 @@ class UITest(object): finally: self.close_doc() + # Calls UITest.close_doc at exit + @contextmanager + def load_empty_file(self, app): + try: + with self.wait_until_component_loaded("OnNew"): + yield self.get_desktop().loadComponentFromURL("private:factory/s" + app, "_blank", 0, tuple()) + finally: + self.close_doc() + def execute_dialog_through_command(self, command, printNames=False): with EventListener(self._xContext, "DialogExecute", printNames=printNames) as event: if not self._xUITest.executeDialog(command): |