[gjs/wip/carlosg/arrays-in-signals: 2/2] testGIMarshalling: Add initial set of tests for arguments in signals
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/carlosg/arrays-in-signals: 2/2] testGIMarshalling: Add initial set of tests for arguments in signals
- Date: Wed, 3 Mar 2021 13:32:32 +0000 (UTC)
commit cf077cf4c9c219e05f2ef05bcec62dd2d0f6dcb5
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..03429486 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();
});
});
+
+describe('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(obj, 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);
+ });
+ }
+
+ 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]