sc/qa/uitest/calc_dialogs/printDialog.py |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit e3c4630cb34861d314eb6dd624be9a6e0a784d21
Author:     Neil Roberts <[email protected]>
AuthorDate: Thu Jan 29 10:58:28 2026 +0100
Commit:     Neil Roberts <[email protected]>
CommitDate: Thu Jan 29 16:10:49 2026 +0100

    uitest/printDialog: Wait for idle before checking num pages
    
    When the print dialog is created it installs an idle handler to update
    the number of pages. The printDialog test was checking the label for the
    number of pages immediately after the creating the dialog so there was
    likely a race condition and the test sometimes got the stub “/ %n” value
    instead of the actual number of pages. This is probably the cause of
    occasional build failures such as this one:
    
    https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/198048/
    
    If I use the gen backend locally then the test fails consistently. This
    patch fixes it by just waiting for idle with waitUntilAllIdlesDispatched
    after creating the dialog.
    
    Change-Id: I26919c90a85258169412e80fa472d199e329417b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198349
    Reviewed-by: Neil Roberts <[email protected]>
    Tested-by: Jenkins

diff --git a/sc/qa/uitest/calc_dialogs/printDialog.py 
b/sc/qa/uitest/calc_dialogs/printDialog.py
index 3e1290b9c8af..fd879b4b4362 100644
--- a/sc/qa/uitest/calc_dialogs/printDialog.py
+++ b/sc/qa/uitest/calc_dialogs/printDialog.py
@@ -13,6 +13,11 @@ class printDialog(UITestCase):
     def test_printDialog(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf155218.ods")):
             with self.ui_test.execute_dialog_through_command(".uno:Print", 
close_button="cancel") as xDialog:
+                # The number of pages is updated on an idle handler after 
creating the dialog. Let’s
+                # wait until the main loop is truly idle again to make sure 
the text has been
+                # updated before reading it
+                xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+                xToolkit.waitUntilAllIdlesDispatched()
 
                 xPortraiTotalNumberPages = xDialog.getChild("totalnumpages")
                 
self.assertEqual(get_state_as_dict(xPortraiTotalNumberPages)["Text"], "/ 2")

Reply via email to