static void add_test_for_file (GFile *file) { g_test_add_vtable (g_file_get_path (file), 0, g_object_ref (file), NULL, (GTestFixtureFunc) test_css_file, (GTestFixtureFunc) g_object_unref); }
int main (int argc, char *argv[]) { g_test_init (&argc, &argv, NULL); /* Unset variables that would make libproxy try to use gconf or ksettings */ g_unsetenv ("GNOME_DESKTOP_SESSION_ID"); g_unsetenv ("DESKTOP_SESSION"); g_unsetenv ("KDE_FULL_SESSION"); g_test_add_vtable ("/proxy/libproxy/uri", 0, NULL, reset_proxy_settings, test_proxy_uri, NULL); g_test_add_vtable ("/proxy/libproxy/socks", 0, NULL, reset_proxy_settings, test_proxy_socks, NULL); g_test_add_vtable ("/proxy/libproxy/ignore", 0, NULL, reset_proxy_settings, test_proxy_ignore, NULL); return g_test_run(); }
static void add_test_for_file (GFile *file) { GFileEnumerator *enumerator; GFileInfo *info; GList *files; GError *error = NULL; if (g_file_query_file_type (file, 0, NULL) != G_FILE_TYPE_DIRECTORY) { g_test_add_vtable (g_file_get_path (file), 0, g_object_ref (file), NULL, (GTestFixtureFunc) test_ui_file, (GTestFixtureFunc) g_object_unref); return; } enumerator = g_file_enumerate_children (file, G_FILE_ATTRIBUTE_STANDARD_NAME, 0, NULL, &error); g_assert_no_error (error); files = NULL; while ((info = g_file_enumerator_next_file (enumerator, NULL, &error))) { const char *filename; filename = g_file_info_get_name (info); if (!g_str_has_suffix (filename, ".ui") || g_str_has_suffix (filename, ".ref.ui")) { g_object_unref (info); continue; } files = g_list_prepend (files, g_file_get_child (file, filename)); g_object_unref (info); } g_assert_no_error (error); g_object_unref (enumerator); files = g_list_sort (files, compare_files); g_list_foreach (files, (GFunc) add_test_for_file, NULL); g_list_free_full (files, g_object_unref); }
int main (int argc, char *argv[]) { g_test_init (&argc, &argv, NULL); /* Unset variables that would make libproxy try to use gconf or ksettings */ g_unsetenv ("GNOME_DESKTOP_SESSION_ID"); g_unsetenv ("DESKTOP_SESSION"); g_unsetenv ("KDE_FULL_SESSION"); /* Use the just-built libproxy module */ g_setenv ("GIO_EXTRA_MODULES", TOP_BUILDDIR "/proxy/libproxy/.libs", TRUE); g_test_add_vtable ("/proxy/libproxy/uri", 0, NULL, reset_proxy_settings, test_proxy_uri, NULL); g_test_add_vtable ("/proxy/libproxy/socks", 0, NULL, reset_proxy_settings, test_proxy_socks, NULL); g_test_add_vtable ("/proxy/libproxy/ignore", 0, NULL, reset_proxy_settings, test_proxy_ignore, NULL); return g_test_run(); }
static void add_test_for_file (GFile *file) { char *path; path = g_file_get_path (file); g_test_add_vtable (path, 0, g_object_ref (file), NULL, (GTestFixtureFunc) test_css_file, (GTestFixtureFunc) g_object_unref); g_free (path); }