[gimp] Initialize some more stuff so real tests are possible



commit 654261775136919abd9a3cafe4bc0fe0d5785a6a
Author: Michael Natterer <mitch gimp org>
Date:   Mon Sep 7 19:06:57 2009 +0200

    Initialize some more stuff so real tests are possible
    
    * tests.[ch]: initialize base so we have a tile cache and add
      parameter "gboolean use_cpu_accel" so we can test stuff both with
      and without using CPU features.
    
    * tests/test-layer-grouping.c: changed accordingly. Call g_thread_init()
      so the tile cache works (and to be on the safe side in general).

 app/tests.c                     |   12 +++++++++---
 app/tests.h                     |    4 +++-
 app/tests/test-layer-grouping.c |    4 +++-
 3 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/app/tests.c b/app/tests.c
index 25665e8..6c71373 100644
--- a/app/tests.c
+++ b/app/tests.c
@@ -21,6 +21,10 @@
 
 #include "core/core-types.h"
 
+#include "base/base.h"
+
+#include "config/gimpbaseconfig.h"
+
 #include "core/gimp.h"
 
 #include "tests.h"
@@ -34,14 +38,16 @@
  * selected subset of the initialization happning in app_run().
  **/
 Gimp *
-gimp_init_for_testing (void)
+gimp_init_for_testing (gboolean use_cpu_accel)
 {
-  Gimp *gimp  = gimp_new ("Unit Tested GIMP", NULL, FALSE, TRUE, TRUE, TRUE,
-                          FALSE, TRUE, TRUE, FALSE);
+  Gimp *gimp = gimp_new ("Unit Tested GIMP", NULL, FALSE, TRUE, TRUE, TRUE,
+                         FALSE, TRUE, TRUE, FALSE);
 
   units_init (gimp);
 
   gimp_load_config (gimp, NULL, NULL);
 
+  base_init (GIMP_BASE_CONFIG (gimp->config), FALSE, use_cpu_accel);
+
   return gimp;
 }
diff --git a/app/tests.h b/app/tests.h
index 19ea5be..3fd9376 100644
--- a/app/tests.h
+++ b/app/tests.h
@@ -18,6 +18,8 @@
 #ifndef __TESTS_H__
 #define __TESTS_H__
 
-Gimp * gimp_init_for_testing (void);
+
+Gimp * gimp_init_for_testing (gboolean use_cpu_accel);
+
 
 #endif /* __TESTS_H__ */
diff --git a/app/tests/test-layer-grouping.c b/app/tests/test-layer-grouping.c
index 7d68886..59010cc 100644
--- a/app/tests/test-layer-grouping.c
+++ b/app/tests/test-layer-grouping.c
@@ -50,11 +50,13 @@ int
 main (int    argc,
       char **argv)
 {
+  g_thread_init (NULL);
   g_type_init ();
+
   g_test_init (&argc, &argv, NULL);
 
   /* We share the same application instance across all tests */
-  gimp = gimp_init_for_testing ();
+  gimp = gimp_init_for_testing (TRUE);
 
   /* Setup the tests */
   g_test_add ("/gimp-layer-grouping/add-layer",



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