aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/screen_basic_spec.lua
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2015-01-15 09:01:25 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-01-15 09:01:25 -0300
commitdc18fa256f335f2e8c7762a4d04e2efbc61d47cc (patch)
tree1634fcd0ef15f0fe7794e4432f09621ee70ea61c /test/functional/ui/screen_basic_spec.lua
parentc51c0950d3edef3309cf08979f5f9d434b8b73f0 (diff)
downloadrneovim-dc18fa256f335f2e8c7762a4d04e2efbc61d47cc.tar.gz
rneovim-dc18fa256f335f2e8c7762a4d04e2efbc61d47cc.tar.bz2
rneovim-dc18fa256f335f2e8c7762a4d04e2efbc61d47cc.zip
test: Add more functional test to cover new code
- emulate gui_running and terminal colors - scrolling/clearing regions - mouse wheel scrolling - setting icon/title - :stop/:suspend - screen resize
Diffstat (limited to 'test/functional/ui/screen_basic_spec.lua')
-rw-r--r--test/functional/ui/screen_basic_spec.lua254
1 files changed, 254 insertions, 0 deletions
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index a1110b3231..4ee6c43528 100644
--- a/test/functional/ui/screen_basic_spec.lua
+++ b/test/functional/ui/screen_basic_spec.lua
@@ -16,6 +16,69 @@ describe('Screen', function()
screen:detach()
end)
+ describe(':suspend', function()
+ it('is forwarded to the UI', function()
+ local function check()
+ if not screen.suspended then
+ return 'Screen was not suspended'
+ end
+ end
+ execute('suspend')
+ screen:wait(check)
+ screen.suspended = false
+ feed('<c-z>')
+ screen:wait(check)
+ end)
+ end)
+
+ describe('bell/visual bell', function()
+ it('is forwarded to the UI', function()
+ feed('<left>')
+ screen:wait(function()
+ if not screen.bell or screen.visual_bell then
+ return 'Bell was not sent'
+ end
+ end)
+ screen.bell = false
+ execute('set visualbell')
+ feed('<left>')
+ screen:wait(function()
+ if not screen.visual_bell or screen.bell then
+ return 'Visual bell was not sent'
+ end
+ end)
+ end)
+ end)
+
+ describe(':set title', function()
+ it('is forwarded to the UI', function()
+ local expected = 'test-title'
+ execute('set titlestring='..expected)
+ execute('set title')
+ screen:wait(function()
+ local actual = screen.title
+ if actual ~= expected then
+ return 'Expected title to be "'..expected..'" but was "'..actual..'"'
+ end
+ end)
+ end)
+ end)
+
+ describe(':set icon', function()
+ it('is forwarded to the UI', function()
+ local expected = 'test-icon'
+ execute('set iconstring='..expected)
+ execute('set icon')
+ screen:wait(function()
+ local actual = screen.icon
+ if actual ~= expected then
+ return 'Expected title to be "'..expected..'" but was "'..actual..'"'
+ end
+ end)
+ end)
+ end)
+
+
describe('window', function()
describe('split', function()
it('horizontal', function()
@@ -95,6 +158,8 @@ describe('Screen', function()
|
]])
end)
+
+
end)
end)
@@ -221,4 +286,193 @@ describe('Screen', function()
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
end)
end)
+
+ describe('scrolling and clearing', function()
+ before_each(function()
+ insert([[
+ Inserting
+ text
+ with
+ many
+ lines
+ to
+ test
+ scrolling
+ and
+ clearing
+ in
+ split
+ windows
+ ]])
+ execute('sp', 'vsp', 'vsp')
+ screen:expect([[
+ and |and |and |
+ clearing |clearing |clearing |
+ in |in |in |
+ split |split |split |
+ windows |windows |windows |
+ ^ | | |
+ [No Name] [+] [No Name] [+] [No Name] [+] |
+ clearing |
+ in |
+ split |
+ windows |
+ |
+ [No Name] [+] |
+ |
+ ]])
+ end)
+
+ it('only affects the current scroll region', function()
+ feed('6k')
+ screen:expect([[
+ ^crolling |and |and |
+ and |clearing |clearing |
+ clearing |in |in |
+ in |split |split |
+ split |windows |windows |
+ windows | | |
+ [No Name] [+] [No Name] [+] [No Name] [+] |
+ clearing |
+ in |
+ split |
+ windows |
+ |
+ [No Name] [+] |
+ |
+ ]])
+ feed('<c-w>l')
+ screen:expect([[
+ scrolling |and |and |
+ and |clearing |clearing |
+ clearing |in |in |
+ in |split |split |
+ split |windows |windows |
+ windows |^ | |
+ [No Name] [+] [No Name] [+] <Name] [+] |
+ clearing |
+ in |
+ split |
+ windows |
+ |
+ [No Name] [+] |
+ |
+ ]])
+ feed('gg')
+ screen:expect([[
+ scrolling |^nserting |and |
+ and |text |clearing |
+ clearing |with |in |
+ in |many |split |
+ split |lines |windows |
+ windows |to | |
+ [No Name] [+] [No Name] [+] <Name] [+] |
+ clearing |
+ in |
+ split |
+ windows |
+ |
+ [No Name] [+] |
+ |
+ ]])
+ feed('7j')
+ screen:expect([[
+ scrolling |with |and |
+ and |many |clearing |
+ clearing |lines |in |
+ in |to |split |
+ split |test |windows |
+ windows |^crolling | |
+ [No Name] [+] [No Name] [+] <Name] [+] |
+ clearing |
+ in |
+ split |
+ windows |
+ |
+ [No Name] [+] |
+ |
+ ]])
+ feed('2j')
+ screen:expect([[
+ scrolling |lines |and |
+ and |to |clearing |
+ clearing |test |in |
+ in |scrolling |split |
+ split |and |windows |
+ windows |^learing | |
+ [No Name] [+] [No Name] [+] <Name] [+] |
+ clearing |
+ in |
+ split |
+ windows |
+ |
+ [No Name] [+] |
+ |
+ ]])
+ feed('5k')
+ screen:expect([[
+ scrolling |^ines |and |
+ and |to |clearing |
+ clearing |test |in |
+ in |scrolling |split |
+ split |and |windows |
+ windows |clearing | |
+ [No Name] [+] [No Name] [+] <Name] [+] |
+ clearing |
+ in |
+ split |
+ windows |
+ |
+ [No Name] [+] |
+ |
+ ]])
+ feed('k')
+ screen:expect([[
+ scrolling |^any |and |
+ and |lines |clearing |
+ clearing |to |in |
+ in |test |split |
+ split |scrolling |windows |
+ windows |and | |
+ [No Name] [+] [No Name] [+] <Name] [+] |
+ clearing |
+ in |
+ split |
+ windows |
+ |
+ [No Name] [+] |
+ |
+ ]])
+ end)
+ end)
+
+ describe('resize', function()
+ before_each(function()
+ screen:try_resize(25, 5)
+ feed('iresize')
+ end)
+
+ it('rebuilds the whole screen', function()
+ screen:expect([[
+ resize^ |
+ ~ |
+ ~ |
+ ~ |
+ -- INSERT -- |
+ ]])
+ end)
+
+ it('has minimum width/height values', function()
+ screen:try_resize(1, 1)
+ screen:expect([[
+ -- INS^RT --|
+ |
+ ]])
+ feed('<esc>:ls')
+ screen:expect([[
+ resize |
+ :ls^ |
+ ]])
+ end)
+ end)
end)