test: add more tests for float window bufpos (#21318)

This commit is contained in:
zeertzjq 2022-12-07 10:18:12 +08:00 committed by GitHub
parent ad244a865b
commit eab71e7875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -727,6 +727,7 @@ describe('float window', function()
[25] = {blend = 100, background = Screen.colors.Gray0};
[26] = {blend = 80, background = Screen.colors.Gray0};
[27] = {background = Screen.colors.LightGray};
[28] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGray};
}
screen:set_default_attr_ids(attrs)
end)
@ -3068,6 +3069,66 @@ describe('float window', function()
]]}
end
command('set laststatus=0')
command('botright vnew')
if multigrid then
screen:expect{grid=[[
## grid 1
[2:----]{5:│}[6:--------------------]|
[2:----]{5:│}[6:--------------------]|
[2:----]{5:│}[6:--------------------]|
[2:----]{5:│}[6:--------------------]|
[2:----]{5:│}[6:--------------------]|
[2:----]{5:│}[6:--------------------]|
[2:----]{5:│}[6:--------------------]|
[2:----]{5:│}[6:--------------------]|
[2:----]{5:│}[6:--------------------]|
[3:-------------------------]|
## grid 2
exam|
ple |
text|
tha|
t is|
wid|
er t|
han |
the |
## grid 3
|
## grid 5
{1:some info! }|
## grid 6
^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
]], float_pos={
[5] = { {
id = 1002
}, "SW", 2, 8, 0, true }
}}
else
screen:expect{grid=[[
exam{5:}^ |
ple {5:}{0:~ }|
text{5:}{0:~ }|
tha{5:}{0:~ }|
t is{5:}{0:~ }|
wid{5:}{0:~ }|
er t{5:}{0:~ }|
{1:some info! }{0: }|
the {5:}{0:~ }|
|
]]}
end
command('close')
meths.win_set_config(win, {relative='win', bufpos={1,32}, anchor='NW', col=-2})
if multigrid then
screen:expect{grid=[[
@ -3163,6 +3224,54 @@ describe('float window', function()
|
]]}
end
command('%fold')
if multigrid then
screen:expect{grid=[[
## grid 1
[2:-------------------------]|
[2:-------------------------]|
[2:-------------------------]|
[2:-------------------------]|
[2:-------------------------]|
[2:-------------------------]|
[2:-------------------------]|
[2:-------------------------]|
[2:-------------------------]|
[3:-------------------------]|
## grid 2
{28:^+-- 5 lines: just some··}|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
## grid 3
|
## grid 5
{1:some info! }|
]], float_pos={
[5] = { {
id = 1002
}, "NW", 2, 2, 0, true }
}}
else
screen:expect{grid=[[
{28:^+-- 5 lines: just some··}|
{0:~ }|
{1:some info! }{0: }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
|
]]}
end
end)
it('validates cursor even when window is not entered', function()