[gjs/wip/carlosg/arrays-in-signals: 41/41] testGIMarshalling: Add initial set of tests for arguments in signals




commit 8b85c47512427d180cc2ac990c1d759f06076075
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Mar 3 13:59:57 2021 +0100

    testGIMarshalling: Add initial set of tests for arguments in signals
    
    Test so far boxed arrays containing simple and complex data, as arrays
    were broken till recently.

 installed-tests/js/testGIMarshalling.js | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
---
diff --git a/installed-tests/js/testGIMarshalling.js b/installed-tests/js/testGIMarshalling.js
index 84092aa4..a669f279 100644
--- a/installed-tests/js/testGIMarshalling.js
+++ b/installed-tests/js/testGIMarshalling.js
@@ -1751,3 +1751,34 @@ describe('GObject properties', function () {
         expect(() => (obj.some_readonly = 35)).toThrow();
     });
 });
+
+xdescribe('GObject signals', function () {
+    let obj;
+    beforeEach(function () {
+        obj = new GIMarshallingTests.SignalsObject();
+    });
+
+    function testSignalEmission(type, value, skip = false) {
+        it(`checks emission of signal with ${type} argument`, function () {
+            if (skip)
+                pending(skip);
+
+            function signalCallback(o, arg) {
+                expect(value).toEqual(arg);
+            }
+
+            const signalName = `some_${type}`;
+            const funcName = `emit_${type}`.replace(/-/g, '_');
+            const signalId = obj.connect(signalName, signalCallback);
+            obj[funcName]();
+            obj.disconnect(signalId);
+        }).pend('https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/259');
+    }
+
+    testSignalEmission('boxed-gptrarray-utf8', ['0', '1', '2']);
+    testSignalEmission('boxed-gptrarray-boxed-struct', [
+        new GIMarshallingTests.BoxedStruct({long_: 42}),
+        new GIMarshallingTests.BoxedStruct({long_: 43}),
+        new GIMarshallingTests.BoxedStruct({long_: 44}),
+    ]);
+});


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]