sw/qa/uitest/writer_tests7/tdf135938.py |   26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

New commits:
commit 9a23ded27470a4c57015e9e5d686259a60d464f2
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Mon Feb 6 16:38:37 2023 +0100
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Mon Feb 6 18:57:28 2023 +0000

    Fix thinko when to sleep
    
    <https://ci.libreoffice.org/job/lo_ubsan/2672/> still failed with the same
    symptoms that 09c3a0aa13e7c4719a73728c2f9ba1f66cea7572 "A better fix for the
    stale TreeListEntryUIObject issue" had been supposed to fix.  And of 
course, it
    is the
    
    >                 xInsert.executeAction("CLICK", tuple())
    
    calls that actually trigger m_aUpdateTimer.Start() in
    SwChildWinWrapper::ReInitDlg, while the upfront 
m_aUpdateTimer.SetTimeout(200)
    in the SwChildWinWrapper ctor by itself is not relevant for the point in 
time
    where the timer actually starts (and where the Python code thus has to start
    waiting, too).
    
    Change-Id: I2b4fe7dadd470c62e7d63594a76d258faeac5906
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146588
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/sw/qa/uitest/writer_tests7/tdf135938.py 
b/sw/qa/uitest/writer_tests7/tdf135938.py
index 164c968f55fd..8faab5c47938 100755
--- a/sw/qa/uitest/writer_tests7/tdf135938.py
+++ b/sw/qa/uitest/writer_tests7/tdf135938.py
@@ -17,14 +17,6 @@ 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')
@@ -37,6 +29,15 @@ class tdf135938(UITestCase):
                 xInsert = xDialog.getChild("ok")
                 xInsert.executeAction("CLICK", tuple())
 
+                # HACK, see the `m_aUpdateTimer.SetTimeout(200)` (to "avoid 
flickering of buttons")
+                # in the SwChildWinWrapper ctor in 
sw/source/uibase/fldui/fldwrap.cxx, where that
+                # m_aUpdateTimer is started by SwChildWinWrapper::ReInitDlg 
triggered from the
+                # xInsert click above, and 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(.4);
+
                 xSelect = xDialog.getChild("select-ref")
                 self.assertEqual("1", get_state_as_dict(xSelect)["Children"])
                 self.assertEqual("ABC", 
get_state_as_dict(xSelect.getChild(0))["Text"])
@@ -45,6 +46,15 @@ class tdf135938(UITestCase):
                 xName.executeAction("TYPE", mkPropertyValues({"TEXT": "DEF"}))
                 xInsert.executeAction("CLICK", tuple())
 
+                # HACK, see the `m_aUpdateTimer.SetTimeout(200)` (to "avoid 
flickering of buttons")
+                # in the SwChildWinWrapper ctor in 
sw/source/uibase/fldui/fldwrap.cxx, where that
+                # m_aUpdateTimer is started by SwChildWinWrapper::ReInitDlg 
triggered from the
+                # xInsert click above, and 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(.4);
+
                 self.assertEqual("2", get_state_as_dict(xSelect)["Children"])
                 self.assertEqual("ABC", 
get_state_as_dict(xSelect.getChild(0))["Text"])
                 self.assertEqual("DEF", 
get_state_as_dict(xSelect.getChild(1))["Text"])

Reply via email to