test: screen.lua can check win_pos #32373

Also remove a hack in the multigrid "with winbar" test.
This commit is contained in:
fredizzimo
2025-02-09 22:31:14 +07:00
committed by GitHub
parent 9198368f32
commit af0cd9a907
2 changed files with 26 additions and 13 deletions

View File

@ -2407,6 +2407,22 @@ describe('ext_multigrid', function()
it('with winbar', function()
command('split')
local win_pos ={
[2] = {
height = 5,
startcol = 0,
startrow = 7,
width = 53,
win = 1000
},
[4] = {
height = 6,
startcol = 0,
startrow = 0,
width = 53,
win = 1001
}
}
screen:expect{grid=[[
## grid 1
[4:-----------------------------------------------------]|*6
@ -2428,15 +2444,7 @@ describe('ext_multigrid', function()
}, win_viewport_margins={
[2] = {win = 1000, top = 0, bottom = 0, left = 0, right = 0};
[4] = {win = 1001, top = 0, bottom = 0, left = 0, right = 0};
}}
-- XXX: hack to get notifications. Could use next_msg() also.
local orig_handle_win_pos = screen._handle_win_pos
local win_pos = {}
function screen._handle_win_pos(self, grid, win, startrow, startcol, width, height)
table.insert(win_pos, {grid, win, startrow, startcol, width, height})
orig_handle_win_pos(self, grid, win, startrow, startcol, width, height)
end
}, win_pos = win_pos }
command('setlocal winbar=very%=bar')
screen:expect{grid=[[
@ -2461,8 +2469,7 @@ describe('ext_multigrid', function()
}, win_viewport_margins={
[2] = {win = 1000, top = 0, bottom = 0, left = 0, right = 0};
[4] = {win = 1001, top = 1, bottom = 0, left = 0, right = 0};
}}
eq({}, win_pos)
}, win_pos = win_pos }
command('setlocal winbar=')
screen:expect{grid=[[
@ -2486,8 +2493,7 @@ describe('ext_multigrid', function()
}, win_viewport_margins={
[2] = {win = 1000, top = 0, bottom = 0, left = 0, right = 0};
[4] = {win = 1001, top = 0, bottom = 0, left = 0, right = 0};
}}
eq({}, win_pos)
}, win_pos = win_pos }
end)
it('with winbar dragging statusline with mouse works correctly', function()