From d04690d05cb712791b0af49c368c80f28d990ae2 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 21 Mar 2023 20:06:37 -0400 Subject: [PATCH] a11y: Add a test for gtk_accessible_role_to_name This should prevent !5693 from happening again in the future. --- testsuite/gtk/a11y.c | 29 +++++++++++++++++++++++++++++ testsuite/gtk/meson.build | 1 + 2 files changed, 30 insertions(+) create mode 100644 testsuite/gtk/a11y.c diff --git a/testsuite/gtk/a11y.c b/testsuite/gtk/a11y.c new file mode 100644 index 0000000000..56322546fe --- /dev/null +++ b/testsuite/gtk/a11y.c @@ -0,0 +1,29 @@ +#include +#include "gtk/gtkaccessibleprivate.h" + +static void +test_role_to_name (void) +{ + GEnumClass *class; + + class = g_type_class_ref (GTK_TYPE_ACCESSIBLE_ROLE); + + for (unsigned int i = 0; i < class->n_values; i++) + { + GtkAccessibleRole role = class->values[i].value; + + g_assert_nonnull (gtk_accessible_role_to_name (role, "gtk40")); + } + + g_type_class_unref (class); +} + +int +main (int argc, char *argv[]) +{ + (g_test_init) (&argc, &argv, NULL); + + g_test_add_func ("/a11y/role-to-name", test_role_to_name); + + return g_test_run (); +} diff --git a/testsuite/gtk/meson.build b/testsuite/gtk/meson.build index 73dd1369c3..d8a2e17e2c 100644 --- a/testsuite/gtk/meson.build +++ b/testsuite/gtk/meson.build @@ -128,6 +128,7 @@ internal_tests = [ { 'name': 'textbuffer' }, { 'name': 'texthistory' }, { 'name': 'fnmatch' }, + { 'name': 'a11y' }, ] is_debug = get_option('buildtype').startswith('debug') -- 2.30.2