test: add test for scroll wheel at right-click menu (#27409)

This commit is contained in:
zeertzjq 2024-02-10 11:54:26 +08:00 committed by GitHub
parent dcb11c1091
commit ba23d109ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 93 additions and 5 deletions

View File

@ -654,6 +654,20 @@ describe('TUI', function()
api.nvim_input_mouse('right', 'release', '', 0, 0, 4)
end
screen:expect_unchanged()
if esc then
feed_data('\027[<64;5;1M')
else
api.nvim_input_mouse('wheel', 'up', '', 0, 0, 4)
end
screen:expect([[
{1:p}opup menu test |
{4:~ }{14: foo }{4: }|
{4:~ }{13: bar }{4: }|
{4:~ }{13: baz }{4: }|
{5:[No Name] [+] }|
|
{3:-- TERMINAL --} |
]])
if esc then
feed_data('\027[<35;7;4M')
else
@ -668,6 +682,20 @@ describe('TUI', function()
|
{3:-- TERMINAL --} |
]])
if esc then
feed_data('\027[<65;7;4M')
else
api.nvim_input_mouse('wheel', 'down', '', 0, 3, 6)
end
screen:expect([[
{1:p}opup menu test |
{4:~ }{13: foo }{4: }|
{4:~ }{14: bar }{4: }|
{4:~ }{13: baz }{4: }|
{5:[No Name] [+] }|
|
{3:-- TERMINAL --} |
]])
if esc then
feed_data('\027[<0;7;3M')
else

View File

@ -3784,9 +3784,7 @@ describe('builtin popupmenu', function()
{n: bar }|
{n: baz }|
]],
float_pos = {
[4] = { -1, 'NW', 2, 1, 17, false, 250 },
},
float_pos = { [4] = { -1, 'NW', 2, 1, 17, false, 250 } },
}
else
feed('<RightMouse><18,0>')
@ -3969,7 +3967,38 @@ describe('builtin popupmenu', function()
end
eq(true, screen.options.mousemoveevent)
if multigrid then
api.nvim_input_mouse('move', '', '', 2, 3, 6)
api.nvim_input_mouse('wheel', 'up', '', 2, 0, 4)
screen:expect({
grid = [[
## grid 1
[2:--------------------------------]|*5
[3:--------------------------------]|
## grid 2
^popup menu test |
{1:~ }|*4
## grid 3
:let g:menustr = 'foo' |
## grid 4
{s: foo }|
{n: bar }|
{n: baz }|
]],
float_pos = { [4] = { -1, 'NW', 2, 1, 3, false, 250 } },
})
else
feed('<ScrollWheelUp><4,0>')
screen:expect([[
^popup menu test |
{1:~ }{s: foo }{1: }|
{1:~ }{n: bar }{1: }|
{1:~ }{n: baz }{1: }|
{1:~ }|
:let g:menustr = 'foo' |
]])
end
eq(true, screen.options.mousemoveevent)
if multigrid then
api.nvim_input_mouse('move', '', '', 4, 2, 3)
screen:expect({
grid = [[
## grid 1
@ -4000,7 +4029,38 @@ describe('builtin popupmenu', function()
end
eq(true, screen.options.mousemoveevent)
if multigrid then
api.nvim_input_mouse('left', 'press', '', 2, 2, 6)
api.nvim_input_mouse('wheel', 'down', '', 4, 2, 3)
screen:expect({
grid = [[
## grid 1
[2:--------------------------------]|*5
[3:--------------------------------]|
## grid 2
^popup menu test |
{1:~ }|*4
## grid 3
:let g:menustr = 'foo' |
## grid 4
{n: foo }|
{s: bar }|
{n: baz }|
]],
float_pos = { [4] = { -1, 'NW', 2, 1, 3, false, 250 } },
})
else
feed('<ScrollWheelDown><6,3>')
screen:expect([[
^popup menu test |
{1:~ }{n: foo }{1: }|
{1:~ }{s: bar }{1: }|
{1:~ }{n: baz }{1: }|
{1:~ }|
:let g:menustr = 'foo' |
]])
end
eq(true, screen.options.mousemoveevent)
if multigrid then
api.nvim_input_mouse('left', 'press', '', 4, 1, 3)
screen:expect({
grid = [[
## grid 1