/* This is exactly the style information you've been looking for */
#define GTK_STYLE_PROVIDER_PRIORITY_FORCE G_MAXUINT
+static char *arg_output_dir = NULL;
+
+static const GOptionEntry test_args[] = {
+ { "output", 'o', 0, G_OPTION_ARG_FILENAME, &arg_output_dir,
+ "Directory to save image files to", "DIR" },
+ { NULL }
+};
+
+static gboolean
+parse_command_line (int *argc, char ***argv)
+{
+ GError *error = NULL;
+ GOptionContext *context;
+
+ context = g_option_context_new ("- run GTK reftests");
+ 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;
+ }
+
+ gtk_test_init (argc, argv);
+
+ return TRUE;
+}
+
static const char *
get_output_dir (void)
{
if (output_dir)
return output_dir;
- output_dir = g_get_tmp_dir ();
+ if (arg_output_dir)
+ {
+ GFile *file = g_file_new_for_commandline_arg (arg_output_dir);
+ output_dir = g_file_get_path (file);
+ g_object_unref (file);
+ }
+ else
+ {
+ output_dir = g_get_tmp_dir ();
+ }
if (!g_file_test (output_dir, G_FILE_TEST_EXISTS))
{
int
main (int argc, char **argv)
{
- gtk_test_init (&argc, &argv);
+ if (!parse_command_line (&argc, &argv))
+ return 1;
if (argc < 2)
{