sw/qa/uitest/writer_tests7/tdf135938.py |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 09c3a0aa13e7c4719a73728c2f9ba1f66cea7572
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Thu Feb 2 17:36:45 2023 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Thu Feb 2 18:31:12 2023 +0000

    A better fix for the stale TreeListEntryUIObject issue
    
    ...that hits UITest_writer_tests7
    UITEST_TEST_NAME=tdf135938.tdf135938.test_tdf135938_cross_reference_update 
as
    discussed in the commit message of 51a2e1a3963aae3228c9ddf78d0039c7c063393c 
"Let
    executeAction always ProcessEventsToIdle".  And while that 
ProcessEventsToIdle
    may be a general UITest stability improvement, it turned out that it did not
    actually fix this test_tdf135938_cross_reference_update issue, which I still
    kept seeing occasionally with my local ASan/UBSan build.  On closer 
inspection,
    it was the m_aUpdateTimer timer used by SwChildWinWrapper causing the issue,
    whose expiration is not forced by the added ProcessEventsToIdle.  So lets 
add a
    hacky sleep to the Python test code, to hopefully make sure that the timer 
has
    expired, and any SvTreeListEntries are stable, by the time the Python code
    initiates the creation of any TreeListEntryUIObjects that reference those
    SvTreeListEntries.
    
    Change-Id: I9f3c7293d55dffdc910879142d471a299f60a8e4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146508
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/sw/qa/uitest/writer_tests7/tdf135938.py 
b/sw/qa/uitest/writer_tests7/tdf135938.py
index 07298ab8d8e1..164c968f55fd 100755
--- a/sw/qa/uitest/writer_tests7/tdf135938.py
+++ b/sw/qa/uitest/writer_tests7/tdf135938.py
@@ -10,12 +10,21 @@
 from uitest.framework import UITestCase
 from uitest.uihelper.common import get_state_as_dict
 from libreoffice.uno.propertyvalue import mkPropertyValues
+import time
 
 class tdf135938(UITestCase):
 
     def test_tdf135938_cross_reference_update(self):
         with self.ui_test.create_doc_in_start_center("writer"):
             with 
self.ui_test.execute_modeless_dialog_through_command(".uno:InsertReferenceField",
 close_button="cancel") as xDialog:
+                # HACK, see the `m_aUpdateTimer.SetTimeout(200)` (to "avoid 
flickering of buttons")
+                # in the SwChildWinWrapper ctor in 
sw/source/uibase/fldui/fldwrap.cxx, which can
+                # invalidate the TreeListEntryUIObjects used by the below 
get_state_as_dict calls
+                # (see 2798430c8a711861fdcdfbf9ac00a0527abd3bfc "Mark the uses 
of
+                # TreeListEntryUIObject as dubious"); lets double that 200 ms 
timeout value here to
+                # hopefully be on the safe side:
+                time.sleep(0.4);
+
                 # Select set reference type
                 xTreelistType = xDialog.getChild("type-ref")
                 xTreeEntry = xTreelistType.getChild('0')

Reply via email to