[gjs: 1/2] installed-tests: skip some tests if GTK can't be initialised
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 1/2] installed-tests: skip some tests if GTK can't be initialised
- Date: Tue, 21 Apr 2020 18:40:05 +0000 (UTC)
commit 9c524547d69786ba8fe6d2227617950028ba41b9
Author: Ross Burton <ross burton intel com>
Date: Mon Apr 20 16:40:02 2020 +0100
installed-tests: skip some tests if GTK can't be initialised
A few of the tests need GTK to work, but GTK won't initialise if a X or
Wayland environment isn't found. This isn't uncommon in build
infrastructures, so if GTK initialisation fails skip the test instead of
failing.
installed-tests/js/testCairo.js | 11 ++++++-----
installed-tests/js/testIntrospection.js | 8 ++++++++
2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/installed-tests/js/testCairo.js b/installed-tests/js/testCairo.js
index 08686960..78f0efbf 100644
--- a/installed-tests/js/testCairo.js
+++ b/installed-tests/js/testCairo.js
@@ -2,17 +2,13 @@ imports.gi.versions.Gdk = '3.0';
imports.gi.versions.Gtk = '3.0';
const Cairo = imports.cairo;
-const {Gdk, GIMarshallingTests, Gtk, Regress} = imports.gi;
+const {Gdk, GIMarshallingTests, GLib, Gtk, Regress} = imports.gi;
function _ts(obj) {
return obj.toString().slice(8, -1);
}
describe('Cairo', function () {
- beforeAll(function () {
- Gtk.init(null);
- });
-
let cr, surface;
beforeEach(function () {
surface = new Cairo.ImageSurface(Cairo.Format.ARGB32, 10, 10);
@@ -166,6 +162,11 @@ describe('Cairo', function () {
});
it('has methods when created from a C function', function () {
+ if (GLib.getenv('ENABLE_GTK') !== 'yes') {
+ pending('GTK disabled');
+ return;
+ }
+ Gtk.init(null);
let win = new Gtk.OffscreenWindow();
let da = new Gtk.DrawingArea();
win.add(da);
diff --git a/installed-tests/js/testIntrospection.js b/installed-tests/js/testIntrospection.js
index d50f1566..44c504ac 100644
--- a/installed-tests/js/testIntrospection.js
+++ b/installed-tests/js/testIntrospection.js
@@ -31,6 +31,10 @@ describe('Unsafe integer marshalling', function () {
describe('Marshalling empty flat arrays of structs', function () {
let widget;
beforeAll(function () {
+ if (GLib.getenv('ENABLE_GTK') !== 'yes') {
+ pending('GTK disabled');
+ return;
+ }
Gtk.init(null);
});
@@ -73,6 +77,10 @@ describe('GError domains', function () {
describe('Object properties on GtkBuilder-constructed objects', function () {
let o1;
beforeAll(function () {
+ if (GLib.getenv('ENABLE_GTK') !== 'yes') {
+ pending('GTK disabled');
+ return;
+ }
Gtk.init(null);
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]