aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-02-05 16:17:23 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2019-02-05 19:41:38 +0100
commitbaf93d96063ceab109ecf16046a51e861a9c2c26 (patch)
tree206993aff9892e2beee704c84448221accebdb15 /test
parent36378c33c6ca6b5c906b8ab326db508feb32c859 (diff)
downloadrneovim-baf93d96063ceab109ecf16046a51e861a9c2c26.tar.gz
rneovim-baf93d96063ceab109ecf16046a51e861a9c2c26.tar.bz2
rneovim-baf93d96063ceab109ecf16046a51e861a9c2c26.zip
UI: always use contrete colors for default_colors_set
But add an escape hatch needed for external TUI, so it still can use terminal emulator defaults.
Diffstat (limited to 'test')
-rw-r--r--test/functional/api/vim_spec.lua1
-rw-r--r--test/functional/terminal/tui_spec.lua12
-rw-r--r--test/functional/ui/options_spec.lua1
-rw-r--r--test/functional/ui/screen_basic_spec.lua43
4 files changed, 51 insertions, 6 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 0d49eb2daf..415eaf3cbc 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -1278,6 +1278,7 @@ describe('API', function()
ext_linegrid = screen._options.ext_linegrid or false,
ext_multigrid = false,
ext_hlstate=false,
+ ext_termcolors=false,
height = 4,
rgb = true,
width = 20,
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index cc6ce30038..f1ad2bdb95 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -256,13 +256,13 @@ describe('TUI', function()
end)
it('shows up in nvim_list_uis', function()
- feed_data(':echo map(nvim_list_uis(), {k,v -> sort(items(v))})\013')
+ feed_data(':echo map(nvim_list_uis(), {k,v -> sort(items(filter(v, {k,v -> k[:3] !=# "ext_" })))})\013')
screen:expect([=[
- [[['ext_cmdline', v:false], ['ext_hlstate', v:fals|
- e], ['ext_linegrid', v:true], ['ext_multigrid', v:|
- false], ['ext_popupmenu', v:false], ['ext_tabline'|
- , v:false], ['ext_wildmenu', v:false], ['height', |
- 6], ['rgb', v:false], ['width', 50]]] |
+ |
+ {4:~ }|
+ {5: }|
+ [[['height', 6], ['rgb', v:false], ['width', 50]]]|
+ |
{10:Press ENTER or type command to continue}{1: } |
{3:-- TERMINAL --} |
]=])
diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua
index c26fa5e29b..493079b576 100644
--- a/test/functional/ui/options_spec.lua
+++ b/test/functional/ui/options_spec.lua
@@ -27,6 +27,7 @@ describe('ui receives option updates', function()
ext_linegrid=false,
ext_hlstate=false,
ext_multigrid=false,
+ ext_termcolors=false,
}
clear(...)
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index 04d532f6e1..46f0b5060c 100644
--- a/test/functional/ui/screen_basic_spec.lua
+++ b/test/functional/ui/screen_basic_spec.lua
@@ -960,3 +960,46 @@ end)
describe("Screen (line-based)", function()
screen_tests(true)
end)
+
+describe('Screen default colors', function()
+ local screen
+ local function startup(light, termcolors)
+ local extra = (light and ' background=light') or ''
+
+ local nvim_argv = {helpers.nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N',
+ '--cmd', 'set shortmess+=I noswapfile belloff= noshowcmd noruler'..extra,
+ '--embed'}
+ local screen_nvim = spawn(nvim_argv)
+ set_session(screen_nvim)
+ screen = Screen.new()
+ screen:attach(termcolors and {rgb=true,ext_termcolors=true} or {rgb=true})
+ end
+
+ it('are dark per default', function()
+ startup(false, false)
+ screen:expect{condition=function()
+ eq({rgb_bg=0, rgb_fg=Screen.colors.White, rgb_sp=Screen.colors.Red,
+ cterm_bg=0, cterm_fg=0}, screen.default_colors)
+ end}
+ end)
+
+ it('can be set to light', function()
+ startup(true, false)
+ screen:expect{condition=function()
+ eq({rgb_bg=Screen.colors.White, rgb_fg=0, rgb_sp=Screen.colors.Red,
+ cterm_bg=0, cterm_fg=0}, screen.default_colors)
+ end}
+ end)
+
+ it('can be handled by external terminal', function()
+ startup(false, true)
+ screen:expect{condition=function()
+ eq({rgb_bg=-1, rgb_fg=-1, rgb_sp=-1, cterm_bg=0, cterm_fg=0}, screen.default_colors)
+ end}
+
+ startup(true, true)
+ screen:expect{condition=function()
+ eq({rgb_bg=-1, rgb_fg=-1, rgb_sp=-1, cterm_bg=0, cterm_fg=0}, screen.default_colors)
+ end}
+ end)
+end)