[gnome-shell/wip/fmuellner/test-fixes: 1/6] tests: Fix gnome-shell theme import



commit 3231cd8bdd359e12b3e457d9f289e914c045550a
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Feb 21 13:01:56 2018 +0100

    tests: Fix gnome-shell theme import
    
    The current import rule fails in two ways:
     - commit c62e7a6a moved the theme's stylesheet to the builddir
     - since commit 49c4ba56, assets are addressed as resource:// URIs
    
    Fix both issues by loading and referencing the theme resource instead
    of the stylesheet itself.

 tests/run-test.sh.in      | 2 +-
 tests/testcommon/test.css | 2 +-
 tests/testcommon/ui.js    | 3 +++
 3 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/tests/run-test.sh.in b/tests/run-test.sh.in
index 71b35aca0..ea6d15726 100755
--- a/tests/run-test.sh.in
+++ b/tests/run-test.sh.in
@@ -36,7 +36,7 @@ GJS_DEBUG_OUTPUT=stderr
 $verbose || GJS_DEBUG_TOPICS="JS ERROR;JS LOG"
 GNOME_SHELL_TESTSDIR="$srcdir/"
 GNOME_SHELL_JS="$srcdir/../js"
-GNOME_SHELL_DATADIR="$srcdir/../data"
+GNOME_SHELL_DATADIR="$builddir/../data"
 
 export GI_TYPELIB_PATH GJS_PATH GJS_DEBUG_OUTPUT GJS_DEBUG_TOPICS GNOME_SHELL_TESTSDIR GNOME_SHELL_JS 
GNOME_SHELL_DATADIR LD_PRELOAD
 
diff --git a/tests/testcommon/test.css b/tests/testcommon/test.css
index a181c8a99..b82d2309b 100644
--- a/tests/testcommon/test.css
+++ b/tests/testcommon/test.css
@@ -1,4 +1,4 @@
-@import "../../data/theme/gnome-shell.css";
+@import url("resource:///org/gnome/shell/theme/gnome-shell.css");
 
 stage {
     font: 16pt serif;
diff --git a/tests/testcommon/ui.js b/tests/testcommon/ui.js
index 51c136a39..df2655feb 100644
--- a/tests/testcommon/ui.js
+++ b/tests/testcommon/ui.js
@@ -14,6 +14,9 @@ const Environment = imports.ui.environment;
 
 function init(stage) {
     Environment.init();
+    let themeResource = Gio.Resource.load(global.datadir + '/gnome-shell-theme.gresource');
+    themeResource._register();
+
     let context = St.ThemeContext.get_for_stage(stage);
     let stylesheetPath = GLib.getenv("GNOME_SHELL_TESTSDIR") + "/testcommon/test.css";
     let theme = new St.Theme({ application_stylesheet: Gio.File.new_for_path(stylesheetPath) });


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