From 76fcd5cf25effffd133ed3f62db67beb7d11348f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Jun 2023 16:06:39 -0400 Subject: [PATCH] Add another a11y test This one catches the lingering 'widget' role that only happens when widgets are realized and rooted. --- testsuite/a11y/colordialogbutton.c | 29 +++++++++++++++++++++++++++++ testsuite/a11y/meson.build | 1 + 2 files changed, 30 insertions(+) create mode 100644 testsuite/a11y/colordialogbutton.c diff --git a/testsuite/a11y/colordialogbutton.c b/testsuite/a11y/colordialogbutton.c new file mode 100644 index 0000000000..6fc2b7496b --- /dev/null +++ b/testsuite/a11y/colordialogbutton.c @@ -0,0 +1,29 @@ +#include + +static void +color_dialog_button_role (void) +{ + GtkWidget *window, *widget; + + widget = gtk_color_dialog_button_new (NULL); + window = gtk_window_new (); + gtk_window_set_child (GTK_WINDOW (window), widget); + gtk_window_present (GTK_WINDOW (window)); + + while (!gtk_widget_get_realized (widget)) + g_main_context_iteration (NULL, FALSE); + + gtk_test_accessible_assert_role (widget, GTK_ACCESSIBLE_ROLE_GROUP); + + gtk_window_destroy (GTK_WINDOW (window)); +} + +int +main (int argc, char *argv[]) +{ + gtk_test_init (&argc, &argv, NULL); + + g_test_add_func ("/a11y/color-dialog-button/role", color_dialog_button_role); + + return g_test_run (); +} diff --git a/testsuite/a11y/meson.build b/testsuite/a11y/meson.build index 058baec406..2686d6c31f 100644 --- a/testsuite/a11y/meson.build +++ b/testsuite/a11y/meson.build @@ -11,6 +11,7 @@ tests = [ { 'name': 'box' }, { 'name': 'button' }, { 'name': 'checkbutton' }, + { 'name': 'colordialogbutton' }, { 'name': 'custom' }, { 'name': 'dialog' }, { 'name': 'entry' }, -- 2.30.2