app/tests: Remove static Gimp *gimp

Say no to evilness.
This commit is contained in:
Martin Nordholts
2011-09-30 07:55:55 +02:00
parent a324206a3e
commit 2b2ecd1af1
2 changed files with 36 additions and 22 deletions

View File

@ -63,9 +63,6 @@ static void gimp_test_image_teardown (GimpTestFixture *fixture,
gconstpointer data); gconstpointer data);
static Gimp *gimp = NULL;
/** /**
* gimp_test_image_setup: * gimp_test_image_setup:
* @fixture: * @fixture:
@ -77,6 +74,8 @@ static void
gimp_test_image_setup (GimpTestFixture *fixture, gimp_test_image_setup (GimpTestFixture *fixture,
gconstpointer data) gconstpointer data)
{ {
Gimp *gimp = GIMP (data);
fixture->image = gimp_image_new (gimp, fixture->image = gimp_image_new (gimp,
GIMP_TEST_IMAGE_SIZE, GIMP_TEST_IMAGE_SIZE,
GIMP_TEST_IMAGE_SIZE, GIMP_TEST_IMAGE_SIZE,
@ -110,7 +109,8 @@ static void
rotate_non_overlapping (GimpTestFixture *fixture, rotate_non_overlapping (GimpTestFixture *fixture,
gconstpointer data) gconstpointer data)
{ {
GimpImage *image = fixture->image; Gimp *gimp = GIMP (data);
GimpImage *image = fixture->image;
GimpLayer *layer; GimpLayer *layer;
GimpContext *context = gimp_context_new (gimp, "Test", NULL /*template*/); GimpContext *context = gimp_context_new (gimp, "Test", NULL /*template*/);
gboolean result; gboolean result;
@ -225,7 +225,8 @@ int
main (int argc, main (int argc,
char **argv) char **argv)
{ {
int result; Gimp *gimp;
int result;
g_thread_init (NULL); g_thread_init (NULL);
g_type_init (); g_type_init ();

View File

@ -138,7 +138,7 @@
#define ADD_TEST(function) \ #define ADD_TEST(function) \
g_test_add ("/gimp-xcf/" #function, \ g_test_add ("/gimp-xcf/" #function, \
GimpTestFixture, \ GimpTestFixture, \
NULL, \ gimp, \
NULL, \ NULL, \
function, \ function, \
NULL); NULL);
@ -152,10 +152,12 @@ typedef struct
GimpImage * gimp_test_load_image (Gimp *gimp, GimpImage * gimp_test_load_image (Gimp *gimp,
const gchar *uri); 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 compat_paths,
gboolean use_gimp_2_8_features); 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 compat_paths,
gboolean use_gimp_2_8_features); gboolean use_gimp_2_8_features);
static void gimp_assert_mainimage (GimpImage *image, static void gimp_assert_mainimage (GimpImage *image,
@ -164,9 +166,6 @@ static void gimp_assert_mainimage (GimpImage
gboolean use_gimp_2_8_features); gboolean use_gimp_2_8_features);
static Gimp *gimp = NULL;
/** /**
* write_and_read_gimp_2_6_format: * write_and_read_gimp_2_6_format:
* @fixture: * @fixture:
@ -179,7 +178,10 @@ static void
write_and_read_gimp_2_6_format (GimpTestFixture *fixture, write_and_read_gimp_2_6_format (GimpTestFixture *fixture,
gconstpointer data) 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 /*compat_paths*/,
FALSE /*use_gimp_2_8_features*/); FALSE /*use_gimp_2_8_features*/);
} }
@ -197,7 +199,10 @@ static void
write_and_read_gimp_2_6_format_unusual (GimpTestFixture *fixture, write_and_read_gimp_2_6_format_unusual (GimpTestFixture *fixture,
gconstpointer data) 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*/, TRUE /*compat_paths*/,
FALSE /*use_gimp_2_8_features*/); FALSE /*use_gimp_2_8_features*/);
} }
@ -214,6 +219,7 @@ static void
load_gimp_2_6_file (GimpTestFixture *fixture, load_gimp_2_6_file (GimpTestFixture *fixture,
gconstpointer data) gconstpointer data)
{ {
Gimp *gimp = GIMP (data);
GimpImage *image = NULL; GimpImage *image = NULL;
gchar *uri = NULL; gchar *uri = NULL;
@ -248,7 +254,10 @@ static void
write_and_read_gimp_2_8_format (GimpTestFixture *fixture, write_and_read_gimp_2_8_format (GimpTestFixture *fixture,
gconstpointer data) 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 /*compat_paths*/,
TRUE /*use_gimp_2_8_features*/); TRUE /*use_gimp_2_8_features*/);
} }
@ -288,9 +297,10 @@ gimp_test_load_image (Gimp *gimp,
* function can be used for different formats. * function can be used for different formats.
**/ **/
static void static void
gimp_write_and_read_file (gboolean with_unusual_stuff, gimp_write_and_read_file (Gimp *gimp,
gboolean compat_paths, gboolean with_unusual_stuff,
gboolean use_gimp_2_8_features) gboolean compat_paths,
gboolean use_gimp_2_8_features)
{ {
GimpImage *image = NULL; GimpImage *image = NULL;
GimpImage *loaded_image = NULL; GimpImage *loaded_image = NULL;
@ -298,7 +308,8 @@ gimp_write_and_read_file (gboolean with_unusual_stuff,
gchar *uri = NULL; gchar *uri = NULL;
/* Create the image */ /* Create the image */
image = gimp_create_mainimage (with_unusual_stuff, image = gimp_create_mainimage (gimp,
with_unusual_stuff,
compat_paths, compat_paths,
use_gimp_2_8_features); use_gimp_2_8_features);
@ -348,9 +359,10 @@ gimp_write_and_read_file (gboolean with_unusual_stuff,
* Returns: The #GimpImage * Returns: The #GimpImage
**/ **/
static GimpImage * static GimpImage *
gimp_create_mainimage (gboolean with_unusual_stuff, gimp_create_mainimage (Gimp *gimp,
gboolean compat_paths, gboolean with_unusual_stuff,
gboolean use_gimp_2_8_features) gboolean compat_paths,
gboolean use_gimp_2_8_features)
{ {
GimpImage *image = NULL; GimpImage *image = NULL;
GimpLayer *layer = NULL; GimpLayer *layer = NULL;
@ -972,7 +984,8 @@ int
main (int argc, main (int argc,
char **argv) char **argv)
{ {
int result; Gimp *gimp;
int result;
g_thread_init (NULL); g_thread_init (NULL);
g_type_init (); g_type_init ();