testsuite: Fix the accessible test

This test was happily doing nothing.
This commit is contained in:
Matthias Clasen 2020-03-20 08:33:21 -04:00
parent 2747dd5c9f
commit 068ec58287

View File

@ -1,21 +1,22 @@
#include <gtk/gtk.h>
static void
test_type (GType t)
test_type (gconstpointer data)
{
GType t = *(GType *)data;
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);
w = (GtkWidget *)g_object_new (t, NULL);
if (g_type_is_a (t, G_TYPE_INITIALLY_UNOWNED))
g_object_ref_sink (w);
g_assert (GTK_IS_ACCESSIBLE (a));
g_assert (gtk_accessible_get_widget (GTK_ACCESSIBLE (a)) == w);
a = gtk_widget_get_accessible (w);
g_object_unref (w);
}
g_assert (GTK_IS_ACCESSIBLE (a));
g_assert (gtk_accessible_get_widget (GTK_ACCESSIBLE (a)) == w);
g_object_unref (w);
}
int
@ -24,12 +25,25 @@ main (int argc, char *argv[])
const GType *tp;
guint i, n;
gtk_init ();
gtk_test_init (&argc, &argv, NULL);
gtk_test_register_all_types ();
tp = gtk_test_list_all_types (&n);
for (i = 0; i < n; i++)
test_type (tp[i]);
{
char *testname;
return 0;
if (!g_type_is_a (tp[i], GTK_TYPE_WIDGET) ||
G_TYPE_IS_ABSTRACT (tp[i]) ||
!G_TYPE_IS_INSTANTIATABLE (tp[i]))
continue;
testname = g_strdup_printf ("/Accessible/%s", g_type_name (tp[i]));
g_test_add_data_func (testname, &tp[i], test_type);
g_free (testname);
}
return g_test_run ();
}