2020-07-26 19:30:35 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
static void
|
|
|
|
button_role (void)
|
|
|
|
{
|
|
|
|
GtkWidget *button = gtk_button_new ();
|
|
|
|
g_object_ref_sink (button);
|
|
|
|
|
|
|
|
gtk_test_accessible_assert_role (button, GTK_ACCESSIBLE_ROLE_BUTTON);
|
|
|
|
|
|
|
|
/* Simple command buttons have a "pressed" state set to "undefined" */
|
|
|
|
gtk_test_accessible_assert_state (button, GTK_ACCESSIBLE_STATE_PRESSED, GTK_ACCESSIBLE_VALUE_UNDEFINED);
|
|
|
|
|
|
|
|
g_object_unref (button);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
button_label (void)
|
|
|
|
{
|
|
|
|
GtkWidget *button = gtk_button_new_with_label ("Hello");
|
|
|
|
g_object_ref_sink (button);
|
|
|
|
|
|
|
|
gtk_test_accessible_assert_property (button, GTK_ACCESSIBLE_PROPERTY_LABEL, "Hello");
|
|
|
|
|
|
|
|
g_object_unref (button);
|
|
|
|
}
|
|
|
|
|
2020-10-21 02:44:24 +00:00
|
|
|
/* Check that we set up a labelled_by relationship between a button
|
|
|
|
* and its label.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
button_relation (void)
|
|
|
|
{
|
|
|
|
GtkWidget *button = gtk_button_new_with_mnemonic ("_Hello");
|
|
|
|
|
|
|
|
g_object_ref_sink (button);
|
|
|
|
|
2020-11-10 14:14:47 +00:00
|
|
|
gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (button),
|
|
|
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, gtk_widget_get_first_child (button), NULL);
|
2020-10-21 02:44:24 +00:00
|
|
|
|
|
|
|
g_object_unref (button);
|
|
|
|
}
|
|
|
|
|
2020-07-30 00:26:16 +00:00
|
|
|
static void
|
|
|
|
linkbutton_role (void)
|
|
|
|
{
|
|
|
|
GtkWidget *button = gtk_link_button_new ("Hello");
|
|
|
|
g_object_ref_sink (button);
|
|
|
|
|
2020-10-22 01:54:17 +00:00
|
|
|
gtk_test_accessible_assert_role (button, GTK_ACCESSIBLE_ROLE_LINK);
|
2020-07-30 00:26:16 +00:00
|
|
|
|
|
|
|
g_object_unref (button);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
linkbutton_label (void)
|
|
|
|
{
|
|
|
|
GtkWidget *button = gtk_link_button_new ("Hello");
|
|
|
|
g_object_ref_sink (button);
|
|
|
|
|
|
|
|
gtk_test_accessible_assert_property (button, GTK_ACCESSIBLE_PROPERTY_LABEL, "Hello");
|
|
|
|
|
|
|
|
g_object_unref (button);
|
|
|
|
}
|
|
|
|
|
2020-07-26 19:30:35 +00:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
{
|
|
|
|
gtk_test_init (&argc, &argv, NULL);
|
|
|
|
|
|
|
|
g_test_add_func ("/a11y/button/role", button_role);
|
|
|
|
g_test_add_func ("/a11y/button/label", button_label);
|
2020-10-21 02:44:24 +00:00
|
|
|
g_test_add_func ("/a11y/button/relation", button_relation);
|
2020-07-30 00:26:16 +00:00
|
|
|
g_test_add_func ("/a11y/linkbutton/role", linkbutton_role);
|
|
|
|
g_test_add_func ("/a11y/linkbutton/label", linkbutton_label);
|
2020-07-26 19:30:35 +00:00
|
|
|
|
|
|
|
return g_test_run ();
|
|
|
|
}
|