diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/api/vim_spec.lua | 13 | ||||
-rw-r--r-- | test/functional/ui/cursor_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/ui/winbar_spec.lua | 180 |
3 files changed, 195 insertions, 2 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index ba170ba8c5..c4748cc00d 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -3102,6 +3102,19 @@ describe('API', function() 'TextWithNoHighlight%#WarningMsg#TextWithWarningHighlight', { use_tabline = true, highlights = true })) end) + it('works with winbar', function() + eq({ + str = 'TextWithNoHighlightTextWithWarningHighlight', + width = 43, + highlights = { + { start = 0, group = 'WinBar' }, + { start = 19, group = 'WarningMsg' } + } + }, + meths.eval_statusline( + 'TextWithNoHighlight%#WarningMsg#TextWithWarningHighlight', + { use_winbar = true, highlights = true })) + end) end) end) describe('nvim_parse_cmd', function() diff --git a/test/functional/ui/cursor_spec.lua b/test/functional/ui/cursor_spec.lua index 92300a8fa2..d61eebe3ea 100644 --- a/test/functional/ui/cursor_spec.lua +++ b/test/functional/ui/cursor_spec.lua @@ -212,10 +212,10 @@ describe('ui/cursor', function() if m.blinkwait then m.blinkwait = 700 end end if m.hl_id then - m.hl_id = 62 + m.hl_id = 64 m.attr = {background = Screen.colors.DarkGray} end - if m.id_lm then m.id_lm = 63 end + if m.id_lm then m.id_lm = 65 end end -- Assert the new expectation. diff --git a/test/functional/ui/winbar_spec.lua b/test/functional/ui/winbar_spec.lua new file mode 100644 index 0000000000..6cf587d47b --- /dev/null +++ b/test/functional/ui/winbar_spec.lua @@ -0,0 +1,180 @@ +local helpers = require('test.functional.helpers')(after_each) +local Screen = require('test.functional.ui.screen') +local clear = helpers.clear +local command = helpers.command + +describe('winbar', function() + local screen + + before_each(function() + clear() + screen = Screen.new(60, 13) + screen:attach() + screen:set_default_attr_ids({ + [1] = {bold = true}, + [2] = {reverse = true}, + [3] = {bold = true, foreground = Screen.colors.Blue}, + [4] = {bold = true, reverse = true}, + [5] = {bold = true, foreground = Screen.colors.Red}, + [6] = {foreground = Screen.colors.Blue}, + }) + command('set winbar=Set\\ Up\\ The\\ Bars') + end) + it('works', function() + screen:expect([[ + {1:Set Up The Bars }| + ^ | + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + | + ]]) + end) + it('works with custom \'fillchars\' value', function() + command('set fillchars=wbr:+') + screen:expect([[ + {1:Set Up The Bars+++++++++++++++++++++++++++++++++++++++++++++}| + ^ | + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + | + ]]) + end) + it('works with custom highlight', function() + command('hi WinBar guifg=red') + screen:expect([[ + {5:Set Up The Bars }| + ^ | + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + | + ]]) + end) + it('works with splits', function() + command('hi WinBar guifg=red') + command('hi WinBarNC guifg=blue') + command('belowright vsplit | split | split') + screen:expect([[ + {6:Set Up The Bars }│{5:Set Up The Bars }| + │^ | + {3:~ }│{3:~ }| + {3:~ }│{4:[No Name] }| + {3:~ }│{6:Set Up The Bars }| + {3:~ }│ | + {3:~ }│{3:~ }| + {3:~ }│{2:[No Name] }| + {3:~ }│{6:Set Up The Bars }| + {3:~ }│ | + {3:~ }│{3:~ }| + {2:[No Name] [No Name] }| + | + ]]) + end) + it('works when switching value of \'winbar\'', function() + command('belowright vsplit | split | split | set winbar=') + screen:expect([[ + │^ | + {3:~ }│{3:~ }| + {3:~ }│{3:~ }| + {3:~ }│{4:[No Name] }| + {3:~ }│ | + {3:~ }│{3:~ }| + {3:~ }│{3:~ }| + {3:~ }│{2:[No Name] }| + {3:~ }│ | + {3:~ }│{3:~ }| + {3:~ }│{3:~ }| + {2:[No Name] [No Name] }| + | + ]]) + command('set winbar=All\\ Your\\ Bar\\ Are\\ Belong\\ To\\ Us') + screen:expect([[ + {1:All Your Bar Are Belong To Us}│{1:All Your Bar Are Belong To Us }| + │^ | + {3:~ }│{3:~ }| + {3:~ }│{4:[No Name] }| + {3:~ }│{1:All Your Bar Are Belong To Us }| + {3:~ }│ | + {3:~ }│{3:~ }| + {3:~ }│{2:[No Name] }| + {3:~ }│{1:All Your Bar Are Belong To Us }| + {3:~ }│ | + {3:~ }│{3:~ }| + {2:[No Name] [No Name] }| + | + ]]) + command('set winbar=Changed\\ winbar') + screen:expect([[ + {1:Changed winbar }│{1:Changed winbar }| + │^ | + {3:~ }│{3:~ }| + {3:~ }│{4:[No Name] }| + {3:~ }│{1:Changed winbar }| + {3:~ }│ | + {3:~ }│{3:~ }| + {3:~ }│{2:[No Name] }| + {3:~ }│{1:Changed winbar }| + {3:~ }│ | + {3:~ }│{3:~ }| + {2:[No Name] [No Name] }| + | + ]]) + end) + it('works with laststatus=3', function() + command('set laststatus=3') + screen:expect([[ + {1:Set Up The Bars }| + ^ | + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {3:~ }| + {4:[No Name] }| + | + ]]) + command('belowright vsplit | split | split') + screen:expect([[ + {1:Set Up The Bars }│{1:Set Up The Bars }| + │^ | + {3:~ }│{3:~ }| + {3:~ }├──────────────────────────────| + {3:~ }│{1:Set Up The Bars }| + {3:~ }│ | + {3:~ }│{3:~ }| + {3:~ }├──────────────────────────────| + {3:~ }│{1:Set Up The Bars }| + {3:~ }│ | + {3:~ }│{3:~ }| + {4:[No Name] }| + | + ]]) + end) +end) |