patch 9.0.1084: code handling low level MS-Windows events cannot be tested

Problem:    Code handling low level MS-Windows events cannot be tested.
Solution:   Add test_mswin_event() and tests using it. (Christopher Plewright,
            closes #11622)
This commit is contained in:
Christopher Plewright
2022-12-20 20:01:58 +00:00
committed by Bram Moolenaar
parent 418b547881
commit 20b795e0eb
17 changed files with 1490 additions and 74 deletions

View File

@ -94,7 +94,7 @@ test_gui_event({event}, {args})
"findrepl" search and replace text.
"mouse" mouse button click event.
"scrollbar" move or drag the scrollbar.
"sendevent" send a low-level GUI event.
"key" send a low-level keyboard event.
"tabline" select a tab page by mouse click.
"tabmenu" select a tabline menu entry.
@ -178,8 +178,8 @@ test_gui_event({event}, {args})
dragging: 1 to drag the scrollbar and 0 to click in the
scrollbar.
"sendevent":
Send a low-level GUI event (e.g. key-up or down).
"key":
Send a low-level keyboard event (e.g. key-up or down).
Currently only supported on MS-Windows.
The supported items in {args} are:
event: The supported string values are:
@ -223,6 +223,72 @@ test_ignore_error({expr}) *test_ignore_error()*
Can also be used as a |method|: >
GetErrorText()->test_ignore_error()
test_mswin_event({event}, {args}) *test_mswin_event()*
Generate a low-level MS-Windows {event} with arguments {args}
for testing Vim functionality. It works for MS-Windows GUI
and for the console.
{event} is a String and the supported values are:
"mouse" mouse event.
"key" keyboard event.
"mouse":
Inject either a mouse button click, or a mouse move, event.
The supported items in {args} are:
button: mouse button. The supported values are:
0 right mouse button
1 middle mouse button
2 left mouse button
3 mouse button release
4 scroll wheel down
5 scroll wheel up
6 scroll wheel left
7 scroll wheel right
row: mouse click row number. The first row of the
Vim window is 1 and the last row is 'lines'.
col: mouse click column number. The maximum value
of {col} is 'columns'.
Note: row and col are always interpreted as
screen cells for the console application.
But, they may be interpreted as pixels
for the GUI, depending on "cell".
multiclick: set to 1 to inject a double-click mouse event.
modifiers: key modifiers. The supported values are:
4 shift is pressed
8 alt is pressed
16 ctrl is pressed
move: Optional; if used and TRUE then a mouse move
event can be generated.
Only {args} row: and col: are used and
required.
Only results in an event when 'mousemoveevent'
is set or a popup uses mouse move events.
cell: Optional for the GUI: when present and TRUE
then "move" uses screen cells instead of pixel
positions. Not used by the console.
"key":
Send a low-level keyboard event (e.g. keyup or keydown).
The supported items in {args} are:
event: The supported string values are:
keyup generate a keyup event
keydown generate a keydown event
keycode: Keycode to use for a keyup or a keydown event.
modifiers: Optional; key modifiers.
The supported values are:
2 shift is pressed
4 ctrl is pressed
8 alt is pressed
Note: These values are different from the
mouse modifiers.
*E1291*
Returns TRUE if the event is successfully added, FALSE if
there is a failure.
Can also be used as a |method|: >
GetEvent()->test_mswin_event({args})
<
test_null_blob() *test_null_blob()*
Return a |Blob| that is null. Only useful for testing.