uitest/uitest/test.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
New commits: commit 0deaf87f07a791eb7bc8f697863676b6677a9a6c Author: Neil Roberts <[email protected]> AuthorDate: Thu Nov 20 09:08:49 2025 +0100 Commit: Noel Grandin <[email protected]> CommitDate: Sat Nov 22 18:19:17 2025 +0100 UITest: Wait for idle in close_doc This is a follow-up to the commit below: commit a3546f2a045c84580e6c8b263d5f834a0058a732 Author: Neil Roberts <[email protected]> Date: Tue Nov 18 14:26:42 2025 +0100 uitest: Wait for idle when calling close_doc for a database doc I realised that it’s possible to trigger the race condition with the existing tdf99619_create_join_undo_redo test too. That one works by loading an existing document instead of creating an empty database so it isn’t fixed by the above commit. This patch moves the call to waitUntilAllIdlesDispatched into close_doc instead so that it will affect all UI tests. I can’t seem to trigger any race conditions with non-database tests but on the other hand I don’t think those tests are explicitly intending to test concurrent UI access so I don’t think it does any harm to make them wait as well. Change-Id: Icd49518fc8e7682a61548c1dd906bff2ed26d3c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194241 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py index c8d1c3433570..505e3140ead1 100644 --- a/uitest/uitest/test.py +++ b/uitest/uitest/test.py @@ -233,11 +233,6 @@ class UITest(object): yield component finally: self.close_doc() - # If the document has been modified then close_doc will end up being run - # asynchronously. The Base code seems to have a few race conditions so to avoid that - # let’s wait to make sure the close completes before continuing - xToolkit = self._xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') - xToolkit.waitUntilAllIdlesDispatched() def close_dialog_through_button(self, button, dialog=None): if dialog is None: @@ -271,6 +266,11 @@ class UITest(object): if component.isModified(): with self.execute_dialog_through_command('.uno:CloseDoc', close_button="discard"): pass + # execute_dialog_through_command will end up dispatching the command asynchronously + # on the main thread. The Base code seems to have a few race conditions so to avoid + # that let’s wait to make sure the close completes before continuing + xToolkit = self._xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.waitUntilAllIdlesDispatched() else: self._xUITest.executeCommand(".uno:CloseDoc") frames = desktop.getFrames()
