diff src/testdir/test_popup.vim @ 13329:424321d6eea7 v8.0.1539

patch 8.0.1539: no test for the popup menu positioning commit https://github.com/vim/vim/commit/6bb2cdfe604e51eec216cbe23bb6e8fb47810347 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 24 19:53:53 2018 +0100 patch 8.0.1539: no test for the popup menu positioning Problem: No test for the popup menu positioning. Solution: Add a screendump test for the popup menu.
author Christian Brabandt <cb@256bit.org>
date Sat, 24 Feb 2018 20:00:07 +0100
parents ae5f855a64be
children 1ba4f926247c
line wrap: on
line diff
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -1,6 +1,7 @@
 " Test for completion menu
 
 source shared.vim
+source screendump.vim
 
 let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
 let g:setting = ''
@@ -743,4 +744,37 @@ func Test_balloon_split()
         \ 'struct = 0x234 {long = 2343 "\\"some long string that will be wrapped in two\\"", next = 123}'))
 endfunc
 
+func Test_popup_position()
+  if !CanRunVimInTerminal()
+    return
+  endif
+  call writefile([
+	\ '123456789_123456789_123456789_a',
+	\ '123456789_123456789_123456789_b',
+	\ '            123',
+	\ ], 'Xtest')
+  let buf = RunVimInTerminal('Xtest', {})
+  call term_sendkeys(buf, ":vsplit\<CR>")
+
+  " default pumwidth in left window: overlap in right window
+  call term_sendkeys(buf, "GA\<C-N>")
+  call VerifyScreenDump(buf, 'Test_popup_position_01', {'rows': 8})
+  call term_sendkeys(buf, "\<Esc>u")
+
+  " default pumwidth: fill until right of window
+  call term_sendkeys(buf, "\<C-W>l")
+  call term_sendkeys(buf, "GA\<C-N>")
+  call VerifyScreenDump(buf, 'Test_popup_position_02', {'rows': 8})
+
+  " larger pumwidth: used as minimum width
+  call term_sendkeys(buf, "\<Esc>u")
+  call term_sendkeys(buf, ":set pumwidth=30\<CR>")
+  call term_sendkeys(buf, "GA\<C-N>")
+  call VerifyScreenDump(buf, 'Test_popup_position_03', {'rows': 8})
+
+  call term_sendkeys(buf, "\<Esc>u")
+  call StopVimInTerminal(buf)
+  call delete('Xtest')
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab