Testing

Testing — Utilities for testing GTK applications

Includes

#include <gtk/gtk.h>

Description

Functions

gtk_test_init ()

void
gtk_test_init (int *argcp,
               char ***argvp,
               ...);

This function is used to initialize a GTK test program.

It will in turn call g_test_init() and gtk_init() to properly initialize the testing framework and graphical toolkit. It’ll also set the program’s locale to “C”. This is done to make test program environments as deterministic as possible.

Like gtk_init() and g_test_init(), any known arguments will be processed and stripped from argc and argv .

Parameters

argcp

Address of the argc parameter of the main() function. Changed if any arguments were handled.

argvp

Address of the argv parameter of main(). Any parameters understood by g_test_init() or gtk_init() are stripped before return.

[inout][array length=argcp]

...

currently unused

gtk_test_list_all_types ()

const GType *
gtk_test_list_all_types (guint *n_types);

Return the type ids that have been registered after calling gtk_test_register_all_types().

Parameters

n_types

location to store number of types

Returns

0-terminated array of type ids.

[array length=n_types zero-terminated=1][transfer none]

gtk_test_register_all_types ()

void
gtk_test_register_all_types (void);

Force registration of all core GTK object types.

This allowes to refer to any of those object types via g_type_from_name() after calling this function.

gtk_test_widget_wait_for_draw ()

void
gtk_test_widget_wait_for_draw (GtkWidget *widget);

Enters the main loop and waits for widget to be “drawn”. In this context that means it waits for the frame clock of widget to have run a full styling, layout and drawing cycle.

This function is intended to be used for syncing with actions that depend on widget relayouting or on interaction with the display server.

Parameters

widget

the widget to wait for

gtk_test_accessible_assert_property()

#define             gtk_test_accessible_assert_property(accessible,property,...)

Checks whether a GtkAccessible implementation has its accessible property set to the expected value, and raises an assertion if the condition is not satisfied.

Parameters

accessible

a GtkAccessible

property

a GtkAccessibleProperty

...

the value of property

gtk_test_accessible_assert_relation()

#define             gtk_test_accessible_assert_relation(accessible,relation,...)

Checks whether a GtkAccessible implementation has its accessible relation set to the expected value, and raises an assertion if the condition is not satisfied.

Parameters

accessible

a GtkAccessible

relation

a GtkAccessibleRelation

...

the expected value of relation

gtk_test_accessible_assert_role()

#define             gtk_test_accessible_assert_role(accessible,role)

Checks whether a GtkAccessible implementation has the given role , and raises an assertion if the condition is failed.

Parameters

accessible

a GtkAccessible

role

a GtkAccessibleRole

gtk_test_accessible_assert_state()

#define             gtk_test_accessible_assert_state(accessible,state,...)

Checks whether a GtkAccessible implementation has its accessible state set to the expected value, and raises an assertion if the condition is not satisfied.

Parameters

accessible

a GtkAccessible

state

a GtkAccessibleRelation

...

the expected value of state

gtk_test_accessible_check_property ()

char *
gtk_test_accessible_check_property (GtkAccessible *accessible,
                                    GtkAccessibleProperty property,
                                    ...);

Checks whether the accessible property of accessible is set to a specific value.

Parameters

accessible

a GtkAccessible

property

a GtkAccessibleProperty

...

the expected value of property

Returns

the value of the accessible property.

[transfer full]

gtk_test_accessible_check_relation ()

char *
gtk_test_accessible_check_relation (GtkAccessible *accessible,
                                    GtkAccessibleRelation relation,
                                    ...);

Checks whether the accessible relation of accessible is set to a specific value.

Parameters

accessible

a GtkAccessible

relation

a GtkAccessibleRelation

...

the expected value of relation

Returns

the value of the accessible relation.

[transfer full]

gtk_test_accessible_check_state ()

char *
gtk_test_accessible_check_state (GtkAccessible *accessible,
                                 GtkAccessibleState state,
                                 ...);

Checks whether the accessible state of accessible is set to a specific value.

Parameters

accessible

a GtkAccessible

state

a GtkAccessibleState

...

the expected value of state

Returns

the value of the accessible state.

[transfer full]

gtk_test_accessible_has_property ()

gboolean
gtk_test_accessible_has_property (GtkAccessible *accessible,
                                  GtkAccessibleProperty property);

Checks whether the GtkAccessible has property set.

Parameters

accessible

a GtkAccessible

property

a GtkAccessibleProperty

Returns

TRUE if the property is set in the accessible

gtk_test_accessible_has_relation ()

gboolean
gtk_test_accessible_has_relation (GtkAccessible *accessible,
                                  GtkAccessibleRelation relation);

Checks whether the GtkAccessible has relation set.

Parameters

accessible

a GtkAccessible

relation

a GtkAccessibleRelation

Returns

TRUE if the relation is set in the accessible

gtk_test_accessible_has_role ()

gboolean
gtk_test_accessible_has_role (GtkAccessible *accessible,
                              GtkAccessibleRole role);

Checks whether the “accessible-role” of the accessible is role .

Parameters

accessible

a GtkAccessible

role

a GtkAccessibleRole

Returns

TRUE if the role matches

gtk_test_accessible_has_state ()

gboolean
gtk_test_accessible_has_state (GtkAccessible *accessible,
                               GtkAccessibleState state);

Checks whether the GtkAccessible has state set.

Parameters

accessible

a GtkAccessible

state

a GtkAccessibleState

Returns

TRUE if the state is set in the accessible

gtk_test_accessible_assertion_message_role ()

void
gtk_test_accessible_assertion_message_role
                               (const char *domain,
                                const char *file,
                                int line,
                                const char *func,
                                const char *expr,
                                GtkAccessible *accessible,
                                GtkAccessibleRole expected_role,
                                GtkAccessibleRole actual_role);

© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk4/4.0/gtk4-Testing.html