diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ui/popupmenu_spec.lua | 55 | ||||
-rw-r--r-- | test/old/testdir/test_popup.vim | 25 |
2 files changed, 72 insertions, 8 deletions
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 26110b559d..c73d5bf97a 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -1181,6 +1181,26 @@ describe('builtin popupmenu', function() mn = { foreground = Screen.colors.Blue, background = Screen.colors.Plum1 }, ds = { foreground = Screen.colors.DarkRed, background = Screen.colors.Grey }, dn = { foreground = Screen.colors.DarkRed, background = Screen.colors.Plum1 }, + ums = { + foreground = Screen.colors.Blue, + background = Screen.colors.Grey, + underline = true, + }, + umn = { + foreground = Screen.colors.Blue, + background = Screen.colors.Plum1, + underline = true, + }, + uds = { + foreground = Screen.colors.DarkRed, + background = Screen.colors.Grey, + underline = true, + }, + udn = { + foreground = Screen.colors.DarkRed, + background = Screen.colors.Plum1, + underline = true, + }, }) screen:attach({ ext_multigrid = multigrid }) end) @@ -4934,10 +4954,9 @@ describe('builtin popupmenu', function() feed('<C-E><Esc>') end) - -- oldtest: Test_pum_extrahl() + -- oldtest: Test_pum_user_hl_group() it('custom hl_group override', function() exec([[ - hi StrikeFake guifg=DarkRed func CompleteFunc( findstart, base ) if a:findstart return 0 @@ -4951,8 +4970,15 @@ describe('builtin popupmenu', function() endfunc set completeopt=menu set completefunc=CompleteFunc + + hi StrikeFake guifg=DarkRed + func HlMatch() + hi PmenuMatchSel guifg=Blue guibg=Grey gui=underline + hi PmenuMatch guifg=Blue guibg=Plum1 gui=underline + endfunc ]]) - feed('<ESC>iaw<C-X><C-U>') + + feed('Saw<C-X><C-U>') screen:expect([[ aword1^ | {ds:aword1 W extra text 1 }{1: }| @@ -4961,6 +4987,29 @@ describe('builtin popupmenu', function() {1:~ }|*15 {2:-- }{5:match 1 of 3} | ]]) + feed('<C-E><Esc>') + + command('call HlMatch()') + + feed('Saw<C-X><C-U>') + screen:expect([[ + aword1^ | + {uds:aw}{ds:ord1 W extra text 1 }{1: }| + {umn:aw}{n:ord2 W extra text 2 }{1: }| + {dn:你好 W extra text 3 }{1: }| + {1:~ }|*15 + {2:-- }{5:match 1 of 3} | + ]]) + feed('<C-N>') + screen:expect([[ + aword2^ | + {udn:aw}{dn:ord1 W extra text 1 }{1: }| + {ums:aw}{s:ord2 W extra text 2 }{1: }| + {dn:你好 W extra text 3 }{1: }| + {1:~ }|*15 + {2:-- }{5:match 2 of 3} | + ]]) + feed('<C-E><Esc>') end) end end diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 1bba1d9397..5e234a397b 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1506,10 +1506,9 @@ func Test_pum_highlights_match() call StopVimInTerminal(buf) endfunc -func Test_pum_extrahl() +func Test_pum_user_hl_group() CheckScreendump let lines =<< trim END - hi StrikeFake ctermfg=9 func CompleteFunc( findstart, base ) if a:findstart return 0 @@ -1523,15 +1522,31 @@ func Test_pum_extrahl() endfunc set completeopt=menu set completefunc=CompleteFunc + + hi StrikeFake ctermfg=9 + func HlMatch() + hi PmenuMatchSel ctermfg=6 ctermbg=7 cterm=underline + hi PmenuMatch ctermfg=4 ctermbg=225 cterm=underline + endfunc END call writefile(lines, 'Xscript', 'D') let buf = RunVimInTerminal('-S Xscript', {}) + call TermWait(buf) - call term_sendkeys(buf, "iaw\<C-X>\<C-u>") - call TermWait(buf, 50) + call term_sendkeys(buf, "Saw\<C-X>\<C-U>") call VerifyScreenDump(buf, 'Test_pum_highlights_12', {}) - call term_sendkeys(buf, "\<C-E>\<Esc>u") + call term_sendkeys(buf, "\<C-E>\<Esc>") + call TermWait(buf) + call term_sendkeys(buf, ":call HlMatch()\<CR>") + + call TermWait(buf) + call term_sendkeys(buf, "Saw\<C-X>\<C-U>") + call VerifyScreenDump(buf, 'Test_pum_highlights_13', {}) + call term_sendkeys(buf, "\<C-N>") + call VerifyScreenDump(buf, 'Test_pum_highlights_14', {}) + call term_sendkeys(buf, "\<C-E>\<Esc>") + call StopVimInTerminal(buf) endfunc |