From 8bbab02215f203b514f597b54697523303d07e93 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 16 Jun 2011 23:13:38 -0400 Subject: [PATCH] Add a first, trivial test for accessibles --- gtk/tests/Makefile.am | 4 ++++ gtk/tests/accessible.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 gtk/tests/accessible.c diff --git a/gtk/tests/Makefile.am b/gtk/tests/Makefile.am index aff74e5182..79b2ff291c 100644 --- a/gtk/tests/Makefile.am +++ b/gtk/tests/Makefile.am @@ -115,6 +115,10 @@ TEST_PROGS += treepath treepath_SOURCES = treepath.c treepath_LDADD = $(progs_ldadd) +TEST_PROGS += accessible +accessible_SOURCES = accessible.c +accessible_LDADD = $(progs_ldadd) + EXTRA_DIST += \ file-chooser-test-dir/empty \ file-chooser-test-dir/text.txt diff --git a/gtk/tests/accessible.c b/gtk/tests/accessible.c new file mode 100644 index 0000000000..2805a2eab6 --- /dev/null +++ b/gtk/tests/accessible.c @@ -0,0 +1,36 @@ +#include + +static void +test_type (GType t) +{ + GtkWidget *w; + AtkObject *a; + + if (g_type_is_a (t, GTK_TYPE_WIDGET)) + { + w = (GtkWidget *)g_object_new (t, NULL); + a = gtk_widget_get_accessible (w); + + g_assert (GTK_IS_ACCESSIBLE (a)); + g_assert (gtk_accessible_get_widget (GTK_ACCESSIBLE (a)) == w); + + g_object_unref (w); + } +} + +int +main (int argc, char *argv[]) +{ + GType *tp; + gint i; + + gtk_init (&argc, &argv); + + tp = g_new0 (GType, 1000); +#undef GDK_WINDOWING_X11 +#include "../gtktypefuncs.c" + *tp = 0; + + for (i = 0; tp[i]; i++) + test_type (tp[i]); +}