int main (int argc, char *argv[]) { const gchar *basedir; GFile *dir; GError *error = NULL; GOptionContext *context; context = g_option_context_new ("- run GTK state tests"); g_option_context_add_main_entries (context, test_args, NULL); g_option_context_set_ignore_unknown_options (context, TRUE); if (!g_option_context_parse (context, &argc, &argv, &error)) { g_print ("option parsing failed: %s\n", error->message); return FALSE; } g_option_context_free (context); gtk_test_init (&argc, &argv, NULL); if (arg_base_dir) basedir = arg_base_dir; else basedir = g_test_get_dir (G_TEST_DIST); dir = g_file_new_for_path (basedir); add_tests_for_files_in_directory (dir); g_object_unref (dir); return g_test_run (); }
static void set_up_mock_dbus_launch (void) { path = g_strconcat (g_test_get_dir (G_TEST_BUILT), ":", g_getenv ("PATH"), NULL); g_setenv ("PATH", path, TRUE); /* libdbus won't even try X11 autolaunch if DISPLAY is unset; GDBus * does the same in Debian derivatives (proposed upstream in * GNOME#723506) */ g_setenv ("DISPLAY", "an unrealistic mock X11 display", TRUE); }
const gchar * test_utils_get_test_data_path (void) { if (data_path) return data_path; data_path = g_build_filename (g_test_get_dir (G_TEST_DIST), "fixtures", NULL); return data_path; }
int main (int argc, char **argv) { const char *basedir; /* I don't want to fight fuzzy scaling algorithms in GPUs, * so unless you explicitly set it to something else, we * will use Cairo's image surface. */ g_setenv ("GDK_RENDERING", "image", FALSE); if (!parse_command_line (&argc, &argv)) return 1; if (arg_base_dir) basedir = arg_base_dir; else basedir = g_test_get_dir (G_TEST_DIST); if (argc < 2) { GFile *dir; dir = g_file_new_for_path (basedir); add_test_for_file (dir); g_object_unref (dir); } else { guint i; for (i = 1; i < argc; i++) { GFile *file = g_file_new_for_commandline_arg (argv[i]); add_test_for_file (file); g_object_unref (file); } } /* We need to ensure the process' current working directory * is the same as the reftest data, because we're using the * "file" property of GtkImage as a relative path in builder files. */ chdir (basedir); return g_test_run (); }
int main (int argc, char **argv) { gtk_test_init (&argc, &argv); G_GNUC_BEGIN_IGNORE_DEPRECATIONS; /* Add a bunch of properties so we can test that we parse them properly */ gtk_style_properties_register_property (NULL, g_param_spec_boolean ("boolean-property", "boolean property", "test boolean properties", TRUE, G_PARAM_READABLE)); gtk_style_properties_register_property (NULL, g_param_spec_int ("int-property", "int property", "test int properties", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); gtk_style_properties_register_property (NULL, g_param_spec_uint ("uint-property", "uint property", "test uint properties", 0, G_MAXUINT, 0, G_PARAM_READABLE)); gtk_style_properties_register_property (NULL, g_param_spec_string ("string-property", "string property", "test string properties", NULL, G_PARAM_READABLE)); gtk_style_properties_register_property (NULL, g_param_spec_boxed ("rgba-property", "rgba property", "test rgba properties", GDK_TYPE_RGBA, G_PARAM_READABLE)); gtk_style_properties_register_property (NULL, g_param_spec_boxed ("color-property", "color property", "test color properties", GDK_TYPE_COLOR, G_PARAM_READABLE)); gtk_style_properties_register_property (NULL, g_param_spec_boxed ("border-property", "border property", "test border properties", GTK_TYPE_BORDER, G_PARAM_READABLE)); gtk_style_properties_register_property (NULL, g_param_spec_boxed ("font-property", "font property", "test font properties", PANGO_TYPE_FONT_DESCRIPTION, G_PARAM_READABLE)); #if 0 /* not public API, use transition instead */ gtk_style_properties_register_property (NULL, g_param_spec_boxed ("animation-property", "animation property", "test animation properties", GTK_TYPE_ANIMATION_DESCRIPTION, G_PARAM_READABLE)); #endif gtk_style_properties_register_property (NULL, g_param_spec_object ("engine-property", "engine property", "test theming engine properties", GTK_TYPE_THEMING_ENGINE, G_PARAM_READABLE)); gtk_style_properties_register_property (NULL, g_param_spec_enum ("enum-property", "enum property", "test enum properties", GTK_TYPE_SHADOW_TYPE, 0, G_PARAM_READABLE)); gtk_style_properties_register_property (NULL, g_param_spec_flags ("flags-property", "flags property", "test flags properties", GTK_TYPE_STATE_FLAGS, GTK_STATE_FLAG_NORMAL, G_PARAM_READABLE)); gtk_style_properties_register_property (parse_uint8, g_param_spec_uchar ("uint8-property", "uint8 property", "test uint8 properties", 0, G_MAXUINT8, 0, G_PARAM_READABLE)); G_GNUC_END_IGNORE_DEPRECATIONS; if (argc < 2) { const char *basedir; GFile *dir; basedir = g_test_get_dir (G_TEST_DIST); dir = g_file_new_for_path (basedir); add_tests_for_files_in_directory (dir); g_object_unref (dir); } else { guint i; for (i = 1; i < argc; i++) { GFile *file = g_file_new_for_commandline_arg (argv[i]); add_test_for_file (file); g_object_unref (file); } } return g_test_run (); }