From 34057045beca40406673ff421a4ef1e8e8c08853 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Tue, 12 Dec 2017 18:23:19 +0100 Subject: ui: forward relevant option updates to UIs (#7520) also make termguicolors mutable after startup --- test/functional/ui/options_spec.lua | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 test/functional/ui/options_spec.lua (limited to 'test/functional/ui/options_spec.lua') diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua new file mode 100644 index 0000000000..14f40b3ec1 --- /dev/null +++ b/test/functional/ui/options_spec.lua @@ -0,0 +1,66 @@ +local helpers = require('test.functional.helpers')(after_each) +local Screen = require('test.functional.ui.screen') +local clear = helpers.clear +local command = helpers.command +local eq = helpers.eq + +describe('ui receives option updates', function() + local screen + + before_each(function() + clear() + screen = Screen.new(20,5) + screen:attach() + end) + + after_each(function() + screen:detach() + end) + + local defaults = { + ambiwidth='single', + arabicshape=true, + emoji=true, + guifont='', + guifontset='', + guifontwide='', + showtabline=1, + termguicolors=false, + } + + it("for defaults", function() + screen:expect(function() + eq(defaults, screen.options) + end) + end) + + it("when setting options", function() + local changed = {} + for k,v in pairs(defaults) do + changed[k] = v + end + + command("set termguicolors") + changed.termguicolors = true + screen:expect(function() + eq(changed, screen.options) + end) + + command("set guifont=Comic\\ Sans") + changed.guifont = "Comic Sans" + screen:expect(function() + eq(changed, screen.options) + end) + + command("set showtabline=0") + changed.showtabline = 0 + screen:expect(function() + eq(changed, screen.options) + end) + + command("set all&") + screen:expect(function() + eq(defaults, screen.options) + end) + end) +end) -- cgit From eb4aab7173fa1733f77bb6d7117351b47ada6134 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Jan 2018 07:31:57 +0100 Subject: ui: forward 'linespace' option #7883 ref #7520 --- test/functional/ui/options_spec.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/functional/ui/options_spec.lua') diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua index 14f40b3ec1..bc72ca71aa 100644 --- a/test/functional/ui/options_spec.lua +++ b/test/functional/ui/options_spec.lua @@ -24,6 +24,7 @@ describe('ui receives option updates', function() guifont='', guifontset='', guifontwide='', + linespace=0, showtabline=1, termguicolors=false, } @@ -58,6 +59,18 @@ describe('ui receives option updates', function() eq(changed, screen.options) end) + command("set linespace=13") + changed.linespace = 13 + screen:expect(function() + eq(changed, screen.options) + end) + + command("set linespace=-11") + changed.linespace = -11 + screen:expect(function() + eq(changed, screen.options) + end) + command("set all&") screen:expect(function() eq(defaults, screen.options) -- cgit From 6e5cb0debd23693175bd05409d3f1af4015567df Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Tue, 13 Feb 2018 13:45:49 +0100 Subject: ui: refactor ui options --- test/functional/ui/options_spec.lua | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'test/functional/ui/options_spec.lua') diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua index bc72ca71aa..62b08c0967 100644 --- a/test/functional/ui/options_spec.lua +++ b/test/functional/ui/options_spec.lua @@ -10,7 +10,6 @@ describe('ui receives option updates', function() before_each(function() clear() screen = Screen.new(20,5) - screen:attach() end) after_each(function() @@ -27,15 +26,21 @@ describe('ui receives option updates', function() linespace=0, showtabline=1, termguicolors=false, + ext_cmdline=false, + ext_popupmenu=false, + ext_tabline=false, + ext_wildmenu=false, } it("for defaults", function() + screen:attach() screen:expect(function() eq(defaults, screen.options) end) end) it("when setting options", function() + screen:attach() local changed = {} for k,v in pairs(defaults) do changed[k] = v @@ -76,4 +81,30 @@ describe('ui receives option updates', function() eq(defaults, screen.options) end) end) + + it('with UI extensions', function() + local changed = {} + for k,v in pairs(defaults) do + changed[k] = v + end + + screen:attach({ext_cmdline=true, ext_wildmenu=true}) + changed.ext_cmdline = true + changed.ext_wildmenu = true + screen:expect(function() + eq(changed, screen.options) + end) + + screen:set_option('ext_popupmenu', true) + changed.ext_popupmenu = true + screen:expect(function() + eq(changed, screen.options) + end) + + screen:set_option('ext_wildmenu', false) + changed.ext_wildmenu = false + screen:expect(function() + eq(changed, screen.options) + end) + end) end) -- cgit