From c705e3fb0b70887aaebe4973ce02acc6be45eb97 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sun, 8 Sep 2019 14:57:45 +0200 Subject: update tests for new resize behavior (resize at pager, but not at :!cmd) --- test/functional/ui/messages_spec.lua | 117 +++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) (limited to 'test/functional/ui/messages_spec.lua') 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') + 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('') + screen:expect{grid=[[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]} + end) + + it('can be resized', function() + feed(':lua error(_G.x)') + screen:expect{grid=[[ + {2:E5105: Error while calling lua chun}| + {2:k: [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 "') + screen:expect{grid=[[ + {2:k: [string "