[gjs/fix-gtk4: 1/2] tests: Adapt to GTK4 API changes



commit b23665dcf06160456ddd4fdee075d9bb2caa2fdf
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 | 22 +---------------------
 1 file changed, 1 insertion(+), 21 deletions(-)
---
diff --git a/installed-tests/js/testGtk4.js b/installed-tests/js/testGtk4.js
index a9cff2ad..efb638d3 100644
--- a/installed-tests/js/testGtk4.js
+++ b/installed-tests/js/testGtk4.js
@@ -118,7 +118,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 +167,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]