To: vim_dev@googlegroups.com Subject: Patch 9.0.0348 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0348 Problem: MS-Windows: GUI mouse move event test is flaky. Solution: Wait for a little while for the first move event. Files: src/testdir/test_gui.vim *** ../vim-9.0.0347/src/testdir/test_gui.vim 2022-08-31 21:17:06.461695535 +0100 --- src/testdir/test_gui.vim 2022-09-01 14:37:00.351276573 +0100 *************** *** 1212,1224 **** " Move the mouse to the top-left in preparation for mouse events func PrepareForMouseEvent(args) ! call extend(a:args, #{row: 1, col:1}) call test_gui_event('mouse', a:args) call feedkeys('', 'Lx!') ! " on MS-Windows the event may have a slight delay ! if has('win32') ! sleep 20m ! endif endfunc func MouseWasMoved() --- 1212,1231 ---- " Move the mouse to the top-left in preparation for mouse events func PrepareForMouseEvent(args) ! call extend(a:args, #{row: 1, col: 1}) call test_gui_event('mouse', a:args) + let g:eventlist = [] call feedkeys('', 'Lx!') ! ! " Wait a bit for the event. I may not come if the mouse didn't move, wait up ! " to 100 msec. ! for n in range(10) ! if len(g:eventlist) > 0 ! break ! endif ! sleep 10m ! endfor ! let g:eventlist = [] endfunc func MouseWasMoved() *************** *** 1229,1235 **** func Test_gui_mouse_move_event() let args = #{move: 1, button: 0, multiclick: 0, modifiers: 0} ! " by default, does not generate mouse move events set mousemev& call assert_false(&mousemev) --- 1236,1242 ---- func Test_gui_mouse_move_event() let args = #{move: 1, button: 0, multiclick: 0, modifiers: 0} ! " by default, no mouse move events are generated set mousemev& call assert_false(&mousemev) *************** *** 1238,1244 **** " start at mouse pos (1,1), clear counter call PrepareForMouseEvent(args) - let g:eventlist = [] call extend(args, #{row: 3, col: 30, cell: v:true}) call test_gui_event('mouse', args) --- 1245,1250 ---- *************** *** 1248,1260 **** call test_gui_event('mouse', args) call feedkeys('', 'Lx!') ! " no events since mousemev off call assert_equal([], g:eventlist) " turn on mouse events and try the same thing set mousemev call PrepareForMouseEvent(args) - let g:eventlist = [] call extend(args, #{row: 3, col: 30, cell: v:true}) call test_gui_event('mouse', args) --- 1254,1265 ---- call test_gui_event('mouse', args) call feedkeys('', 'Lx!') ! " no events since 'mousemev' is off call assert_equal([], g:eventlist) " turn on mouse events and try the same thing set mousemev call PrepareForMouseEvent(args) call extend(args, #{row: 3, col: 30, cell: v:true}) call test_gui_event('mouse', args) *************** *** 1274,1280 **** " wiggle the mouse around within a screen cell, shouldn't trigger events call extend(args, #{cell: v:false}) call PrepareForMouseEvent(args) - let g:eventlist = [] call extend(args, #{row: 1, col: 2, cell: v:false}) call test_gui_event('mouse', args) --- 1279,1284 ---- *** ../vim-9.0.0347/src/version.c 2022-09-01 13:19:53.410957280 +0100 --- src/version.c 2022-09-01 14:07:22.436606192 +0100 *************** *** 709,710 **** --- 709,712 ---- { /* Add new patch number below this line */ + /**/ + 348, /**/ -- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///