From 1b13c744eabaa08a4be0d114c35415c87c4e41cc Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 4 Jun 2021 21:50:32 -0400 Subject: vim-patch:8.2.2877: insufficient tests for popup menu rightleft Problem: Insufficient tests for popup menu rightleft. Solution: Add tests. (Yegappan Lakshmanan, closes vim/vim#8235) https://github.com/vim/vim/commit/1e615669c0f1f4125001b2c01c30b00d8c68035e --- src/nvim/testdir/test_popup.vim | 69 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim index 9443958984..e28edeff27 100644 --- a/src/nvim/testdir/test_popup.vim +++ b/src/nvim/testdir/test_popup.vim @@ -1077,4 +1077,73 @@ func Test_pum_getpos() unlet g:pum_pos endfunc +" Test for the popup menu with the 'rightleft' option set +func Test_pum_rightleft() + CheckScreendump + let lines =<< trim END + abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz + vim + victory + END + call writefile(lines, 'Xtest1') + let buf = RunVimInTerminal('--cmd "set rightleft" Xtest1', {}) + call term_wait(buf) + call term_sendkeys(buf, "Go\") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_pum_rightleft_01', {'rows': 8}) + call term_sendkeys(buf, "\\") + call term_wait(buf) + redraw! + call assert_match('\s*miv', Screenline(5)) + + " Test for expanding tabs to spaces in the popup menu + let lines =<< trim END + one two + one three + four + END + call writefile(lines, 'Xtest2') + call term_sendkeys(buf, "\:e! Xtest2\") + call term_wait(buf) + call term_sendkeys(buf, "Goone\\") + call term_wait(buf) + redraw! + call VerifyScreenDump(buf, 'Test_pum_rightleft_02', {'rows': 7}) + call term_sendkeys(buf, "\") + call term_wait(buf) + redraw! + call assert_match('\s*eerht eno', Screenline(4)) + + call StopVimInTerminal(buf) + call delete('Xtest1') + call delete('Xtest2') +endfunc + +" Test for a popup menu with a scrollbar +func Test_pum_scrollbar() + CheckScreendump + let lines =<< trim END + one + two + three + END + call writefile(lines, 'Xtest1') + let buf = RunVimInTerminal('--cmd "set pumheight=2" Xtest1', {}) + call term_wait(buf) + call term_sendkeys(buf, "Go\\\") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_pum_scrollbar_01', {'rows': 7}) + call term_sendkeys(buf, "\\dd") + call term_wait(buf) + + call term_sendkeys(buf, ":set rightleft\") + call term_wait(buf) + call term_sendkeys(buf, "Go\\\") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_pum_scrollbar_02', {'rows': 7}) + + call StopVimInTerminal(buf) + call delete('Xtest1') +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 60bf49ab1c80f23c533eb961457524b973e395ff Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 4 Jun 2021 21:51:13 -0400 Subject: vim-patch:8.2.2937: popup test fails if rightleft feature not enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Popup test fails if rightleft feature not enabled. Solution: Check that the rightleft feature is available. (Dominique Pellé, closes vim/vim#8321) https://github.com/vim/vim/commit/56cddb38790ba535919524d9d2f32dbec9f3f07a --- src/nvim/testdir/test_popup.vim | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim index e28edeff27..027533e1ad 100644 --- a/src/nvim/testdir/test_popup.vim +++ b/src/nvim/testdir/test_popup.vim @@ -1079,7 +1079,9 @@ endfunc " Test for the popup menu with the 'rightleft' option set func Test_pum_rightleft() + CheckFeature rightleft CheckScreendump + let lines =<< trim END abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz vim @@ -1136,11 +1138,13 @@ func Test_pum_scrollbar() call term_sendkeys(buf, "\\dd") call term_wait(buf) - call term_sendkeys(buf, ":set rightleft\") - call term_wait(buf) - call term_sendkeys(buf, "Go\\\") - call term_wait(buf) - call VerifyScreenDump(buf, 'Test_pum_scrollbar_02', {'rows': 7}) + if has('rightleft') + call term_sendkeys(buf, ":set rightleft\") + call term_wait(buf) + call term_sendkeys(buf, "Go\\\") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_pum_scrollbar_02', {'rows': 7}) + endif call StopVimInTerminal(buf) call delete('Xtest1') -- cgit From b959de3a5fca16b9bbd49e30da5dfcbd62bd9970 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 4 Jun 2021 22:18:24 -0400 Subject: vim-patch:8.0.1578: no test for :popup in terminal Problem: No test for :popup in terminal. Solution: Add a screen dump test. https://github.com/vim/vim/commit/69f5a3011d5a93e0d54837e97d625bd6c253d897 --- src/nvim/testdir/test_popup.vim | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim index 027533e1ad..06bdb1236a 100644 --- a/src/nvim/testdir/test_popup.vim +++ b/src/nvim/testdir/test_popup.vim @@ -850,6 +850,34 @@ func Test_popup_position() call delete('Xtest') endfunc +func Test_popup_command() + if !CanRunVimInTerminal() || !has('menu') + return + endif + + call writefile([ + \ 'one two three four five', + \ 'and one two Xthree four five', + \ 'one more two three four five', + \ ], 'Xtest') + let buf = RunVimInTerminal('Xtest', {}) + call term_sendkeys(buf, ":source $VIMRUNTIME/menu.vim\") + call term_sendkeys(buf, "/X\:popup PopUp\") + call VerifyScreenDump(buf, 'Test_popup_command_01', {}) + + " Select a word + call term_sendkeys(buf, "jj") + call VerifyScreenDump(buf, 'Test_popup_command_02', {}) + + " Select a word + call term_sendkeys(buf, "j\") + call VerifyScreenDump(buf, 'Test_popup_command_03', {}) + + call term_sendkeys(buf, "\") + call StopVimInTerminal(buf) + call delete('Xtest') +endfunc + func Test_popup_complete_backwards() new call setline(1, ['Post', 'Port', 'Po']) -- cgit