update tests for new resize behavior (resize at pager, but not at :!cmd)

This commit is contained in:
Björn Linse 2019-09-08 14:57:45 +02:00
parent 19993bca4a
commit c705e3fb0b
3 changed files with 127 additions and 9 deletions

View File

@ -689,6 +689,7 @@ end
module.funcs = module.create_callindex(module.call) module.funcs = module.create_callindex(module.call)
module.meths = module.create_callindex(module.nvim) module.meths = module.create_callindex(module.nvim)
module.async_meths = module.create_callindex(module.nvim_async)
module.uimeths = module.create_callindex(ui) module.uimeths = module.create_callindex(ui)
module.bufmeths = module.create_callindex(module.buffer) module.bufmeths = module.create_callindex(module.buffer)
module.winmeths = module.create_callindex(module.window) module.winmeths = module.create_callindex(module.window)

View File

@ -122,10 +122,10 @@ describe('TUI', function()
screen:try_resize(50,5) screen:try_resize(50,5)
screen:expect{grid=[[ screen:expect{grid=[[
{8:FAIL 1} |
{8:FAIL 2} |
{8:FAIL 3} | {8:FAIL 3} |
{10:-- More -- SPACE/d/j: screen/page/line down, b/u/}{12:k}| {8:FAIL 4} |
{8:FAIL 5} |
{10:-- More --}{1: } |
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]} ]]}
@ -144,12 +144,12 @@ describe('TUI', function()
) | ) |
{8:Error detected while processing function ManyErr:} | {8:Error detected while processing function ManyErr:} |
{11:line 2:} | {11:line 2:} |
{10:-- More --} | {8:FAIL 0} |
{10: }| {8:FAIL 1} |
{10: }| {8:FAIL 2} |
{10: }| {8:FAIL 3} |
{10: }| {8:FAIL 4} |
{10:-- More -- SPACE/d/j: screen/page/line down, b/u/}{12:k}| {10:-- More --}{1: } |
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]} ]]}

View File

@ -6,6 +6,7 @@ local eq = helpers.eq
local command = helpers.command local command = helpers.command
local set_method_error = helpers.set_method_error local set_method_error = helpers.set_method_error
local meths = helpers.meths local meths = helpers.meths
local async_meths = helpers.async_meths
local test_build_dir = helpers.test_build_dir local test_build_dir = helpers.test_build_dir
local nvim_prog = helpers.nvim_prog local nvim_prog = helpers.nvim_prog
local iswin = helpers.iswin local iswin = helpers.iswin
@ -1073,6 +1074,7 @@ describe('pager', function()
[9] = {foreground = tonumber('0x00000c'), background = Screen.colors.Grey100}, [9] = {foreground = tonumber('0x00000c'), background = Screen.colors.Grey100},
[10] = {background = Screen.colors.Grey100, bold = true, foreground = tonumber('0xe5e5ff')}, [10] = {background = Screen.colors.Grey100, bold = true, foreground = tonumber('0xe5e5ff')},
[11] = {background = Screen.colors.Grey100, bold = true, foreground = tonumber ('0x2b8452')}, [11] = {background = Screen.colors.Grey100, bold = true, foreground = tonumber ('0x2b8452')},
[12] = {bold = true, reverse = true},
}) })
command("set more") command("set more")
@ -1392,4 +1394,119 @@ aliquip ex ea commodo consequat.]])
{11:--}{8: }{11:More}{8: }{11:--}{8:^ }| {11:--}{8: }{11:More}{8: }{11:--}{8:^ }|
]]} ]]}
end) end)
it('with :!cmd does not crash on resize', function()
feed(':!sleep 1<cr>')
screen:expect{grid=[[
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{12: }|
:!sleep 1 |
|
]]}
-- not processed while command is executing
async_meths.ui_try_resize(35, 5)
-- TODO(bfredl): ideally it should be processed just
-- before the "press ENTER" prompt though
screen:expect{grid=[[
|
{1:~ }|
{1:~ }|
{12: }|
:!sleep 1 |
|
{4:Press ENTER or type command to cont}|
{4:inue}^ |
]]}
feed('<cr>')
screen:expect{grid=[[
^ |
{1:~ }|
{1:~ }|
{1:~ }|
|
]]}
end)
it('can be resized', function()
feed(':lua error(_G.x)<cr>')
screen:expect{grid=[[
{2:E5105: Error while calling lua chun}|
{2:k: [string "<VimL compiled string>"}|
{2:]:1: Lorem ipsum dolor sit amet, co}|
{2:nsectetur} |
{2:adipisicing elit, sed do eiusmod te}|
{2:mpor} |
{2:incididunt ut labore et dolore magn}|
{4:-- More --}^ |
]]}
-- responds to resize, but text is not reflown
screen:try_resize(45, 5)
screen:expect{grid=[[
{2:nsectetur} |
{2:adipisicing elit, sed do eiusmod te} |
{2:mpor} |
{2:incididunt ut labore et dolore magn} |
{4:-- More --}^ |
]]}
-- can create empty space, as the command hasn't output the text below yet.
-- text is not reflown; existing lines get cut
screen:try_resize(30, 12)
screen:expect{grid=[[
{2:E5105: Error while calling lua}|
{2:k: [string "<VimL compiled str}|
{2:]:1: Lorem ipsum dolor sit ame}|
{2:nsectetur} |
{2:adipisicing elit, sed do eiusm}|
{2:mpore} |
{2:incididunt ut labore et dolore}|
{2: magn} |
|
|
|
{4:-- More --}^ |
]]}
-- continues in a mostly consistent state, but only new lines are
-- wrapped at the new screen size.
feed('<cr>')
screen:expect{grid=[[
{2:k: [string "<VimL compiled str}|
{2:]:1: Lorem ipsum dolor sit ame}|
{2:nsectetur} |
{2:adipisicing elit, sed do eiusm}|
{2:mpore} |
{2:incididunt ut labore et dolore}|
{2: magna aliqua.} |
{2:Ut enim ad minim veniam, quis }|
{2:nostrud xercitation} |
{2:ullamco laboris nisi ut} |
{2:aliquip ex ea commodo consequa}|
{4:-- More --}^ |
]]}
feed('q')
screen:expect{grid=[[
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
|
]]}
end)
end) end)