Testing.testSimulateKey

This function is intended to be used in GTK+ test programs. If (x,y) are > (-1,-1), it will warp the mouse pointer to the given (x,y) coordinates within window and simulate a key press or release event.

When the mouse pointer is warped to the target location, use of this function outside of test programs that run in their own virtual windowing system (e.g. Xvfb) is not recommended. If (x,y) are passed as (-1,-1), the mouse pointer will not be warped and window origin will be used as mouse pointer location for the event.

Also, gdk_test_simulate_key() is a fairly low level function, for most testing purposes, gtk_test_widget_send_key() is the right function to call which will generate a key press event followed by its accompanying key release event.

struct Testing
static
bool
testSimulateKey

Parameters

window Window

a gdk.Window to simulate a key event for

x int

x coordinate within window for the key event

y int

y coordinate within window for the key event

keyval uint

A GDK keyboard value

modifiers GdkModifierType

Keyboard modifiers the event is setup with

keyPressrelease GdkEventType

either GDK_KEY_PRESS or GDK_KEY_RELEASE

Return Value

Type: bool

whether all actions necessary for a key event simulation were carried out successfully

Meta

Since

2.14