[gimp] app/tests: Add gimp_init_for_gui_testing_with_rc()



commit f73092bb41e66cb2d2bc42a991d56867c5f4c6f6
Author: Martin Nordholts <martinn src gnome org>
Date:   Mon Jun 6 20:04:20 2011 +0200

    app/tests: Add gimp_init_for_gui_testing_with_rc()

 app/tests.c |   48 ++++++++++++++++++++++++++++++++++++------------
 app/tests.h |    6 ++++--
 2 files changed, 40 insertions(+), 14 deletions(-)
---
diff --git a/app/tests.c b/app/tests.c
index 28a6cfa..ef5b771 100644
--- a/app/tests.c
+++ b/app/tests.c
@@ -82,17 +82,9 @@ gimp_init_for_testing (void)
 
 #ifndef GIMP_CONSOLE_COMPILATION
 
-/**
- * gimp_init_for_gui_testing:
- * @use_cpu_accel:
- *
- * Initializes a #Gimp instance for use in test cases that rely on GUI
- * code to be initialized.
- *
- * Returns: The #Gimp instance.
- **/
-Gimp *
-gimp_init_for_gui_testing (gboolean show_gui)
+static Gimp *
+gimp_init_for_gui_testing_internal (gboolean     show_gui,
+                                    const gchar *gimprc)
 {
   GimpSessionInfoClass *klass;
   Gimp                 *gimp;
@@ -111,7 +103,7 @@ gimp_init_for_gui_testing (gboolean show_gui)
                    FALSE, TRUE, TRUE, FALSE);
   gimp_set_show_gui (gimp, show_gui);
   units_init (gimp);
-  gimp_load_config (gimp, NULL, NULL);
+  gimp_load_config (gimp, gimprc, NULL);
   base_init (GIMP_BASE_CONFIG (gimp->config),
              FALSE /*be_verbose*/,
              FALSE /*use_cpu_accel*/);
@@ -124,6 +116,38 @@ gimp_init_for_gui_testing (gboolean show_gui)
   return gimp;
 }
 
+/**
+ * gimp_init_for_gui_testing:
+ * @show_gui:
+ *
+ * Initializes a #Gimp instance for use in test cases that rely on GUI
+ * code to be initialized.
+ *
+ * Returns: The #Gimp instance.
+ **/
+Gimp *
+gimp_init_for_gui_testing (gboolean show_gui)
+{
+  return gimp_init_for_gui_testing_internal (show_gui, NULL);
+}
+
+/**
+ * gimp_init_for_gui_testing:
+ * @show_gui:
+ * @gimprc:
+ *
+ * Like gimp_init_for_gui_testing(), but also allows a custom gimprc
+ * filename to be specified.
+ *
+ * Returns: The #Gimp instance.
+ **/
+Gimp *
+gimp_init_for_gui_testing_with_rc (gboolean     show_gui,
+                                   const gchar *gimprc)
+{
+  return gimp_init_for_gui_testing_internal (show_gui, gimprc);
+}
+
 #endif /* GIMP_CONSOLE_COMPILATION */
 
 static gboolean
diff --git a/app/tests.h b/app/tests.h
index 3aa396a..0f783fa 100644
--- a/app/tests.h
+++ b/app/tests.h
@@ -20,8 +20,10 @@
 
 
 Gimp * gimp_init_for_testing             (void);
-Gimp * gimp_init_for_gui_testing         (gboolean show_gui);
-void   gimp_test_run_temp_mainloop       (guint32  running_time);
+Gimp * gimp_init_for_gui_testing         (gboolean     show_gui);
+Gimp * gimp_init_for_gui_testing_with_rc (gboolean     show_gui,
+                                          const gchar *gimprc);
+void   gimp_test_run_temp_mainloop       (guint32      running_time);
 void   gimp_test_run_mainloop_until_idle (void);
 void   gimp_test_bail_if_no_display      (void);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]