aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-09-08 14:57:45 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2019-09-08 15:24:14 +0200
commitc705e3fb0b70887aaebe4973ce02acc6be45eb97 (patch)
treed09e86ecd2f61d8e93175bceefa1468df0c586e3
parent19993bca4afaade5d0fbaf132ff66064370bacb0 (diff)
downloadrneovim-c705e3fb0b70887aaebe4973ce02acc6be45eb97.tar.gz
rneovim-c705e3fb0b70887aaebe4973ce02acc6be45eb97.tar.bz2
rneovim-c705e3fb0b70887aaebe4973ce02acc6be45eb97.zip
update tests for new resize behavior (resize at pager, but not at :!cmd)
-rw-r--r--test/functional/helpers.lua1
-rw-r--r--test/functional/terminal/tui_spec.lua18
-rw-r--r--test/functional/ui/messages_spec.lua117
3 files changed, 127 insertions, 9 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index d50ecd2e6f..131ce7ed0b 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -689,6 +689,7 @@ end
module.funcs = module.create_callindex(module.call)
module.meths = module.create_callindex(module.nvim)
+module.async_meths = module.create_callindex(module.nvim_async)
module.uimeths = module.create_callindex(ui)
module.bufmeths = module.create_callindex(module.buffer)
module.winmeths = module.create_callindex(module.window)
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index 3225ce5162..56c1cc0d7b 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -122,10 +122,10 @@ describe('TUI', function()
screen:try_resize(50,5)
screen:expect{grid=[[
- {8:FAIL 1} |
- {8:FAIL 2} |
{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 --} |
]]}
@@ -144,12 +144,12 @@ describe('TUI', function()
) |
{8:Error detected while processing function ManyErr:} |
{11:line 2:} |
- {10:-- More --} |
- {10: }|
- {10: }|
- {10: }|
- {10: }|
- {10:-- More -- SPACE/d/j: screen/page/line down, b/u/}{12:k}|
+ {8:FAIL 0} |
+ {8:FAIL 1} |
+ {8:FAIL 2} |
+ {8:FAIL 3} |
+ {8:FAIL 4} |
+ {10:-- More --}{1: } |
{3:-- TERMINAL --} |
]]}
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
index 90874a92ef..875e4092a6 100644
--- a/test/functional/ui/messages_spec.lua
+++ b/test/functional/ui/messages_spec.lua
@@ -6,6 +6,7 @@ local eq = helpers.eq
local command = helpers.command
local set_method_error = helpers.set_method_error
local meths = helpers.meths
+local async_meths = helpers.async_meths
local test_build_dir = helpers.test_build_dir
local nvim_prog = helpers.nvim_prog
local iswin = helpers.iswin
@@ -1073,6 +1074,7 @@ describe('pager', function()
[9] = {foreground = tonumber('0x00000c'), background = Screen.colors.Grey100},
[10] = {background = Screen.colors.Grey100, bold = true, foreground = tonumber('0xe5e5ff')},
[11] = {background = Screen.colors.Grey100, bold = true, foreground = tonumber ('0x2b8452')},
+ [12] = {bold = true, reverse = true},
})
command("set more")
@@ -1392,4 +1394,119 @@ aliquip ex ea commodo consequat.]])
{11:--}{8: }{11:More}{8: }{11:--}{8:^ }|
]]}
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)