patch 9.2.0107: tests: Test_statuslineopt() is flaky

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>
This commit is contained in:
Hirohito Higashi
2026-03-04 19:09:37 +00:00
committed by Christian Brabandt
parent 648240fe9a
commit 76abd0ccdf
2 changed files with 9 additions and 4 deletions
+7 -4
View 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}]')
+2
View File
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
107,
/**/
106,
/**/