summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2022-01-30 12:37:29 +0000
committerBram Moolenaar <Bram@vim.org>2022-01-30 12:37:29 +0000
commit06011e1a55f32e47fe0af4bd449be6f0e3ff0814 (patch)
tree7e29a992f7857b281f72ee6be1bdd66eb50753c1 /runtime
parent6970e1e36a1ecdb4d330d6ac9ca76f97fa515e36 (diff)
patch 8.2.4259: number of test functions for GUI events is growingv8.2.4259
Problem: Number of test functions for GUI events is growing. Solution: Use one function with a dictionary. (Yegappan Lakshmanan, closes #9660)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/builtin.txt8
-rw-r--r--runtime/doc/testing.txt122
-rw-r--r--runtime/doc/usr_41.txt5
3 files changed, 70 insertions, 65 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index aaf4e3b5e4..33bb907378 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -642,13 +642,7 @@ test_feedinput({string}) none add key sequence to input buffer
test_garbagecollect_now() none free memory right now for testing
test_garbagecollect_soon() none free memory soon for testing
test_getvalue({string}) any get value of an internal variable
-test_gui_drop_files({list}, {row}, {col}, {mods})
- none drop a list of files in a window
-test_gui_mouse_event({button}, {row}, {col}, {repeated}, {mods})
- none add a mouse event to the input buffer
-test_gui_tabline_event({tabnr}) Bool add a tabline event to the input buffer
-test_gui_tabmenu_event({tabnr}, {event})
- none add a tabmenu event to the input buffer
+test_gui_event({event}, {args}) bool generate a GUI event for testing
test_ignore_error({expr}) none ignore a specific error
test_null_blob() Blob null value for testing
test_null_channel() Channel null value for testing
diff --git a/runtime/doc/testing.txt b/runtime/doc/testing.txt
index ed5f98a565..22ef0d7b34 100644
--- a/runtime/doc/testing.txt
+++ b/runtime/doc/testing.txt
@@ -82,64 +82,78 @@ test_getvalue({name}) *test_getvalue()*
Can also be used as a |method|: >
GetName()->test_getvalue()
<
- *test_gui_drop_files()*
-test_gui_drop_files({list}, {row}, {col}, {mods})
- Drop one or more files in {list} in the window at {row}, {col}.
- This function only works when the GUI is running and the
- |drop_file| feature is present.
-
- The supported values for {mods} are:
- 0x4 Shift
- 0x8 Alt
- 0x10 Ctrl
- The files are added to the |argument-list| and the first file
- in {list} is edited in the window. See |drag-n-drop| for more
- information.
-
- *test_gui_mouse_event()*
-test_gui_mouse_event({button}, {row}, {col}, {multiclick}, {modifiers})
- Inject a mouse button click event. This function only works
- when the GUI is running.
- The supported values for {button} 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} and {col} specify the location of the mouse click. The
- first row of the Vim window is 1 and the last row is 'lines'.
- The maximum value of {col} is 'columns'.
- To inject a multiclick event, set {multiclick} to 1.
- The supported values for {modifiers} are:
- 4 shift is pressed
- 8 alt is pressed
- 16 ctrl is pressed
- After injecting the mouse event you probably should call
+ *test_gui_event()*
+test_gui_event({event}, {args})
+ Generate a GUI {event} with arguments {args} for testing Vim
+ functionality.
+
+ {event} is a String and the supported values are:
+ "dropfiles" drop one or more files in a window.
+ "mouse" mouse button click event.
+ "tabline" select a tab page by mouse click.
+ "tabmenu" select a tabline menu entry.
+
+ {args} is a Dict and contains the arguments for the event.
+
+ "dropfiles":
+ Drop one or more files in a specified window. The supported
+ items in {args} are:
+ files: List of file names
+ row: window row number
+ col: window column number
+ modifiers: key modifiers. The supported values are:
+ 0x4 Shift
+ 0x8 Alt
+ 0x10 Ctrl
+ The files are added to the |argument-list| and the first
+ file in {files} is edited in the window. See |drag-n-drop|
+ for more information. This function only works when the GUI
+ is running and the |drop_file| feature is present.
+
+ "mouse":
+ Inject a mouse button click event. This function only works
+ when the GUI is running. 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'.
+ multiclick: set to 1 to inject a multiclick mouse event.
+ modifiers: key modifiers. The supported values are:
+ 4 shift is pressed
+ 8 alt is pressed
+ 16 ctrl is pressed
+
+ "tabline":
+ Inject a mouse click event on the tabline to select a
+ tabpage. The supported items in {args} are:
+ tabnr: tab page number
+
+ "tabmenu":
+ Inject an event to select a tabline menu entry. The
+ supported items in {args} are:
+ tabnr: tab page number
+ item: tab page menu item number. 1 for the first
+ menu item, 2 for the second item and so on.
+
+ After injecting the GUI events you probably should call
|feedkeys()| to have them processed, e.g.: >
call feedkeys("y", 'Lx!')
-
- *test_gui_tabline_event()*
-test_gui_tabline_event({tabnr})
- Add an event that simulates a click on the tabline to select
- tabpage {tabnr} to the input buffer.
+<
Returns TRUE if the event is successfully added, FALSE if
- already in the tabpage {tabnr} or the cmdline window is open.
- After injecting the event you probably should call
- |feedkeys()| to have them processed, e.g.: >
- call feedkeys("y", 'Lx!')
-
- *test_gui_tabmenu_event()*
-test_gui_tabmenu_event({tabnr}, {event})
- Add an event that simulates selecting a tabline menu entry for
- tabpage {tabnr} to the input buffer. {event} is 1 for the
- first menu entry, 2 for the second entry and so on.
- After injecting the event you probably should call
- |feedkeys()| to have them processed, e.g.: >
- call feedkeys("y", 'Lx!')
+ there is a failure.
+ Can also be used as a |method|: >
+ GetEvent()->test_gui_event({args})
+<
test_ignore_error({expr}) *test_ignore_error()*
Ignore any error containing {expr}. A normal message is given
instead.
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 623fd3b598..f1d88b9773 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -1117,10 +1117,7 @@ Testing: *test-functions*
test_garbagecollect_now() free memory right now
test_garbagecollect_soon() set a flag to free memory soon
test_getvalue() get value of an internal variable
- test_gui_drop_files() drop file(s) in a window
- test_gui_mouse_event() add a GUI mouse event to the input buffer
- test_gui_tabline_event() add a GUI tabline event to the input buffer
- test_gui_tabmenu_event() add a GUI tabmenu event to the input buffer
+ test_gui_event() generate a GUI event for testing
test_ignore_error() ignore a specific error message
test_null_blob() return a null Blob
test_null_channel() return a null Channel