summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2018-08-07 13:57:33 +0200
committerFlorian Müllner <fmuellner@gnome.org>2018-08-10 20:39:10 +0200
commit1681591e9158248f6894292c66c8b49b0034e12e (patch)
tree318f3c5298d71b20e694e532b1b5e04ccfabe284
parentda5ab808857610b45592b051b7410e1f1c4eaa9d (diff)
downloadgjs-1681591e9158248f6894292c66c8b49b0034e12e.tar.gz
tests: Test property access on "foreign" objects
There's a difference between objects we create ourselves from JS code and objects we receive from introspected C code. Test that we still find all valid properties in that case, either from the object itself, a parent or an interface. The latter currently fails, a fix will follow. https://gitlab.gnome.org/GNOME/gjs/merge_requests/223
-rw-r--r--installed-tests/js/testEverythingBasic.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/installed-tests/js/testEverythingBasic.js b/installed-tests/js/testEverythingBasic.js
index 7ef970ad..970a9993 100644
--- a/installed-tests/js/testEverythingBasic.js
+++ b/installed-tests/js/testEverythingBasic.js
@@ -3,10 +3,12 @@ const WarnLib = imports.gi.WarnLib;
// We use Gio to have some objects that we know exist
imports.gi.versions.Gdk = '3.0';
+imports.gi.versions.Gtk = '3.0';
const Gdk = imports.gi.Gdk;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject;
+const Gtk = imports.gi.Gtk;
describe('Life, the Universe and Everything', function () {
it('includes booleans', function () {
@@ -422,6 +424,37 @@ describe('Life, the Universe and Everything', function () {
expect(o.int).toBe(42);
}).pend('https://gitlab.gnome.org/GNOME/gobject-introspection/issues/113');
+ describe('Object properties on GtkBuilder-constructed objects', function () {
+ let o1;
+ beforeAll(function () {
+ Gtk.init(null);
+ });
+
+ beforeEach(function () {
+ const ui = `
+ <interface>
+ <object class="GtkButton" id="button">
+ <property name="label">Click me</property>
+ </object>
+ </interface>`;
+
+ let builder = Gtk.Builder.new_from_string(ui, -1);
+ o1 = builder.get_object('button');
+ });
+
+ it('are found on the GObject itself', function () {
+ expect(o1.label).toBe('Click me');
+ });
+
+ it('are found on the GObject\'s parents', function () {
+ expect(o1.visible).toBeFalsy();
+ });
+
+ it('are found on the GObject\'s interfaces', function () {
+ expect(o1.action_name).toBeNull();
+ });
+ });
+
describe('Object-valued GProperty', function () {
let o1, t1, t2;
beforeEach(function () {