1
0
forked from aniani/vim

patch 9.0.0348: MS-Windows: GUI mouse move event test is flaky

Problem:    MS-Windows: GUI mouse move event test is flaky.
Solution:   Wait for a little while for the first move event.
This commit is contained in:
Bram Moolenaar
2022-09-01 14:38:01 +01:00
parent df5320c439
commit 36eb14fa3e
2 changed files with 16 additions and 10 deletions

View File

@@ -1214,11 +1214,18 @@ endfunc
func PrepareForMouseEvent(args) func PrepareForMouseEvent(args)
call extend(a:args, #{row: 1, col: 1}) call extend(a:args, #{row: 1, col: 1})
call test_gui_event('mouse', a:args) call test_gui_event('mouse', a:args)
let g:eventlist = []
call feedkeys('', 'Lx!') call feedkeys('', 'Lx!')
" on MS-Windows the event may have a slight delay
if has('win32') " Wait a bit for the event. I may not come if the mouse didn't move, wait up
sleep 20m " to 100 msec.
for n in range(10)
if len(g:eventlist) > 0
break
endif endif
sleep 10m
endfor
let g:eventlist = []
endfunc endfunc
func MouseWasMoved() func MouseWasMoved()
@@ -1229,7 +1236,7 @@ endfunc
func Test_gui_mouse_move_event() func Test_gui_mouse_move_event()
let args = #{move: 1, button: 0, multiclick: 0, modifiers: 0} let args = #{move: 1, button: 0, multiclick: 0, modifiers: 0}
" by default, does not generate mouse move events " by default, no mouse move events are generated
set mousemev& set mousemev&
call assert_false(&mousemev) call assert_false(&mousemev)
@@ -1238,7 +1245,6 @@ func Test_gui_mouse_move_event()
" start at mouse pos (1,1), clear counter " start at mouse pos (1,1), clear counter
call PrepareForMouseEvent(args) call PrepareForMouseEvent(args)
let g:eventlist = []
call extend(args, #{row: 3, col: 30, cell: v:true}) call extend(args, #{row: 3, col: 30, cell: v:true})
call test_gui_event('mouse', args) call test_gui_event('mouse', args)
@@ -1248,13 +1254,12 @@ func Test_gui_mouse_move_event()
call test_gui_event('mouse', args) call test_gui_event('mouse', args)
call feedkeys('', 'Lx!') call feedkeys('', 'Lx!')
" no events since mousemev off " no events since 'mousemev' is off
call assert_equal([], g:eventlist) call assert_equal([], g:eventlist)
" turn on mouse events and try the same thing " turn on mouse events and try the same thing
set mousemev set mousemev
call PrepareForMouseEvent(args) call PrepareForMouseEvent(args)
let g:eventlist = []
call extend(args, #{row: 3, col: 30, cell: v:true}) call extend(args, #{row: 3, col: 30, cell: v:true})
call test_gui_event('mouse', args) call test_gui_event('mouse', args)
@@ -1274,7 +1279,6 @@ func Test_gui_mouse_move_event()
" wiggle the mouse around within a screen cell, shouldn't trigger events " wiggle the mouse around within a screen cell, shouldn't trigger events
call extend(args, #{cell: v:false}) call extend(args, #{cell: v:false})
call PrepareForMouseEvent(args) call PrepareForMouseEvent(args)
let g:eventlist = []
call extend(args, #{row: 1, col: 2, cell: v:false}) call extend(args, #{row: 1, col: 2, cell: v:false})
call test_gui_event('mouse', args) call test_gui_event('mouse', args)

View File

@@ -707,6 +707,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
348,
/**/ /**/
347, 347,
/**/ /**/