[gimp] app: symlink an icon theme into /tmp for running the tests
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: symlink an icon theme into /tmp for running the tests
- Date: Tue, 13 May 2014 15:09:47 +0000 (UTC)
commit a91007756c15bf27b6e2694fd480bf03ff32331c
Author: Michael Natterer <mitch gimp org>
Date: Tue May 13 17:07:32 2014 +0200
app: symlink an icon theme into /tmp for running the tests
app/tests.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
---
diff --git a/app/tests.c b/app/tests.c
index 4db041c..db03950 100644
--- a/app/tests.c
+++ b/app/tests.c
@@ -82,6 +82,67 @@ gimp_init_for_testing (void)
#ifndef GIMP_CONSOLE_COMPILATION
+static void
+gimp_init_icon_theme_for_testing (void)
+{
+ const gchar *top_srcdir = g_getenv ("GIMP_TESTING_ABS_TOP_SRCDIR");
+ gchar *icon_root;
+ gchar *link_name;
+ gchar *link_target;
+ gint i;
+
+ static const gchar *sizes[] = { "12x12", "16x16", "18x18", "20x20", "22x22",
+ "24x24", "32x32", "48x48", "64x64" };
+
+ if (! top_srcdir)
+ {
+ g_printerr ("*\n"
+ "* The env var GIMP_TESTING_ABS_TOP_SRCDIR is not set,\n"
+ "* you are probably running in a debugger.\n"
+ "* Set it manually, e.g.:\n"
+ "*\n"
+ "* set env GIMP_TESTING_ABS_TOP_SRCDIR=%s/source/gimp\n"
+ "*\n",
+ g_get_home_dir ());
+ return;
+ }
+
+ icon_root = g_dir_make_tmp ("gimp-test-icon-theme-XXXXXX", NULL);
+ if (! icon_root)
+ return;
+
+ for (i = 0; i < G_N_ELEMENTS (sizes); i++)
+ {
+ gchar *icon_dir;
+
+ icon_dir = g_build_filename (icon_root, "hicolor", sizes[i], NULL);
+ g_mkdir_with_parents (icon_dir, 0700);
+
+ link_name = g_build_filename (icon_dir, "apps", NULL);
+ link_target = g_build_filename (top_srcdir, "icons", sizes[i] + 3, NULL);
+
+ symlink (link_target, link_name);
+
+ g_free (link_target);
+ g_free (link_name);
+
+ g_free (icon_dir);
+ }
+
+ link_name = g_build_filename (icon_root, "hicolor", "index.theme", NULL);
+ link_target = g_build_filename (top_srcdir, "icons", "index.theme", NULL);
+
+ symlink (link_target, link_name);
+
+ g_free (link_target);
+ g_free (link_name);
+
+ gtk_icon_theme_prepend_search_path (gtk_icon_theme_get_default (),
+ icon_root);
+
+ g_free (icon_root);
+}
+
static Gimp *
gimp_init_for_gui_testing_internal (gboolean show_gui,
const gchar *gimprc)
@@ -105,6 +166,7 @@ gimp_init_for_gui_testing_internal (gboolean show_gui,
gimp_load_config (gimp, gimprc, NULL);
gimp_gegl_init (gimp);
gui_init (gimp, TRUE);
+ gimp_init_icon_theme_for_testing ();
gimp_initialize (gimp, gimp_status_func_dummy);
gimp_restore (gimp, gimp_status_func_dummy);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]