[gjs/fix-gtk4: 1/2] tests: Adapt to GTK4 API changes
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/fix-gtk4: 1/2] tests: Adapt to GTK4 API changes
- Date: Mon, 1 Jun 2020 20:54:20 +0000 (UTC)
commit bbaca3dba54955379dc3364e7a533e955b56110c
Author: Philip Chimento <philip chimento gmail com>
Date: Mon Jun 1 13:48:21 2020 -0700
tests: Adapt to GTK4 API changes
The monthly CI image build included a newer version of GTK4 which had
some API changes. The one we need to contend with is the removal of
gtk_container_add() in favour of widget-specific functions such as
gtk_window_set_child().
The destroy vfunc was also removed so it seems that one avenue to get
a JS callback called during garbage collection no longer exists in GTK4,
so we can remove that test.
installed-tests/js/testGtk4.js | 25 ++-----------------------
1 file changed, 2 insertions(+), 23 deletions(-)
---
diff --git a/installed-tests/js/testGtk4.js b/installed-tests/js/testGtk4.js
index a9cff2ad..8aac724a 100644
--- a/installed-tests/js/testGtk4.js
+++ b/installed-tests/js/testGtk4.js
@@ -1,8 +1,7 @@
imports.gi.versions.Gtk = '4.0';
const ByteArray = imports.byteArray;
-const {GLib, Gio, GObject, Gtk} = imports.gi;
-const System = imports.system;
+const {Gio, GObject, Gtk} = imports.gi;
// This is ugly here, but usually it would be in a resource
function createTemplate(className) {
@@ -118,7 +117,7 @@ function validateTemplate(description, ClassName, pending = false) {
content = new ClassName();
content.label_child.emit('copy-clipboard');
content.label_child2.emit('copy-clipboard');
- win.add(content);
+ win.set_child(content);
});
it('sets up internal and public template children', function () {
@@ -167,26 +166,6 @@ describe('Gtk overrides', function () {
expect(Gtk.Widget.get_css_name.call(MyComplexGtkSubclass)).toEqual('complex-subclass');
});
- it('avoid crashing when GTK vfuncs are called in garbage collection', function () {
- GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_CRITICAL,
- '*during garbage collection*');
- GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_CRITICAL,
- '*destroy*');
-
- let BadLabel = GObject.registerClass(class BadLabel extends Gtk.Label {
- vfunc_destroy() {}
- });
-
- let w = new Gtk.Window();
- w.add(new BadLabel());
-
- w.destroy();
- System.gc();
-
- GLib.test_assert_expected_messages_internal('Gjs', 'testGtk4.js', 0,
- 'Gtk overrides avoid crashing and print a stack trace');
- });
-
it('can create a Gtk.TreeIter with accessible stamp field', function () {
const iter = new Gtk.TreeIter();
iter.stamp = 42;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]