[gjs/ewlsh/gvalue-arguments: 86/86] tests: Add more GValue tests




commit c2065cc3095fd6ee4dbf03a3430ae7f70037e7a7
Author: Philip Chimento <philip chimento gmail com>
Date:   Fri Feb 11 21:01:06 2022 -0800

    tests: Add more GValue tests

 installed-tests/js/testGIMarshalling.js | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
---
diff --git a/installed-tests/js/testGIMarshalling.js b/installed-tests/js/testGIMarshalling.js
index 11fbdfe88..02c03f0f9 100644
--- a/installed-tests/js/testGIMarshalling.js
+++ b/installed-tests/js/testGIMarshalling.js
@@ -862,6 +862,11 @@ describe('GValue', function () {
             .not.toThrow();
     });
 
+    it('array of uninitialized boxed GValues', function () {
+        const values = Array(3).fill().map(() => new GObject.Value());
+        expect(() => GIMarshallingTests.gvalue_flat_array(values)).toThrow();
+    });
+
     it('array can be passed as an out argument and unpacked', function () {
         expect(GIMarshallingTests.return_gvalue_flat_array())
             .toEqual([42, '42', true]);
@@ -935,6 +940,22 @@ describe('GValue', function () {
             .not.toThrow();
     });
 
+    it('can deal with a GValue packed in a GValue', function () {
+        const innerValue = new GObject.Value();
+        innerValue.init(Number);
+        innerValue.set_double(42);
+
+        expect(() => GIMarshallingTests.gvalue_in_with_type(innerValue, Number))
+            .not.toThrow();
+
+        const value = new GObject.Value();
+        value.init(GObject.Value);
+        value.set_boxed(innerValue);
+
+        expect(() => GIMarshallingTests.gvalue_in_with_type(value, GObject.Value))
+            .not.toThrow();
+    });
+
     // See testCairo.js for a test of GIMarshallingTests.gvalue_in_with_type()
     // on Cairo foreign structs, since it will be skipped if compiling without
     // Cairo support.


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