diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ui/popupmenu_spec.lua | 102 | ||||
-rw-r--r-- | test/old/testdir/test_popup.vim | 60 |
2 files changed, 162 insertions, 0 deletions
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 3acbd5d987..e2f7e31c6c 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -5061,6 +5061,108 @@ describe('builtin popupmenu', function() ]]) feed('<C-E><Esc>') end) + + -- oldtest: Test_pum_completeitemalign() + it('completeitemalign option', function() + screen:try_resize(30, 15) + exec([[ + func Omni_test(findstart, base) + if a:findstart + return col(".") + endif + return { + \ 'words': [ + \ { 'word': 'foo', 'kind': 'S', 'menu': 'menu' }, + \ { 'word': 'bar', 'kind': 'T', 'menu': 'menu' }, + \ { 'word': '你好', 'kind': 'C', 'menu': '中文' }, + \]} + endfunc + set omnifunc=Omni_test + ]]) + -- T1 + command('set cia=abbr,kind,menu') + feed('S<C-X><C-O>') + screen:expect([[ + foo^ | + {s:foo S menu }{1: }| + {n:bar T menu }{1: }| + {n:你好 C 中文 }{1: }| + {1:~ }|*10 + {2:-- }{5:match 1 of 3} | + ]]) + feed('<C-E><ESC>') + -- T2 + command('set cia=abbr,menu,kind') + feed('S<C-X><C-O>') + screen:expect([[ + foo^ | + {s:foo menu S }{1: }| + {n:bar menu T }{1: }| + {n:你好 中文 C }{1: }| + {1:~ }|*10 + {2:-- }{5:match 1 of 3} | + ]]) + feed('<C-E><ESC>') + -- T3 + command('set cia=kind,abbr,menu') + feed('S<C-X><C-O>') + screen:expect([[ + foo^ | + {s:S foo menu }{1: }| + {n:T bar menu }{1: }| + {n:C 你好 中文 }{1: }| + {1:~ }|*10 + {2:-- }{5:match 1 of 3} | + ]]) + feed('<C-E><ESC>') + -- T4 + command('set cia=kind,menu,abbr') + feed('S<C-X><C-O>') + screen:expect([[ + foo^ | + {s:S menu foo }{1: }| + {n:T menu bar }{1: }| + {n:C 中文 你好 }{1: }| + {1:~ }|*10 + {2:-- }{5:match 1 of 3} | + ]]) + feed('<C-E><ESC>') + -- T5 + command('set cia=menu,abbr,kind') + feed('S<C-X><C-O>') + screen:expect([[ + foo^ | + {s:menu foo S }{1: }| + {n:menu bar T }{1: }| + {n:中文 你好 C }{1: }| + {1:~ }|*10 + {2:-- }{5:match 1 of 3} | + ]]) + feed('<C-E><ESC>') + -- T6 + command('set cia=menu,kind,abbr') + feed('S<C-X><C-O>') + screen:expect([[ + foo^ | + {s:menu S foo }{1: }| + {n:menu T bar }{1: }| + {n:中文 C 你好 }{1: }| + {1:~ }|*10 + {2:-- }{5:match 1 of 3} | + ]]) + feed('<C-E><ESC>') + -- T7 + command('set cia&') + feed('S<C-X><C-O>') + screen:expect([[ + foo^ | + {s:foo S menu }{1: }| + {n:bar T menu }{1: }| + {n:你好 C 中文 }{1: }| + {1:~ }|*10 + {2:-- }{5:match 1 of 3} | + ]]) + end) end end diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 2a038d7da4..f9c6d2eedd 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1583,4 +1583,64 @@ func Test_pum_user_kind_hlgroup() call StopVimInTerminal(buf) endfunc +func Test_pum_completeitemalign() + CheckScreendump + let lines =<< trim END + func Omni_test(findstart, base) + if a:findstart + return col(".") + endif + return { + \ 'words': [ + \ { 'word': 'foo', 'kind': 'S', 'menu': 'menu' }, + \ { 'word': 'bar', 'kind': 'T', 'menu': 'menu' }, + \ { 'word': '你好', 'kind': 'C', 'menu': '中文' }, + \]} + endfunc + set omnifunc=Omni_test + command! -nargs=0 T1 set cia=abbr,kind,menu + command! -nargs=0 T2 set cia=abbr,menu,kind + command! -nargs=0 T3 set cia=kind,abbr,menu + command! -nargs=0 T4 set cia=kind,menu,abbr + command! -nargs=0 T5 set cia=menu,abbr,kind + command! -nargs=0 T6 set cia=menu,kind,abbr + command! -nargs=0 T7 set cia& + END + call writefile(lines, 'Xscript', 'D') + let buf = RunVimInTerminal('-S Xscript', {}) + call TermWait(buf) + + " T1 is default + call term_sendkeys(buf, ":T1\<CR>S\<C-X>\<C-O>") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_01', {}) + call term_sendkeys(buf, "\<C-E>\<Esc>") + + " T2 + call term_sendkeys(buf, ":T2\<CR>S\<C-X>\<C-O>") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_02', {}) + call term_sendkeys(buf, "\<C-E>\<Esc>") + + " T3 + call term_sendkeys(buf, ":T3\<CR>S\<C-X>\<C-O>") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_03', {}) + call term_sendkeys(buf, "\<C-E>\<Esc>") + + " T4 + call term_sendkeys(buf, ":T4\<CR>S\<C-X>\<C-O>") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_04', {}) + call term_sendkeys(buf, "\<C-E>\<Esc>") + + " T5 + call term_sendkeys(buf, ":T5\<CR>S\<C-X>\<C-O>") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_05', {}) + call term_sendkeys(buf, "\<C-E>\<Esc>") + + " T6 + call term_sendkeys(buf, ":T6\<CR>S\<C-X>\<C-O>") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_06', {}) + call term_sendkeys(buf, "\<C-E>\<Esc>:T7\<CR>") + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab |