diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-29 08:56:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-29 08:56:41 +0800 |
commit | 0badfaa6d0a86904f67e1343e839c2f7966e4716 (patch) | |
tree | aaf15e2d5a25aeace35c29fc695f7bf99ae2959a | |
parent | 31eb20d915749dfcf2c3071a2b1e1393070b3efb (diff) | |
download | rneovim-0badfaa6d0a86904f67e1343e839c2f7966e4716.tar.gz rneovim-0badfaa6d0a86904f67e1343e839c2f7966e4716.tar.bz2 rneovim-0badfaa6d0a86904f67e1343e839c2f7966e4716.zip |
test: adding/removing winbar should not cause win_pos events (#21226)
-rw-r--r-- | test/functional/ui/multigrid_spec.lua | 89 |
1 files changed, 86 insertions, 3 deletions
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua index 78a1e8c677..71adeb42a4 100644 --- a/test/functional/ui/multigrid_spec.lua +++ b/test/functional/ui/multigrid_spec.lua @@ -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:-----------------------------------------------------]| @@ -2408,7 +2452,7 @@ describe('ext_multigrid', function() ## grid 3 | ## grid 4 - {7:very bar }| + {7:very bar}| ^ | {1:~ }| {1:~ }| @@ -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() |