Testing

Testing — Test utilities

Functions

Includes

#include <cdk/cdkwayland.h>

Description

The functions in this section are intended to be used in test programs. They allow to simulate some user input.

Functions

cdk_test_render_sync ()

void
cdk_test_render_sync (CdkWindow *window);

Retrieves a pixel from window to force the windowing system to carry out any pending rendering commands.

This function is intended to be used to synchronize with rendering pipelines, to benchmark windowing system rendering operations.

Parameters

window

a mapped CdkWindow

 

Since: 2.14


cdk_test_simulate_button ()

gboolean
cdk_test_simulate_button (CdkWindow *window,
                          gint x,
                          gint y,
                          guint button,
                          CdkModifierType modifiers,
                          CdkEventType button_pressrelease);

This function is intended to be used in CTK+ test programs. It will warp the mouse pointer to the given (x ,y ) coordinates within window and simulate a button press or release event. Because the mouse pointer needs to be 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.

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

Parameters

window

a CdkWindow to simulate a button event for

 

x

x coordinate within window for the button event

 

y

y coordinate within window for the button event

 

button

Number of the pointer button for the event, usually 1, 2 or 3

 

modifiers

Keyboard modifiers the event is setup with

 

button_pressrelease

either CDK_BUTTON_PRESS or CDK_BUTTON_RELEASE

 

Returns

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

Since: 2.14


cdk_test_simulate_key ()

gboolean
cdk_test_simulate_key (CdkWindow *window,
                       gint x,
                       gint y,
                       guint keyval,
                       CdkModifierType modifiers,
                       CdkEventType key_pressrelease);

This function is intended to be used in CTK+ 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, cdk_test_simulate_key() is a fairly low level function, for most testing purposes, ctk_test_widget_send_key() is the right function to call which will generate a key press event followed by its accompanying key release event.

Parameters

window

a CdkWindow to simulate a key event for

 

x

x coordinate within window for the key event

 

y

y coordinate within window for the key event

 

keyval

A CDK keyboard value

 

modifiers

Keyboard modifiers the event is setup with

 

key_pressrelease

either CDK_KEY_PRESS or CDK_KEY_RELEASE

 

Returns

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

Since: 2.14