[gnome-shell] tests: Don't use the default stage



commit 0d82ce521053b186c712784438b66d336f65a3e9
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Jun 24 15:02:46 2012 -0400

    tests: Don't use the default stage
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678737

 tests/interactive/background-size.js    |    7 ++-----
 tests/interactive/border-radius.js      |    6 ++----
 tests/interactive/border-width.js       |    6 ++----
 tests/interactive/borders.js            |    6 ++----
 tests/interactive/box-layout.js         |    4 ++--
 tests/interactive/box-shadows.js        |    6 ++----
 tests/interactive/calendar.js           |    6 ++----
 tests/interactive/css-fonts.js          |    4 ++--
 tests/interactive/entry.js              |    9 ++-------
 tests/interactive/icons.js              |    7 ++-----
 tests/interactive/inline-style.js       |    4 ++--
 tests/interactive/scroll-view-sizing.js |    6 ++----
 tests/interactive/scrolling.js          |    4 ++--
 tests/interactive/table.js              |    5 ++---
 tests/interactive/transitions.js        |    4 ++--
 tests/testcommon/ui.js                  |   11 ++++-------
 16 files changed, 34 insertions(+), 61 deletions(-)
---
diff --git a/tests/interactive/background-size.js b/tests/interactive/background-size.js
index e5e56f8..72112fa 100644
--- a/tests/interactive/background-size.js
+++ b/tests/interactive/background-size.js
@@ -6,11 +6,8 @@ const St = imports.gi.St;
 
 const UI = imports.testcommon.ui;
 
