a11y: Add a test for gtk_accessible_role_to_name
authorMatthias Clasen <mclasen@redhat.com>
Wed, 22 Mar 2023 00:06:37 +0000 (20:06 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 22 Mar 2023 00:06:37 +0000 (20:06 -0400)
This should prevent !5693 from happening again
in the future.

testsuite/gtk/a11y.c [new file with mode: 0644]
testsuite/gtk/meson.build

diff --git a/testsuite/gtk/a11y.c b/testsuite/gtk/a11y.c
new file mode 100644 (file)
index 0000000..5632254
--- /dev/null
@@ -0,0 +1,29 @@
+#include <gtk/gtk.h>
+#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 ();
+}
index 73dd1369c399b69c1d660c2bf64e59d917c69ec6..d8a2e17e2c4b6620451ef1d0beff69f7b206f3be 100644 (file)
@@ -128,6 +128,7 @@ internal_tests = [
   { 'name': 'textbuffer' },
   { 'name': 'texthistory' },
   { 'name': 'fnmatch' },
+  { 'name': 'a11y' },
 ]
 
 is_debug = get_option('buildtype').startswith('debug')