Commit 1681591e authored by Florian Müllner's avatar Florian Müllner

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.

GNOME/gjs!223
parent da5ab808
......@@ -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 () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment