diff options
author | Ernie Rael <errael@raelity.com> | 2022-04-03 15:47:28 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-04-03 15:47:28 +0100 |
commit | c4cb544cd5beaa864b3893e4b8d0085393c7dbce (patch) | |
tree | 3e04f56d7b0a6d71d3bcb40c9107b031cf5bd949 /src/testdir/test_gui.vim | |
parent | 8ef6997e2d90808dec033373c96dda68843af12e (diff) |
patch 8.2.4674: cannot force getting MouseMove eventsv8.2.4674
Problem: Cannot force getting MouseMove events.
Solution: Add the 'mousemoveevent' option with implementaiton for the GUI.
(Ernie Rael, closes #10044)
Diffstat (limited to 'src/testdir/test_gui.vim')
-rw-r--r-- | src/testdir/test_gui.vim | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim index 7947288c72..c5332b8c22 100644 --- a/src/testdir/test_gui.vim +++ b/src/testdir/test_gui.vim @@ -1194,6 +1194,78 @@ func Test_gui_mouse_event() set mousemodel& endfunc +func Test_gui_mouse_move_event() + let args = #{move: 1, button: 0, multiclick: 0, modifiers: 0} + + " default, do not generate mouse move events + set mousemev& + call assert_false(&mousemev) + + let n_event = 0 + nnoremap <special> <MouseMove> :let n_event += 1<CR> + + " start at mouse pos (1,1), clear counter + call extend(args, #{row: 1, col:1}) + call test_gui_event('mouse', args) + call feedkeys('', 'Lx!') + let n_event = 0 + + call extend(args, #{row: 30, col:300}) + call test_gui_event('mouse', args) + call feedkeys('', 'Lx!') + + call extend(args, #{row: 100, col:300}) + call test_gui_event('mouse', args) + call feedkeys('', 'Lx!') + + " no events since mousemev off + call assert_equal(0, n_event) + + " turn on mouse events and try the same thing + set mousemev + call extend(args, #{row: 1, col:1}) + call test_gui_event('mouse', args) + call feedkeys('', 'Lx!') + let n_event = 0 + + call extend(args, #{row: 30, col:300}) + call test_gui_event('mouse', args) + call feedkeys('', 'Lx!') + + call extend(args, #{row: 100, col:300}) + call test_gui_event('mouse', args) + call feedkeys('', 'Lx!') + + call assert_equal(2, n_event) + + " wiggle the mouse around, shouldn't get events + call extend(args, #{row: 1, col:1}) + call test_gui_event('mouse', args) + call feedkeys('', 'Lx!') + let n_event = 0 + + call extend(args, #{row: 1, col:2}) + call test_gui_event('mouse', args) + call feedkeys('', 'Lx!') + + call extend(args, #{row: 2, col:2}) + call test_gui_event('mouse', args) + call feedkeys('', 'Lx!') + + call extend(args, #{row: 2, col:1}) + call test_gui_event('mouse', args) + call feedkeys('', 'Lx!') + + call extend(args, #{row: 1, col:1}) + call test_gui_event('mouse', args) + call feedkeys('', 'Lx!') + + call assert_equal(0, n_event) + + unmap <MouseMove> + set mousemev& +endfunc + " Test for 'guitablabel' and 'guitabtooltip' options func TestGuiTabLabel() call add(g:TabLabels, v:lnum + 100) |