]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0107: tests: Test_statuslineopt() is flaky v9.2.0107
authorHirohito Higashi <h.east.727@gmail.com>
Wed, 4 Mar 2026 19:09:37 +0000 (19:09 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 4 Mar 2026 19:09:37 +0000 (19:09 +0000)
Problem:  tests: Test_statuslineopt() is flaky
Solution: Force a redraw earlier and read screen content directly using
          screenstring() instead of g:ScreenLines() (Hirohito Higashi).

closes: #19571

Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/testdir/test_statuslineopt.vim
src/version.c

index 7fcf489bf1dba77be55efe70adb102a310afb9c6..791a65ae574eb288b4d56740eff848609e51b161 100644 (file)
@@ -17,15 +17,18 @@ def TearDown()
 enddef
 
 def s:Assert_match_statusline(winid: number, stlh: number, expect: list<string>): void
+  redraw!
   if has('gui_running')
-    redraw!
     sleep 1m
   endif
   var wi = getwininfo(winid)[0]
   var winh = wi.winrow + wi.height
-  var lines = [winh, winh + wi.status_height - 1]
-  var actual = mapnew(g:ScreenLines(lines, &columns), (_, v) =>
-              v[wi.wincol - 1 : wi.wincol - 1 + wi.width - 1])
+  # Read screen content directly after redraw! to avoid a second redraw!
+  # inside g:ScreenLines() that may process GUI events and change the window
+  # layout between the getwininfo() call and the screenstring() calls.
+  var actual = mapnew(range(winh, winh + wi.status_height - 1),
+      (_, l) => join(mapnew(range(1, &columns),
+          (_, c) => screenstring(l, c)), '')[wi.wincol - 1 : wi.wincol - 1 + wi.width - 1])
   assert_equal(stlh, wi.status_height)
   for i in range(len(expect))
     assert_match(expect[i], actual[i], $'[{i}]')
index e0bf8c7c78b45c9a2f27e38afec61b524697c830..63308de4b361595103055d98fd5c359ac9398c48 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    107,
 /**/
     106,
 /**/