[gimp] app/tests: Remove static Gimp *gimp



commit 2b2ecd1af12527d36d030da585a3bcde3bc498ee
Author: Martin Nordholts <martinn src gnome org>
Date:   Fri Sep 30 07:55:55 2011 +0200

    app/tests: Remove static Gimp *gimp
    
    Say no to evilness.

 app/tests/test-core.c |   11 ++++++-----
 app/tests/test-xcf.c  |   47 ++++++++++++++++++++++++++++++-----------------
 2 files changed, 36 insertions(+), 22 deletions(-)
---
diff --git a/app/tests/test-core.c b/app/tests/test-core.c
index ea8c9ba..dc94336 100644
--- a/app/tests/test-core.c
+++ b/app/tests/test-core.c
@@ -63,9 +63,6 @@ static void gimp_test_image_teardown (GimpTestFixture *fixture,
                                       gconstpointer    data);
 
 
-static Gimp *gimp = NULL;
-
-
 /**
  * gimp_test_image_setup:
  * @fixture:
@@ -77,6 +74,8 @@ static void
 gimp_test_image_setup (GimpTestFixture *fixture,
                        gconstpointer    data)
 {
+  Gimp *gimp = GIMP (data);
+
   fixture->image = gimp_image_new (gimp,
                                    GIMP_TEST_IMAGE_SIZE,
                                    GIMP_TEST_IMAGE_SIZE,
@@ -110,7 +109,8 @@ static void
 rotate_non_overlapping (GimpTestFixture *fixture,
                         gconstpointer    data)
 {
-  GimpImage   *image = fixture->image;
+  Gimp        *gimp    = GIMP (data);
+  GimpImage   *image   = fixture->image;
   GimpLayer   *layer;
   GimpContext *context = gimp_context_new (gimp, "Test", NULL /*template*/);
   gboolean     result;
@@ -225,7 +225,8 @@ int
 main (int    argc,
       char **argv)
 {
-  int result;
+  Gimp *gimp;
+  int   result;
 
   g_thread_init (NULL);
   g_type_init ();
diff --git a/app/tests/test-xcf.c b/app/tests/test-xcf.c
index 768f1d8..19b3ae4 100644
--- a/app/tests/test-xcf.c
+++ b/app/tests/test-xcf.c
@@ -138,7 +138,7 @@
 #define ADD_TEST(function) \
   g_test_add ("/gimp-xcf/" #function, \
               GimpTestFixture, \
-              NULL, \
+              gimp, \
               NULL, \
               function, \
               NULL);
@@ -152,10 +152,12 @@ typedef struct
 
 GimpImage        * gimp_test_load_image                        (Gimp            *gimp,
                                                                 const gchar     *uri);
-static void        gimp_write_and_read_file                    (gboolean         with_unusual_stuff,
+static void        gimp_write_and_read_file                    (Gimp            *gimp,
+                                                                gboolean         with_unusual_stuff,
                                                                 gboolean         compat_paths,
                                                                 gboolean         use_gimp_2_8_features);
-static GimpImage * gimp_create_mainimage                       (gboolean         with_unusual_stuff,
+static GimpImage * gimp_create_mainimage                       (Gimp            *gimp,
+                                                                gboolean         with_unusual_stuff,
                                                                 gboolean         compat_paths,
                                                                 gboolean         use_gimp_2_8_features);
 static void        gimp_assert_mainimage                       (GimpImage       *image,
@@ -164,9 +166,6 @@ static void        gimp_assert_mainimage                       (GimpImage
                                                                 gboolean         use_gimp_2_8_features);
 
 
-static Gimp *gimp = NULL;
-
-
 /**
  * write_and_read_gimp_2_6_format:
  * @fixture:
@@ -179,7 +178,10 @@ static void
 write_and_read_gimp_2_6_format (GimpTestFixture *fixture,
                                 gconstpointer    data)
 {
-  gimp_write_and_read_file (FALSE /*with_unusual_stuff*/,
+  Gimp *gimp = GIMP (data);
+
+  gimp_write_and_read_file (gimp,
+                            FALSE /*with_unusual_stuff*/,
                             FALSE /*compat_paths*/,
                             FALSE /*use_gimp_2_8_features*/);
 }
@@ -197,7 +199,10 @@ static void
 write_and_read_gimp_2_6_format_unusual (GimpTestFixture *fixture,
                                         gconstpointer    data)
 {
-  gimp_write_and_read_file (TRUE /*with_unusual_stuff*/,
+  Gimp *gimp = GIMP (data);
+
+  gimp_write_and_read_file (gimp,
+                            TRUE /*with_unusual_stuff*/,
                             TRUE /*compat_paths*/,
                             FALSE /*use_gimp_2_8_features*/);
 }
@@ -214,6 +219,7 @@ static void
 load_gimp_2_6_file (GimpTestFixture *fixture,
                     gconstpointer    data)
 {
+  Gimp      *gimp  = GIMP (data);
   GimpImage *image = NULL;
   gchar     *uri   = NULL;
 
@@ -248,7 +254,10 @@ static void
 write_and_read_gimp_2_8_format (GimpTestFixture *fixture,
                                 gconstpointer    data)
 {
-  gimp_write_and_read_file (FALSE /*with_unusual_stuff*/,
+  Gimp *gimp = GIMP (data);
+
+  gimp_write_and_read_file (gimp,
+                            FALSE /*with_unusual_stuff*/,
                             FALSE /*compat_paths*/,
                             TRUE /*use_gimp_2_8_features*/);
 }
@@ -288,9 +297,10 @@ gimp_test_load_image (Gimp        *gimp,
  * function can be used for different formats.
  **/
 static void
-gimp_write_and_read_file (gboolean with_unusual_stuff,
-                          gboolean compat_paths,
-                          gboolean use_gimp_2_8_features)
+gimp_write_and_read_file (Gimp     *gimp,
+                          gboolean  with_unusual_stuff,
+                          gboolean  compat_paths,
+                          gboolean  use_gimp_2_8_features)
 {
   GimpImage           *image        = NULL;
   GimpImage           *loaded_image = NULL;
@@ -298,7 +308,8 @@ gimp_write_and_read_file (gboolean with_unusual_stuff,
   gchar               *uri          = NULL;
 
   /* Create the image */
-  image = gimp_create_mainimage (with_unusual_stuff,
+  image = gimp_create_mainimage (gimp,
+                                 with_unusual_stuff,
                                  compat_paths,
                                  use_gimp_2_8_features);
 
@@ -348,9 +359,10 @@ gimp_write_and_read_file (gboolean with_unusual_stuff,
  * Returns: The #GimpImage
  **/
 static GimpImage *
-gimp_create_mainimage (gboolean with_unusual_stuff,
-                       gboolean compat_paths,
-                       gboolean use_gimp_2_8_features)
+gimp_create_mainimage (Gimp     *gimp,
+                       gboolean  with_unusual_stuff,
+                       gboolean  compat_paths,
+                       gboolean  use_gimp_2_8_features)
 {
   GimpImage     *image             = NULL;
   GimpLayer     *layer             = NULL;
@@ -972,7 +984,8 @@ int
 main (int    argc,
       char **argv)
 {
-  int result;
+  Gimp *gimp;
+  int   result;
 
   g_thread_init (NULL);
   g_type_init ();



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