tests: Fix import error in calendar

The Calendar module requires C_ at import time, which is only
available after Environment.init() has been called.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/38
This commit is contained in:
Florian Müllner 2018-02-21 12:28:20 +01:00
parent 66c86109dd
commit 23d6c4dcc0

View File

@ -6,8 +6,6 @@ const Clutter = imports.gi.Clutter;
const Lang = imports.lang; const Lang = imports.lang;
const St = imports.gi.St; const St = imports.gi.St;
const Calendar = imports.ui.calendar;
function test() { function test() {
let stage = new Clutter.Stage({ width: 400, height: 400 }); let stage = new Clutter.Stage({ width: 400, height: 400 });
UI.init(stage); UI.init(stage);
@ -18,6 +16,8 @@ function test() {
style: 'padding: 10px; spacing: 10px; font: 15px sans-serif;' }); style: 'padding: 10px; spacing: 10px; font: 15px sans-serif;' });
stage.add_actor(vbox); stage.add_actor(vbox);
// Calendar can only be imported after Environment.init()
const Calendar = imports.ui.calendar;
let calendar = new Calendar.Calendar(); let calendar = new Calendar.Calendar();
vbox.add(calendar.actor, vbox.add(calendar.actor,
{ expand: true, { expand: true,