diff options
Diffstat (limited to 'test/functional/ui/options_spec.lua')
-rw-r--r-- | test/functional/ui/options_spec.lua | 57 |
1 files changed, 52 insertions, 5 deletions
diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua index 2f113f6ac6..c2b0bcdb64 100644 --- a/test/functional/ui/options_spec.lua +++ b/test/functional/ui/options_spec.lua @@ -4,6 +4,7 @@ local clear = helpers.clear local command = helpers.command local eq = helpers.eq local shallowcopy = helpers.shallowcopy +local eval = helpers.eval describe('UI receives option updates', function() local screen @@ -62,17 +63,18 @@ describe('UI receives option updates', function() end screen:attach() screen:expect(function() - eq({'mouse_off'}, evs) + eq({'mouse_on'}, evs) end) - command("set mouse=nvi") + command("set mouse=") + command("set mouse&") screen:expect(function() - eq({'mouse_off','mouse_on'}, evs) + eq({'mouse_on','mouse_off', 'mouse_on'}, evs) end) screen:detach() - eq({'mouse_off','mouse_on'}, evs) + eq({'mouse_on','mouse_off', 'mouse_on'}, evs) screen:attach() screen:expect(function() - eq({'mouse_off','mouse_on','mouse_on'}, evs) + eq({'mouse_on','mouse_off','mouse_on', 'mouse_on'}, evs) end) end) @@ -86,6 +88,12 @@ describe('UI receives option updates', function() eq(expected, screen.options) end) + command("set pumblend=-1") + expected.pumblend = 0 + screen:expect(function() + eq(expected, screen.options) + end) + command("set guifont=Comic\\ Sans") expected.guifont = "Comic Sans" screen:expect(function() @@ -168,3 +176,42 @@ describe('UI receives option updates', function() it('from startup options with --headless', function() startup_test(true) end) it('from startup options with --embed', function() startup_test(false) end) end) + +describe('UI can set terminal option', function() + local screen + before_each(function() + -- by default we implicity "--cmd 'set bg=light'" which ruins everything + clear{args_rm={'--cmd'}} + screen = Screen.new(20,5) + end) + + it('term_background', function() + eq('dark', eval '&background') + + screen:attach {term_background='light'} + eq('light', eval '&background') + end) + + it("term_background but not if 'background' already set by user", function() + eq('dark', eval '&background') + command 'set background=dark' + + screen:attach {term_background='light'} + + eq('dark', eval '&background') + end) + + it('term_name', function() + eq('nvim', eval '&term') + + screen:attach {term_name='xterm'} + eq('xterm', eval '&term') + end) + + it('term_colors', function() + eq('256', eval '&t_Co') + + screen:attach {term_colors=8} + eq('8', eval '&t_Co') + end) +end) |