aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2017-12-12 18:23:19 +0100
committerGitHub <noreply@github.com>2017-12-12 18:23:19 +0100
commit34057045beca40406673ff421a4ef1e8e8c08853 (patch)
treead32d3d1f5e05cd1f522e67bcd42f8968f6dbf21 /test/functional/ui
parentf976826690a975e03bb57f6cc84955c59ee6cff4 (diff)
downloadrneovim-34057045beca40406673ff421a4ef1e8e8c08853.tar.gz
rneovim-34057045beca40406673ff421a4ef1e8e8c08853.tar.bz2
rneovim-34057045beca40406673ff421a4ef1e8e8c08853.zip
ui: forward relevant option updates to UIs (#7520)
also make termguicolors mutable after startup
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/options_spec.lua66
-rw-r--r--test/functional/ui/screen.lua5
2 files changed, 71 insertions, 0 deletions
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)
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index 075d8c40d7..696feabeed 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -137,6 +137,7 @@ function Screen.new(width, height)
visual_bell = false,
suspended = false,
mode = 'normal',
+ options = {},
_default_attr_ids = nil,
_default_attr_ignore = nil,
_mouse_enabled = true,
@@ -482,6 +483,10 @@ function Screen:_handle_set_icon(icon)
self.icon = icon
end
+function Screen:_handle_option_set(name, value)
+ self.options[name] = value
+end
+
function Screen:_clear_block(top, bot, left, right)
for i = top, bot do
self:_clear_row_section(i, left, right)