int main (int argc, char **argv) { const GType *otypes; guint i; gchar *schema_dir; GTestDBus *bus; GMainLoop *loop; gint result; /* These must be set before before gtk_test_init */ g_setenv ("GIO_USE_VFS", "local", TRUE); g_setenv ("GSETTINGS_BACKEND", "memory", TRUE); g_setenv ("G_ENABLE_DIAGNOSTIC", "0", TRUE); gtk_test_init (&argc, &argv); gtk_test_register_all_types(); /* g_test_build_filename must be called after gtk_test_init */ schema_dir = g_test_build_filename (G_TEST_BUILT, "", NULL); g_setenv ("GSETTINGS_SCHEMA_DIR", schema_dir, TRUE); /* Create one test bus for all tests, as we have a lot of very small * and quick tests. */ bus = g_test_dbus_new (G_TEST_DBUS_NONE); g_test_dbus_up (bus); otypes = gtk_test_list_all_types (NULL); for (i = 0; otypes[i]; i++) { gchar *testname; if (otypes[i] == GTK_TYPE_FILE_CHOOSER_NATIVE) continue; testname = g_strdup_printf ("/Default Values/%s", g_type_name (otypes[i])); g_test_add_data_func (testname, &otypes[i], test_type); g_free (testname); } result = g_test_run(); /* Work around the annoying issue that g_test_dbus_down is giving * us an "Error while sending AddMatch" that comes out of an idle */ loop = g_main_loop_new (NULL, FALSE); g_timeout_add (1000, (GSourceFunc)g_main_loop_quit, loop); g_main_loop_run (loop); g_main_loop_unref (loop); g_test_dbus_down (bus); g_object_unref (bus); g_free (schema_dir); return result; }
int main (int argc, char **argv) { const GType *otypes; guint i; gtk_test_init (&argc, &argv); pixbuf_init (); gtk_test_register_all_types(); otypes = gtk_test_list_all_types (NULL); for (i = 0; otypes[i]; i++) { gchar *testname; testname = g_strdup_printf ("/Default Values/%s", g_type_name (otypes[i])); g_test_add_data_func (testname, &otypes[i], test_type); g_free (testname); } return g_test_run(); }
/* --- main test program --- */ int main (int argc, char *argv[]) { const GType *otypes; guint i; /* initialize test program */ gtk_test_init (&argc, &argv); gtk_test_register_all_types (); /* install a property test for each widget type */ otypes = gtk_test_list_all_types (NULL); for (i = 0; otypes[i]; i++) if (g_type_is_a (otypes[i], GTK_TYPE_WIDGET) && G_TYPE_IS_OBJECT (otypes[i]) && !G_TYPE_IS_ABSTRACT (otypes[i])) { gchar *testpath = g_strdup_printf ("/properties/%s", g_type_name (otypes[i])); g_test_add_data_func (testpath, (void*) otypes[i], widget_property_tests); g_free (testpath); } return g_test_run (); }
int main (int argc, char **argv) { const GType *all_types; guint n_types = 0, i; gchar *schema_dir; GTestDBus *bus; gint result; /* These must be set before before gtk_test_init */ g_setenv ("GIO_USE_VFS", "local", TRUE); g_setenv ("GSETTINGS_BACKEND", "memory", TRUE); /* initialize test program */ gtk_test_init (&argc, &argv); gtk_test_register_all_types (); /* g_test_build_filename must be called after gtk_test_init */ schema_dir = g_test_build_filename (G_TEST_BUILT, "", NULL); g_setenv ("GSETTINGS_SCHEMA_DIR", schema_dir, TRUE); /* Create one test bus for all tests, as we have a lot of very small * and quick tests. */ bus = g_test_dbus_new (G_TEST_DBUS_NONE); g_test_dbus_up (bus); all_types = gtk_test_list_all_types (&n_types); for (i = 0; i < n_types; i++) { if (g_type_is_a (all_types[i], G_TYPE_OBJECT) && G_TYPE_IS_INSTANTIATABLE (all_types[i]) && !G_TYPE_IS_ABSTRACT (all_types[i]) && #ifdef GDK_WINDOWING_X11 all_types[i] != GDK_TYPE_X11_WINDOW && all_types[i] != GDK_TYPE_X11_CURSOR && all_types[i] != GDK_TYPE_X11_SCREEN && all_types[i] != GDK_TYPE_X11_DISPLAY && all_types[i] != GDK_TYPE_X11_DEVICE_MANAGER_XI2 && all_types[i] != GDK_TYPE_X11_DISPLAY_MANAGER && all_types[i] != GDK_TYPE_X11_GL_CONTEXT && #endif /* Not allowed to finalize a GdkPixbufLoader without calling gdk_pixbuf_loader_close() */ all_types[i] != GDK_TYPE_PIXBUF_LOADER && all_types[i] != gdk_pixbuf_simple_anim_iter_get_type()) { gchar *test_path = g_strdup_printf ("/FinalizeObject/%s", g_type_name (all_types[i])); g_test_add_data_func (test_path, GSIZE_TO_POINTER (all_types[i]), test_finalize_object); g_free (test_path); } } result = g_test_run(); g_test_dbus_down (bus); g_object_unref (bus); g_free (schema_dir); return result; }