-UI.init();
-let stage = Clutter.Stage.get_default();
-stage.user_resizable = true;
-stage.width = 1024;
-stage.height = 768;
+let stage = new Clutter.Stage({ user_resizable: true, width: 1024, height: 768 });
+UI.init(stage);
 
 let vbox = new St.BoxLayout({ style: 'background: #ffee88;' });
 vbox.add_constraint(new Clutter.BindConstraint({ source: stage,
diff --git a/tests/interactive/border-radius.js b/tests/interactive/border-radius.js
index d3ab718..1cd3d04 100644
--- a/tests/interactive/border-radius.js
+++ b/tests/interactive/border-radius.js
@@ -5,10 +5,8 @@ const St = imports.gi.St;
 
 const UI = imports.testcommon.ui;
 
-UI.init();
-let stage = Clutter.Stage.get_default();
-stage.width = 640;
-stage.height = 480;
+let stage = new Clutter.Stage({ width: 640, height: 480 });
+UI.init(stage);
 
 let vbox = new St.BoxLayout({ width: stage.width,
                               height: stage.height,
diff --git a/tests/interactive/border-width.js b/tests/interactive/border-width.js
index 988166c..e575a2f 100644
--- a/tests/interactive/border-width.js
+++ b/tests/interactive/border-width.js
@@ -5,10 +5,8 @@ const St = imports.gi.St;
 
 const UI = imports.testcommon.ui;
 
-UI.init();
-let stage = Clutter.Stage.get_default();
-stage.width = 640;
-stage.height = 480;
+let stage = new Clutter.Stage({ width: 640, height: 480 });
+UI.init(stage);
 
 let vbox = new St.BoxLayout({ width: stage.width,
                               height: stage.height,
diff --git a/tests/interactive/borders.js b/tests/interactive/borders.js
index d5253d6..88825ed 100644
--- a/tests/interactive/borders.js
+++ b/tests/interactive/borders.js
@@ -5,10 +5,8 @@ const St = imports.gi.St;
 
 const UI = imports.testcommon.ui;
 
-UI.init();
-let stage = Clutter.Stage.get_default();
-stage.width = 640;
-stage.height = 480;
+let stage = new Clutter.Stage({ width: 640, height: 480 });
+UI.init(stage);
 
 let vbox = new St.BoxLayout({ width: stage.width,
                               height: stage.height,
diff --git a/tests/interactive/box-layout.js b/tests/interactive/box-layout.js
index 8d38826..9e9b211 100644
--- a/tests/interactive/box-layout.js
+++ b/tests/interactive/box-layout.js
@@ -5,8 +5,8 @@ const St = imports.gi.St;
 
 const UI = imports.testcommon.ui;
 
-UI.init();
-let stage = Clutter.Stage.get_default();
+let stage = new Clutter.Stage();
+UI.init(stage);
 
 let vbox = new St.BoxLayout({ vertical: true,
                               width: stage.width,
diff --git a/tests/interactive/box-shadows.js b/tests/interactive/box-shadows.js
index a1ae568..42ed685 100644
--- a/tests/interactive/box-shadows.js
+++ b/tests/interactive/box-shadows.js
@@ -5,10 +5,8 @@ const St = imports.gi.St;
 
 const UI = imports.testcommon.ui;
 
-UI.init();
-let stage = Clutter.Stage.get_default();
-stage.width = 640;
-stage.height = 480;
+let stage = new Clutter.Stage({ width: 640, height: 480 });
+UI.init(stage);
 
 let vbox = new St.BoxLayout({ width: stage.width,
                               height: stage.height,
diff --git a/tests/interactive/calendar.js b/tests/interactive/calendar.js
index 0f04199..a181aa8 100644
--- a/tests/interactive/calendar.js
+++ b/tests/interactive/calendar.js
@@ -7,10 +7,8 @@ const St = imports.gi.St;
 const Calendar = imports.ui.calendar;
 const UI = imports.testcommon.ui;
 
-UI.init();
-let stage = Clutter.Stage.get_default();
-stage.width = stage.height = 400;
-stage.show();
+let stage = new Clutter.Stage({ width: 400, height: 400 });
+UI.init(stage);
 
 let vbox = new St.BoxLayout({ vertical: true,
                               width: stage.width,
diff --git a/tests/interactive/css-fonts.js b/tests/interactive/css-fonts.js
index 6dcec50..d23396e 100644
--- a/tests/interactive/css-fonts.js
+++ b/tests/interactive/css-fonts.js
@@ -5,8 +5,8 @@ const St = imports.gi.St;
 
 const UI = imports.testcommon.ui;
 
-UI.init();
-let stage = Clutter.Stage.get_default();
+let stage = new Clutter.Stage();
+UI.init(stage);
 
 let b = new St.BoxLayout({ vertical: true,
                            width: stage.width,
diff --git a/tests/interactive/entry.js b/tests/interactive/entry.js
index ed4b5bd..852aa99 100644
--- a/tests/interactive/entry.js
+++ b/tests/interactive/entry.js
@@ -1,19 +1,14 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
 const Clutter = imports.gi.Clutter;
-const Gtk = imports.gi.Gtk;
 const Lang = imports.lang;
 const St = imports.gi.St;
 
 const Calendar = imports.ui.calendar;
 const UI = imports.testcommon.ui;
 
-Gtk.init(null, null);
-
-UI.init();
-let stage = Clutter.Stage.get_default();
-stage.width = stage.height = 400;
-stage.show();
+let stage = new Clutter.Stage({ width: 400, height: 400 });
+UI.init(stage);
 
 let vbox = new St.BoxLayout({ vertical: true,
                               width: stage.width,
diff --git a/tests/interactive/icons.js b/tests/interactive/icons.js
index 25d1dfc..f6b8d4a 100644
--- a/tests/interactive/icons.js
+++ b/tests/interactive/icons.js
@@ -5,11 +5,8 @@ const St = imports.gi.St;
 
 const UI = imports.testcommon.ui;
 
-UI.init();
-let stage = Clutter.Stage.get_default();
-
-stage.width = 400;
-stage.height = 700;
+let stage = new Clutter.Stage();
+UI.init(stage);
 
 let b = new St.BoxLayout({ vertical: true,
                            width: stage.width,
diff --git a/tests/interactive/inline-style.js b/tests/interactive/inline-style.js
index c9cf9c7..e8e533a 100644
--- a/tests/interactive/inline-style.js
+++ b/tests/interactive/inline-style.js
@@ -5,8 +5,8 @@ const St = imports.gi.St;
 
 const UI = imports.testcommon.ui;
 
-UI.init();
-let stage = Clutter.Stage.get_default();
+let stage = new Clutter.Stage();
+UI.init(stage);
 
 let vbox = new St.BoxLayout({ vertical: true,
                               width: stage.width,
diff --git a/tests/interactive/scroll-view-sizing.js b/tests/interactive/scroll-view-sizing.js
index 1f795b7..7ccd6d8 100644
--- a/tests/interactive/scroll-view-sizing.js
+++ b/tests/interactive/scroll-view-sizing.js
@@ -251,10 +251,8 @@ SizingIllustrator.prototype = {
 
 /****************************************************************************/
 
-UI.init();
-let stage = Clutter.Stage.get_default();
-stage.width = 600;
-stage.height = 600;
+let stage = new Clutter.Stage({ width: 600, height: 600 });
+UI.init(stage);
 
 let mainBox = new St.BoxLayout({ width: stage.width,
 				 height: stage.height,
diff --git a/tests/interactive/scrolling.js b/tests/interactive/scrolling.js
index e03a4ed..3050f57 100644
--- a/tests/interactive/scrolling.js
+++ b/tests/interactive/scrolling.js
@@ -6,8 +6,8 @@ const St = imports.gi.St;
 
 const UI = imports.testcommon.ui;
 
-UI.init();
-let stage = Clutter.Stage.get_default();
+let stage = new Clutter.Stage();
+UI.init(stage);
 
 let vbox = new St.BoxLayout({ vertical: true,
                               width: stage.width,
diff --git a/tests/interactive/table.js b/tests/interactive/table.js
index 31771db..b0ba369 100644
--- a/tests/interactive/table.js
+++ b/tests/interactive/table.js
@@ -5,9 +5,8 @@ const St = imports.gi.St;
 
 const UI = imports.testcommon.ui;
 
-UI.init();
-let stage = Clutter.Stage.get_default();
-stage.width = stage.height = 600;
+let stage = new Clutter.Stage({ width: 600, height: 600 });
+UI.init(stage);
 
 let vbox = new St.BoxLayout({ vertical: true,
                               width: stage.width,
diff --git a/tests/interactive/transitions.js b/tests/interactive/transitions.js
index 0409245..ec6fc81 100644
--- a/tests/interactive/transitions.js
+++ b/tests/interactive/transitions.js
@@ -5,8 +5,8 @@ const St = imports.gi.St;
 
 const UI = imports.testcommon.ui;
 
-UI.init();
-let stage = Clutter.Stage.get_default();
+let stage = new Clutter.Stage();
+UI.init(stage);
 
 let hbox = new St.BoxLayout({ name: 'transition-container',
                               reactive: true,
diff --git a/tests/testcommon/ui.js b/tests/testcommon/ui.js
index 56a8aec..bc88db8 100644
--- a/tests/testcommon/ui.js
+++ b/tests/testcommon/ui.js
@@ -3,16 +3,13 @@
 const Clutter = imports.gi.Clutter;
 const GLib = imports.gi.GLib;
 const St = imports.gi.St;
-const Shell = imports.gi.Shell;
 
 const Environment = imports.ui.environment;
 
-function init() {
+function init(stage) {
     Environment.init();
-
-    let stage = Clutter.Stage.get_default();
-    let context = St.ThemeContext.get_for_stage (stage);
+    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: stylesheetPath });
-    context.set_theme (theme);
+    let theme = new St.Theme({ application_stylesheet: stylesheetPath });
+    context.set_theme(theme);
 }



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