summaryrefslogtreecommitdiff
path: root/installed-tests
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2022-02-11 21:01:06 -0800
committerPhilip Chimento <philip.chimento@gmail.com>2022-02-11 21:01:06 -0800
commitc2065cc3095fd6ee4dbf03a3430ae7f70037e7a7 (patch)
tree9431b996dbad151108369af11f52aa8a5f6237b2 /installed-tests
parent0ce6a00af87e73646586899b658f41880c92b908 (diff)
downloadgjs-c2065cc3095fd6ee4dbf03a3430ae7f70037e7a7.tar.gz
tests: Add more GValue tests
Diffstat (limited to 'installed-tests')
-rw-r--r--installed-tests/js/testGIMarshalling.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/installed-tests/js/testGIMarshalling.js b/installed-tests/js/testGIMarshalling.js
index 11fbdfe8..02c03f0f 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.