diff src/testdir/test_popupwin_textprop.vim @ 17879:5d5b460926ca v8.1.1936

patch 8.1.1936: not enough tests for text property popup window Commit: https://github.com/vim/vim/commit/1fb0831a0e9f9b6f18f1f8b549191bd547d0e095 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 29 20:02:11 2019 +0200 patch 8.1.1936: not enough tests for text property popup window Problem: Not enough tests for text property popup window. Solution: Add a few more tests. Make negative offset work. Close all popups when window closes.
author Bram Moolenaar <Bram@vim.org>
date Thu, 29 Aug 2019 20:15:04 +0200
parents 642832e45388
children 15fe2bd478b0
line wrap: on
line diff
--- a/src/testdir/test_popupwin_textprop.vim
+++ b/src/testdir/test_popupwin_textprop.vim
@@ -45,6 +45,9 @@ func Test_textprop_popup()
   call term_sendkeys(buf, "k2dd")
   call VerifyScreenDump(buf, 'Test_popup_textprop_06', {})
 
+  call term_sendkeys(buf, "4\<C-E>")
+  call VerifyScreenDump(buf, 'Test_popup_textprop_07', {})
+
   " clean up
   call StopVimInTerminal(buf)
   call delete('XtestTextpropPopup')
@@ -99,10 +102,72 @@ func Test_textprop_popup_corners()
   call term_sendkeys(buf, ":\<CR>")
   call VerifyScreenDump(buf, 'Test_popup_textprop_corn_4', {})
 
+  call term_sendkeys(buf, ":vsplit foo\<CR>")
+  call VerifyScreenDump(buf, 'Test_popup_textprop_corn_5', {})
+
+  call term_sendkeys(buf, ":only!\<CR>")
+  call VerifyScreenDump(buf, 'Test_popup_textprop_corn_6', {})
+
   " clean up
   call StopVimInTerminal(buf)
   call delete('XtestTextpropPopupCorners')
 endfunc
 
+func Test_textprop_popup_offsets()
+  let lines =<< trim END
+	call setline(1, range(1, 100))
+	call setline(50, 'now working with some longer text here')
+	50
+	normal zz
+	set scrolloff=0
+	call prop_type_add('popupMarker', #{highlight: 'DiffAdd'})
+	call prop_add(50, 23, #{
+		\ length: 6,
+		\ type: 'popupMarker',
+		\ })
+	let winid = popup_create('bottom left', #{
+	      \ pos: 'botleft', 
+	      \ line: -1,
+	      \ col: 2,
+	      \ textprop: 'popupMarker',
+	      \ padding: [0,1,0,1],
+	      \ })
+	let winid = popup_create('bottom right', #{
+	      \ pos: 'botright', 
+	      \ line: -1,
+	      \ col: -2,
+	      \ textprop: 'popupMarker',
+	      \ border: [],
+	      \ padding: [0,1,0,1],
+	      \ })
+	let winid = popup_create('top left', #{
+	      \ pos: 'topleft', 
+	      \ line: 1,
+	      \ col: 2,
+	      \ textprop: 'popupMarker',
+	      \ border: [],
+	      \ padding: [0,1,0,1],
+	      \ })
+	let winid = popup_create('top right', #{
+	      \ pos: 'topright', 
+	      \ line: 1,
+	      \ col: -2,
+	      \ textprop: 'popupMarker',
+	      \ padding: [0,1,0,1],
+	      \ })
+  END
+  call writefile(lines, 'XtestTextpropPopupOffset')
+  let buf = RunVimInTerminal('-S XtestTextpropPopupOffset', #{rows: 12})
+  call VerifyScreenDump(buf, 'Test_popup_textprop_off_1', {})
+
+  " test that removing the text property closes the popups
+  call term_sendkeys(buf, ":call prop_clear(50)\<CR>")
+  call VerifyScreenDump(buf, 'Test_popup_textprop_off_2', {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('XtestTextpropPopupOffset')
+endfunc
+
 
 " vim: shiftwidth=2 sts=2