diff src/testdir/test_popupwin.vim @ 17847:bdddd215bf09 v8.1.1920

patch 8.1.1920: cannot always close a popup when filter consumes all events Commit: https://github.com/vim/vim/commit/f63962378dc32c7253e4825b4b0f414a81c1dd3e Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 24 19:36:00 2019 +0200 patch 8.1.1920: cannot always close a popup when filter consumes all events Problem: Cannot close a popup by the X when a filter consumes all events. Solution: Check for a click on the close button before invoking filters. (closes #4858)
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Aug 2019 19:45:03 +0200
parents b6acc24df7de
children fa032e079825
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -420,6 +420,15 @@ func Test_popup_close_with_mouse()
 	  call feedkeys("\<F4>\<LeftMouse>\<LeftRelease>", "xt")
 	endfunc
 	map <silent> <F4> :call test_setmouse(3, 17)<CR>
+	func CreateWithMenuFilter()
+	  let winid = popup_create('barfoo', #{
+		\ close: 'button',
+		\ filter: 'popup_filter_menu',
+		\ border: [],
+		\ line: 1,
+		\ col: 40,
+		\ })
+	endfunc
   END
   call writefile(lines, 'XtestPopupClose')
   let buf = RunVimInTerminal('-S XtestPopupClose', #{rows: 10})
@@ -431,6 +440,14 @@ func Test_popup_close_with_mouse()
   call term_sendkeys(buf, ":call CloseWithClick()\<CR>")
   call VerifyScreenDump(buf, 'Test_popupwin_close_03', {})
 
+  call term_sendkeys(buf, ":call CreateWithMenuFilter()\<CR>")
+  call VerifyScreenDump(buf, 'Test_popupwin_close_04', {})
+
+  " We have to send the actual mouse code, feedkeys() would be caught the
+  " filter.
+  call term_sendkeys(buf, "\<Esc>[<0;47;1M")
+  call VerifyScreenDump(buf, 'Test_popupwin_close_05', {})
+
   " clean up
   call StopVimInTerminal(buf)
   call delete('XtestPopupClose')