Merge branch 'a11y-tests' into 'master'

Add more a11y tests

See merge request GNOME/gtk!2303
This commit is contained in:
Emmanuele Bassi 2020-07-28 11:47:14 +00:00
commit 5fc5e52f52
19 changed files with 514 additions and 9 deletions

View File

@ -57,6 +57,7 @@ Each role name is part of the #GtkAccessibleRole enumeration.
| `SEPARATOR` | A divider that separates sections of content or groups of items | #GtkSeparator |
| `SPIN_BUTTON` | A range control that allows seelcting among discrete choices | #GtkSpinButton |
| `SWITCH` | A control that represents on/off values | #GtkSwitch |
| `WINDOW` | An application window | #GtkWindow |
| `...` | … |
See the [WAI-ARIA](https://www.w3.org/WAI/PF/aria/appendices#quickref) list

View File

@ -293,6 +293,7 @@ gtk_check_button_init (GtkCheckButton *check_button)
priv->draw_indicator = TRUE;
draw_indicator_changed (check_button);
gtk_check_button_update_node_state (GTK_WIDGET (check_button));
update_accessible_state (check_button);
}
/**

View File

@ -1245,7 +1245,7 @@ typedef enum {
* @GTK_ACCESSIBLE_ROLE_TREE_ITEM: Unused
* @GTK_ACCESSIBLE_ROLE_WIDGET: An interactive component of a graphical user
* interface. This is the role that GTK uses by default for widgets.
* @GTK_ACCESSIBLE_ROLE_WINDOW: Unused
* @GTK_ACCESSIBLE_ROLE_WINDOW: An application window.
*
* The accessible role for a #GtkAccessible implementation.
*

View File

@ -462,6 +462,12 @@ gtk_progress_bar_init (GtkProgressBar *pbar)
pbar->orientation = GTK_ORIENTATION_VERTICAL; /* Just to force an update... */
gtk_progress_bar_set_orientation (pbar, GTK_ORIENTATION_HORIZONTAL);
gtk_widget_update_orientation (GTK_WIDGET (pbar), pbar->orientation);
gtk_accessible_update_property (GTK_ACCESSIBLE (pbar),
GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, 1.0,
GTK_ACCESSIBLE_PROPERTY_VALUE_MIN, 0.0,
GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, 0.0,
-1);
}
static void

View File

@ -166,6 +166,9 @@ gtk_scrollbar_set_property (GObject *object,
gtk_widget_update_orientation (GTK_WIDGET (self), priv->orientation);
gtk_widget_queue_resize (GTK_WIDGET (self));
g_object_notify_by_pspec (object, pspec);
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_PROPERTY_ORIENTATION, orientation,
-1);
}
}
break;
@ -175,11 +178,24 @@ gtk_scrollbar_set_property (GObject *object,
}
}
static void gtk_scrollbar_adjustment_changed (GtkAdjustment *adjustment,
gpointer data);
static void gtk_scrollbar_adjustment_value_changed (GtkAdjustment *adjustment,
gpointer data);
static void
gtk_scrollbar_dispose (GObject *object)
{
GtkScrollbar *self = GTK_SCROLLBAR (object);
GtkScrollbarPrivate *priv = gtk_scrollbar_get_instance_private (self);
GtkAdjustment *adj;
adj = gtk_range_get_adjustment (GTK_RANGE (priv->range));
if (adj)
{
g_signal_handlers_disconnect_by_func (adj, gtk_scrollbar_adjustment_changed, self);
g_signal_handlers_disconnect_by_func (adj, gtk_scrollbar_adjustment_value_changed, self);
}
g_clear_pointer (&priv->range, gtk_widget_unparent);
@ -224,6 +240,9 @@ gtk_scrollbar_init (GtkScrollbar *self)
gtk_widget_set_vexpand (priv->range, TRUE);
gtk_widget_set_parent (priv->range, GTK_WIDGET (self));
gtk_widget_update_orientation (GTK_WIDGET (self), priv->orientation);
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_PROPERTY_ORIENTATION, priv->orientation,
-1);
}
/**
@ -248,6 +267,29 @@ gtk_scrollbar_new (GtkOrientation orientation,
NULL);
}
static void
gtk_scrollbar_adjustment_changed (GtkAdjustment *adjustment,
gpointer data)
{
GtkScrollbar *self = data;
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, gtk_adjustment_get_upper (adjustment),
GTK_ACCESSIBLE_PROPERTY_VALUE_MIN, gtk_adjustment_get_lower (adjustment),
-1);
}
static void
gtk_scrollbar_adjustment_value_changed (GtkAdjustment *adjustment,
gpointer data)
{
GtkScrollbar *self = data;
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, gtk_adjustment_get_value (adjustment),
-1);
}
/**
* gtk_scrollbar_set_adjustment:
* @self: a #GtkScrollbar
@ -260,13 +302,34 @@ gtk_scrollbar_set_adjustment (GtkScrollbar *self,
GtkAdjustment *adjustment)
{
GtkScrollbarPrivate *priv = gtk_scrollbar_get_instance_private (self);
GtkAdjustment *adj;
g_return_if_fail (GTK_IS_SCROLLBAR (self));
g_return_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment));
adj = gtk_range_get_adjustment (GTK_RANGE (priv->range));
if (adj)
{
g_signal_handlers_disconnect_by_func (adj, gtk_scrollbar_adjustment_changed, self);
g_signal_handlers_disconnect_by_func (adj, gtk_scrollbar_adjustment_value_changed, self);
}
gtk_range_set_adjustment (GTK_RANGE (priv->range), adjustment);
if (adjustment)
{
g_signal_connect (adjustment, "changed",
G_CALLBACK (gtk_scrollbar_adjustment_changed), self);
g_signal_connect (adjustment, "value-changed",
G_CALLBACK (gtk_scrollbar_adjustment_value_changed), self);
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, gtk_adjustment_get_upper (adjustment),
GTK_ACCESSIBLE_PROPERTY_VALUE_MIN, gtk_adjustment_get_lower (adjustment),
GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, gtk_adjustment_get_value (adjustment),
-1);
}
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_ADJUSTMENT]);
}

View File

@ -139,6 +139,9 @@ gtk_separator_init (GtkSeparator *separator)
gtk_widget_update_orientation (GTK_WIDGET (separator),
separator->orientation);
gtk_accessible_update_property (GTK_ACCESSIBLE (separator),
GTK_ACCESSIBLE_PROPERTY_ORIENTATION, separator->orientation,
-1);
}
static void

View File

@ -1643,6 +1643,12 @@ gtk_spin_button_configure (GtkSpinButton *spin_button,
g_object_thaw_notify (G_OBJECT (spin_button));
gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, gtk_adjustment_get_upper (adjustment),
GTK_ACCESSIBLE_PROPERTY_VALUE_MIN, gtk_adjustment_get_lower (adjustment),
GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, gtk_adjustment_get_value (adjustment),
-1);
gtk_spin_button_value_changed (adjustment, spin_button);
}

View File

@ -659,6 +659,10 @@ gtk_switch_init (GtkSwitch *self)
self->slider = gtk_gizmo_new ("slider", NULL, NULL, NULL, NULL, NULL, NULL);
gtk_widget_set_parent (self->slider, GTK_WIDGET (self));
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_STATE_CHECKED, FALSE,
-1);
}
/**

View File

@ -5583,6 +5583,10 @@ gtk_widget_set_sensitive (GtkWidget *widget,
}
}
gtk_accessible_update_state (GTK_ACCESSIBLE (widget),
GTK_ACCESSIBLE_STATE_DISABLED, !sensitive,
-1);
if (priv->parent == NULL
|| gtk_widget_is_sensitive (priv->parent))
{

View File

@ -155,6 +155,10 @@
*
* GtkWindow adds the .titlebar and .default-decoration style classes to the
* widget that is added as a titlebar child.
*
* # Accessibility
*
* GtkWindow uses the #GTK_ACCESSIBLE_ROLE_WINDOW role.
*/
#define MENU_BAR_ACCEL GDK_KEY_F10
@ -1114,6 +1118,8 @@ gtk_window_class_init (GtkWindowClass *klass)
add_tab_bindings (widget_class, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
gtk_widget_class_set_css_name (widget_class, I_("window"));
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_WINDOW);
}
/**
@ -2208,19 +2214,17 @@ gtk_window_real_activate_default (GtkWindow *window)
* gtk_window_set_modal:
* @window: a #GtkWindow
* @modal: whether the window is modal
*
*
* Sets a window modal or non-modal. Modal windows prevent interaction
* with other windows in the same application. To keep modal dialogs
* on top of main application windows, use
* gtk_window_set_transient_for() to make the dialog transient for the
* parent; most [window managers][gtk-X11-arch]
* will then disallow lowering the dialog below the parent.
*
*
**/
void
gtk_window_set_modal (GtkWindow *window,
gboolean modal)
gboolean modal)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GtkWidget *widget;
@ -2233,20 +2237,24 @@ gtk_window_set_modal (GtkWindow *window,
priv->modal = modal;
widget = GTK_WIDGET (window);
if (_gtk_widget_get_realized (widget))
gdk_toplevel_set_modal (GDK_TOPLEVEL (priv->surface), modal);
if (gtk_widget_get_visible (widget))
{
if (priv->modal)
gtk_grab_add (widget);
gtk_grab_add (widget);
else
gtk_grab_remove (widget);
gtk_grab_remove (widget);
}
update_window_actions (window);
gtk_accessible_update_property (GTK_ACCESSIBLE (window),
GTK_ACCESSIBLE_PROPERTY_MODAL, modal,
-1);
g_object_notify_by_pspec (G_OBJECT (window), window_props[PROP_MODAL]);
}

View File

@ -0,0 +1,54 @@
#include <gtk/gtk.h>
static void
check_button_role (void)
{
GtkWidget *button = gtk_check_button_new ();
g_object_ref_sink (button);
gtk_test_accessible_assert_role (button, GTK_ACCESSIBLE_ROLE_CHECKBOX);
g_object_unref (button);
}
static void
check_button_checked (void)
{
GtkWidget *button = gtk_check_button_new ();
g_object_ref_sink (button);
gtk_test_accessible_assert_state (button, GTK_ACCESSIBLE_STATE_CHECKED, GTK_ACCESSIBLE_TRISTATE_FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
gtk_test_accessible_assert_state (button, GTK_ACCESSIBLE_STATE_CHECKED, GTK_ACCESSIBLE_TRISTATE_TRUE);
gtk_check_button_set_inconsistent (GTK_CHECK_BUTTON (button), TRUE);
gtk_test_accessible_assert_state (button, GTK_ACCESSIBLE_STATE_CHECKED, GTK_ACCESSIBLE_TRISTATE_MIXED);
g_object_unref (button);
}
static void
check_button_label (void)
{
GtkWidget *button = gtk_check_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);
}
int
main (int argc, char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/a11y/checkbutton/role", check_button_role);
g_test_add_func ("/a11y/checkbutton/checked", check_button_checked);
g_test_add_func ("/a11y/checkbutton/label", check_button_label);
return g_test_run ();
}

54
testsuite/a11y/dialog.c Normal file
View File

@ -0,0 +1,54 @@
#include <gtk/gtk.h>
static void
dialog_role (void)
{
GtkWidget *dialog = gtk_dialog_new ();
gtk_test_accessible_assert_role (dialog, GTK_ACCESSIBLE_ROLE_DIALOG);
gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
dialog_state (void)
{
GtkWidget *dialog = gtk_dialog_new ();
gtk_window_present (GTK_WINDOW (dialog));
gtk_test_accessible_assert_state (dialog, GTK_ACCESSIBLE_STATE_HIDDEN, FALSE);
gtk_widget_hide (dialog);
gtk_test_accessible_assert_state (dialog, GTK_ACCESSIBLE_STATE_HIDDEN, TRUE);
gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
dialog_properties (void)
{
GtkWidget *dialog = gtk_dialog_new ();
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_test_accessible_assert_property (dialog, GTK_ACCESSIBLE_PROPERTY_MODAL, TRUE);
gtk_window_set_modal (GTK_WINDOW (dialog), FALSE);
gtk_test_accessible_assert_property (dialog, GTK_ACCESSIBLE_PROPERTY_MODAL, FALSE);
gtk_window_destroy (GTK_WINDOW (dialog));
}
int
main (int argc, char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/a11y/dialog/role", dialog_role);
g_test_add_func ("/a11y/dialog/state", dialog_state);
g_test_add_func ("/a11y/dialog/properties", dialog_properties);
return g_test_run ();
}

View File

@ -10,8 +10,16 @@ testdatadir = join_paths(installed_test_datadir, 'gtk')
# - 'link_args': (array): additional linker arguments
# - 'suites': (array): additional test suites
tests = [
{ 'name': 'button' },
{ 'name': 'accessible' },
{ 'name': 'button' },
{ 'name': 'checkbutton' },
{ 'name': 'dialog' },
{ 'name': 'progressbar' },
{ 'name': 'scrollbar' },
{ 'name': 'separator' },
{ 'name': 'spinbutton' },
{ 'name': 'switch' },
{ 'name': 'window' },
]

View File

@ -0,0 +1,58 @@
#include <gtk/gtk.h>
static void
progress_bar_role (void)
{
GtkWidget *widget = gtk_progress_bar_new ();
g_object_ref_sink (widget);
gtk_test_accessible_assert_role (widget, GTK_ACCESSIBLE_ROLE_PROGRESS_BAR);
g_object_unref (widget);
}
static void
progress_bar_state (void)
{
GtkWidget *widget = gtk_progress_bar_new ();
g_object_ref_sink (widget);
gtk_test_accessible_assert_state (widget, GTK_ACCESSIBLE_STATE_BUSY, FALSE);
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (widget));
gtk_test_accessible_assert_state (widget, GTK_ACCESSIBLE_STATE_BUSY, TRUE);
g_object_unref (widget);
}
static void
progress_bar_properties (void)
{
GtkWidget *widget = gtk_progress_bar_new ();
g_object_ref_sink (widget);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, 1.);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MIN, 0.);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, 0.);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (widget), 0.5);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, 1.);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MIN, 0.);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, 0.5);
g_object_unref (widget);
}
int
main (int argc, char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/a11y/progressbar/role", progress_bar_role);
g_test_add_func ("/a11y/progressbar/state", progress_bar_state);
g_test_add_func ("/a11y/progressbar/properties", progress_bar_properties);
return g_test_run ();
}

View File

@ -0,0 +1,63 @@
#include <gtk/gtk.h>
static void
scrollbar_role (void)
{
GtkWidget *widget = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, NULL);
g_object_ref_sink (widget);
gtk_test_accessible_assert_role (widget, GTK_ACCESSIBLE_ROLE_SCROLLBAR);
g_object_unref (widget);
}
static void
scrollbar_state (void)
{
GtkWidget *widget = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, NULL);
g_object_ref_sink (widget);
gtk_test_accessible_assert_state (widget, GTK_ACCESSIBLE_STATE_DISABLED, FALSE);
gtk_widget_set_sensitive (widget, FALSE);
gtk_test_accessible_assert_state (widget, GTK_ACCESSIBLE_STATE_DISABLED, TRUE);
g_object_unref (widget);
}
static void
scrollbar_properties (void)
{
GtkAdjustment *adj = gtk_adjustment_new (0.0, 0.0, 100.0, 1.0, 10.0, 10.0);
GtkWidget *widget = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, adj);
g_object_ref_sink (widget);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_ORIENTATION, GTK_ORIENTATION_HORIZONTAL);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, 100.);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MIN, 0.);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, 0.);
gtk_orientable_set_orientation (GTK_ORIENTABLE (widget), GTK_ORIENTATION_VERTICAL);
gtk_adjustment_set_value (adj, 50.0);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_ORIENTATION, GTK_ORIENTATION_VERTICAL);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, 100.);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MIN, 0.);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, 50.0);
g_object_unref (widget);
}
int
main (int argc, char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/a11y/scrollbar/role", scrollbar_role);
g_test_add_func ("/a11y/scrollbar/state", scrollbar_state);
g_test_add_func ("/a11y/scrollbar/properties", scrollbar_properties);
return g_test_run ();
}

View File

@ -0,0 +1,38 @@
#include <gtk/gtk.h>
static void
separator_role (void)
{
GtkWidget *widget = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
g_object_ref_sink (widget);
gtk_test_accessible_assert_role (widget, GTK_ACCESSIBLE_ROLE_SEPARATOR);
g_object_unref (widget);
}
static void
separator_properties (void)
{
GtkWidget *widget = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
g_object_ref_sink (widget);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_ORIENTATION, GTK_ORIENTATION_HORIZONTAL);
gtk_orientable_set_orientation (GTK_ORIENTABLE (widget), GTK_ORIENTATION_VERTICAL);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_ORIENTATION, GTK_ORIENTATION_VERTICAL);
g_object_unref (widget);
}
int
main (int argc, char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/a11y/separator/role", separator_role);
g_test_add_func ("/a11y/separator/properties", separator_properties);
return g_test_run ();
}

View File

@ -0,0 +1,42 @@
#include <gtk/gtk.h>
static void
spinbutton_role (void)
{
GtkWidget *widget = gtk_spin_button_new_with_range (0, 100, 1);
g_object_ref_sink (widget);
gtk_test_accessible_assert_role (widget, GTK_ACCESSIBLE_ROLE_SPIN_BUTTON);
g_object_unref (widget);
}
static void
spinbutton_properties (void)
{
GtkWidget *widget = gtk_spin_button_new_with_range (0, 100, 1);
g_object_ref_sink (widget);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, 100.);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MIN, 0.);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, 0.);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), 50.);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, 100.);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MIN, 0.);
gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, 50.0);
g_object_unref (widget);
}
int
main (int argc, char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/a11y/spinbutton/role", spinbutton_role);
g_test_add_func ("/a11y/spinbutton/properties", spinbutton_properties);
return g_test_run ();
}

38
testsuite/a11y/switch.c Normal file
View File

@ -0,0 +1,38 @@
#include <gtk/gtk.h>
static void
switch_role (void)
{
GtkWidget *widget = gtk_switch_new ();
g_object_ref_sink (widget);
gtk_test_accessible_assert_role (widget, GTK_ACCESSIBLE_ROLE_SWITCH);
g_object_unref (widget);
}
static void
switch_state (void)
{
GtkWidget *widget = gtk_switch_new ();
g_object_ref_sink (widget);
gtk_test_accessible_assert_state (widget, GTK_ACCESSIBLE_STATE_CHECKED, FALSE);
gtk_switch_set_active (GTK_SWITCH (widget), TRUE);
gtk_test_accessible_assert_state (widget, GTK_ACCESSIBLE_STATE_CHECKED, TRUE);
g_object_unref (widget);
}
int
main (int argc, char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/a11y/switch/role", switch_role);
g_test_add_func ("/a11y/switch/state", switch_state);
return g_test_run ();
}

54
testsuite/a11y/window.c Normal file
View File

@ -0,0 +1,54 @@
#include <gtk/gtk.h>
static void
window_role (void)
{
GtkWidget *window = gtk_window_new ();
gtk_test_accessible_assert_role (window, GTK_ACCESSIBLE_ROLE_WINDOW);
gtk_window_destroy (GTK_WINDOW (window));
}
static void
window_state (void)
{
GtkWidget *window = gtk_window_new ();
gtk_window_present (GTK_WINDOW (window));
gtk_test_accessible_assert_state (window, GTK_ACCESSIBLE_STATE_HIDDEN, FALSE);
gtk_widget_hide (window);
gtk_test_accessible_assert_state (window, GTK_ACCESSIBLE_STATE_HIDDEN, TRUE);
gtk_window_destroy (GTK_WINDOW (window));
}
static void
window_properties (void)
{
GtkWidget *window = gtk_window_new ();
gtk_window_set_modal (GTK_WINDOW (window), TRUE);
gtk_test_accessible_assert_property (window, GTK_ACCESSIBLE_PROPERTY_MODAL, TRUE);
gtk_window_set_modal (GTK_WINDOW (window), FALSE);
gtk_test_accessible_assert_property (window, GTK_ACCESSIBLE_PROPERTY_MODAL, FALSE);
gtk_window_destroy (GTK_WINDOW (window));
}
int
main (int argc, char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/a11y/window/role", window_role);
g_test_add_func ("/a11y/window/state", window_state);
g_test_add_func ("/a11y/window/properties", window_properties);
return g_test_run ();
}