[gimp] app/tests: Generalize gimp_test_utils_set_gimp2_directory()
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app/tests: Generalize gimp_test_utils_set_gimp2_directory()
- Date: Sat, 30 Jan 2010 07:06:18 +0000 (UTC)
commit f77c4009573f8ac8a4578b82477d8f00c66fd561
Author: Martin Nordholts <martinn src gnome org>
Date: Sat Jan 30 07:38:25 2010 +0100
app/tests: Generalize gimp_test_utils_set_gimp2_directory()
Support both builddir and srcdir with
gimp_test_utils_set_gimp2_directory() so we can have gimpdir-output in
the build dir.
app/tests/gimp-app-test-utils.c | 16 ++++++++--------
app/tests/gimp-app-test-utils.h | 3 ++-
app/tests/test-layer-grouping.c | 3 ++-
app/tests/test-layers.c | 3 ++-
app/tests/test-session-management.c | 6 ++++--
app/tests/test-ui.c | 6 ++++--
app/tests/test-window-management.c | 6 ++++--
app/tests/test-xcf.c | 6 ++++--
8 files changed, 30 insertions(+), 19 deletions(-)
---
diff --git a/app/tests/gimp-app-test-utils.c b/app/tests/gimp-app-test-utils.c
index 8c08164..b8eda87 100644
--- a/app/tests/gimp-app-test-utils.c
+++ b/app/tests/gimp-app-test-utils.c
@@ -46,18 +46,18 @@ gimp_test_utils_set_env_to_subdir (const gchar *root_env_var,
/**
* gimp_test_utils_set_gimp2_directory:
- * @subdir: Subdir, may be %NULL
+ * @root_env_var: Either "GIMP_TESTING_ABS_TOP_SRCDIR" or
+ * "GIMP_TESTING_ABS_TOP_BUILDDIR"
+ * @subdir: Subdir, may be %NULL
*
- * Sets GIMP2_DIRECTORY to the source dir ./app/tests/@subdir. Make
- * sure to run it before using any of the GIMP functions.
+ * Sets GIMP2_DIRECTORY to the source dir @root_env_var/@subdir. The
+ * environment variables is set up by the test runner, see Makefile.am
**/
void
-gimp_test_utils_set_gimp2_directory (const gchar *subdir)
+gimp_test_utils_set_gimp2_directory (const gchar *root_env_var,
+ const gchar *subdir)
{
- /* GIMP_TESTING_ABS_TOP_SRCDIR is set by the automake test runner,
- * see Makefile.am
- */
- gimp_test_utils_set_env_to_subdir ("GIMP_TESTING_ABS_TOP_SRCDIR" /*root_env_var*/,
+ gimp_test_utils_set_env_to_subdir (root_env_var,
subdir,
"GIMP2_DIRECTORY" /*target_env_var*/);
}
diff --git a/app/tests/gimp-app-test-utils.h b/app/tests/gimp-app-test-utils.h
index 8af81cf..af3feb1 100644
--- a/app/tests/gimp-app-test-utils.h
+++ b/app/tests/gimp-app-test-utils.h
@@ -19,7 +19,8 @@
#define __GIMP_RECTANGLE_SELECT_TOOL_H__
-void gimp_test_utils_set_gimp2_directory (const gchar *subdir);
+void gimp_test_utils_set_gimp2_directory (const gchar *root_env_var,
+ const gchar *subdir);
void gimp_test_utils_setup_menus_dir (void);
diff --git a/app/tests/test-layer-grouping.c b/app/tests/test-layer-grouping.c
index f30abfb..f17d41d 100644
--- a/app/tests/test-layer-grouping.c
+++ b/app/tests/test-layer-grouping.c
@@ -56,7 +56,8 @@ main (int argc,
g_type_init ();
g_test_init (&argc, &argv, NULL);
- gimp_test_utils_set_gimp2_directory ("app/tests/gimpdir");
+ gimp_test_utils_set_gimp2_directory ("GIMP_TESTING_ABS_TOP_SRCDIR",
+ "app/tests/gimpdir");
/* We share the same application instance across all tests */
gimp = gimp_init_for_testing (TRUE);
diff --git a/app/tests/test-layers.c b/app/tests/test-layers.c
index 300fea5..98f131f 100644
--- a/app/tests/test-layers.c
+++ b/app/tests/test-layers.c
@@ -58,7 +58,8 @@ main (int argc,
g_type_init ();
g_test_init (&argc, &argv, NULL);
- gimp_test_utils_set_gimp2_directory ("app/tests/gimpdir");
+ gimp_test_utils_set_gimp2_directory ("GIMP_TESTING_ABS_TOP_SRCDIR",
+ "app/tests/gimpdir");
/* We share the same application instance across all tests */
gimp = gimp_init_for_testing (TRUE);
diff --git a/app/tests/test-session-management.c b/app/tests/test-session-management.c
index c7e3380..317e7b7 100644
--- a/app/tests/test-session-management.c
+++ b/app/tests/test-session-management.c
@@ -73,7 +73,8 @@ int main(int argc, char **argv)
g_test_init (&argc, &argv, NULL);
/* Make sure to run this before we use any GIMP functions */
- gimp_test_utils_set_gimp2_directory ("app/tests/gimpdir");
+ gimp_test_utils_set_gimp2_directory ("GIMP_TESTING_ABS_TOP_SRCDIR",
+ "app/tests/gimpdir");
gimp_test_utils_setup_menus_dir ();
/* Note that we expect the resulting sessionrc to be different from
@@ -104,7 +105,8 @@ int main(int argc, char **argv)
* dir. There is a hook in Makefile.am that makes sure the output
* dir exists
*/
- gimp_test_utils_set_gimp2_directory ("app/tests/gimpdir-output");
+ gimp_test_utils_set_gimp2_directory ("GIMP_TESTING_ABS_TOP_BUILDDIR",
+ "app/tests/gimpdir-output");
g_free (sessionrc_filename);
g_free (dockrc_filename);
sessionrc_filename = gimp_personal_rc_file ("sessionrc");
diff --git a/app/tests/test-ui.c b/app/tests/test-ui.c
index 14c0a55..de7abc8 100644
--- a/app/tests/test-ui.c
+++ b/app/tests/test-ui.c
@@ -70,7 +70,8 @@ int main(int argc, char **argv)
gtk_init (&argc, &argv);
g_test_init (&argc, &argv, NULL);
- gimp_test_utils_set_gimp2_directory ("app/tests/gimpdir");
+ gimp_test_utils_set_gimp2_directory ("GIMP_TESTING_ABS_TOP_SRCDIR",
+ "app/tests/gimpdir");
gimp_test_utils_setup_menus_dir ();
/* Start up GIMP */
@@ -107,7 +108,8 @@ int main(int argc, char **argv)
result = g_test_run ();
/* Don't write files to the source dir */
- gimp_test_utils_set_gimp2_directory ("app/tests/gimpdir-output");
+ gimp_test_utils_set_gimp2_directory ("GIMP_TESTING_ABS_TOP_BUILDDIR",
+ "app/tests/gimpdir-output");
/* Exit properly so we don't break script-fu plug-in wire */
gimp_exit (gimp, TRUE);
diff --git a/app/tests/test-window-management.c b/app/tests/test-window-management.c
index d3823c6..0bcd590 100644
--- a/app/tests/test-window-management.c
+++ b/app/tests/test-window-management.c
@@ -55,7 +55,8 @@ int main(int argc, char **argv)
gtk_init (&argc, &argv);
g_test_init (&argc, &argv, NULL);
- gimp_test_utils_set_gimp2_directory ("app/tests/gimpdir-empty");
+ gimp_test_utils_set_gimp2_directory ("GIMP_TESTING_ABS_TOP_SRCDIR",
+ "app/tests/gimpdir-empty");
/* We share the same application instance across all tests */
gimp = gimp_init_for_gui_testing (FALSE, FALSE);
@@ -72,7 +73,8 @@ int main(int argc, char **argv)
test_result = g_test_run ();
/* Don't write files to the source dir */
- gimp_test_utils_set_gimp2_directory ("app/tests/gimpdir-output");
+ gimp_test_utils_set_gimp2_directory ("GIMP_TESTING_ABS_TOP_BUILDDIR",
+ "app/tests/gimpdir-output");
/* Exit somewhat properly to avoid annoying warnings */
gimp_exit (gimp, TRUE);
diff --git a/app/tests/test-xcf.c b/app/tests/test-xcf.c
index 397a087..5f70c40 100644
--- a/app/tests/test-xcf.c
+++ b/app/tests/test-xcf.c
@@ -875,7 +875,8 @@ main (int argc,
gtk_init (&argc, &argv);
g_test_init (&argc, &argv, NULL);
- gimp_test_utils_set_gimp2_directory ("app/tests/gimpdir");
+ gimp_test_utils_set_gimp2_directory ("GIMP_TESTING_ABS_TOP_SRCDIR",
+ "app/tests/gimpdir");
/* We share the same application instance across all tests. We need
* the GUI variant for the file procs
@@ -909,7 +910,8 @@ main (int argc,
NULL);
/* Don't write files to the source dir */
- gimp_test_utils_set_gimp2_directory ("app/tests/gimpdir-output");
+ gimp_test_utils_set_gimp2_directory ("GIMP_TESTING_ABS_TOP_BUILDDIR",
+ "app/tests/gimpdir-output");
/* Exit so we don't break script-fu plug-in wire */
gimp_exit (gimp, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]