Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: adding/removing winbar should not cause win_pos events #21226

Merged
merged 1 commit into from
Nov 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: adding/removing winbar should not cause win_pos events
  • Loading branch information
zeertzjq committed Nov 29, 2022
commit b6112ec33523fb3d391bb16e40ceea6476821905
89 changes: 86 additions & 3 deletions test/functional/ui/multigrid_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2381,8 +2381,52 @@ describe('ext_multigrid', function()
end)

it('with winbar', function()
command 'split'
command 'setlocal winbar=very\\ bar'
command('split')
screen:expect{grid=[[
## grid 1
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
{11:[No Name] }|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] }|
[3:-----------------------------------------------------]|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|
## grid 4
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
}}

-- 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

command('setlocal winbar=very%=bar')
screen:expect{grid=[[
## grid 1
[4:-----------------------------------------------------]|
Expand All @@ -2408,7 +2452,7 @@ describe('ext_multigrid', function()
## grid 3
|
## grid 4
{7:very bar }|
{7:very bar}|
^ |
{1:~ }|
{1:~ }|
Expand All @@ -2418,6 +2462,45 @@ describe('ext_multigrid', function()
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
}}
eq({}, win_pos)

command('setlocal winbar=')
screen:expect{grid=[[
## grid 1
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
{11:[No Name] }|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] }|
[3:-----------------------------------------------------]|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|
## grid 4
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
}}
eq({}, win_pos)
end)

it('with winbar dragging statusline with mouse works correctly', function()
Expand Down