[gjs: 13/14] testGObjectValue: Add tests setting an instance using a fundamental type
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 13/14] testGObjectValue: Add tests setting an instance using a fundamental type
- Date: Sat, 17 Apr 2021 04:36:48 +0000 (UTC)
commit fcf0bf473d70c31d093da524e3c37a7786251f2b
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Fri Apr 9 07:48:39 2021 +0200
testGObjectValue: Add tests setting an instance using a fundamental type
Unfortunately we still need to skip some tests as calling functions
with pure gpointer parameters may not work as expected.
installed-tests/js/testGObjectValue.js | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/installed-tests/js/testGObjectValue.js b/installed-tests/js/testGObjectValue.js
index fc5147c4..461c1ba2 100644
--- a/installed-tests/js/testGObjectValue.js
+++ b/installed-tests/js/testGObjectValue.js
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
// SPDX-FileCopyrightText: 2020 Marco Trevisan <marco trevisan canonical com>
-const {GLib, GObject, GIMarshallingTests} = imports.gi;
+const {GLib, GObject, GIMarshallingTests, Regress} = imports.gi;
const SIGNED_TYPES = ['schar', 'int', 'int64', 'long'];
const UNSIGNED_TYPES = ['char', 'uchar', 'uint', 'uint64', 'ulong'];
const FLOATING_TYPES = ['double', 'float'];
const NUMERIC_TYPES = [...SIGNED_TYPES, ...UNSIGNED_TYPES, ...FLOATING_TYPES];
const SPECIFIC_TYPES = ['gtype', 'boolean', 'string', 'param', 'variant', 'boxed', 'gvalue'];
-const INSTANCED_TYPES = ['object'];
+const INSTANCED_TYPES = ['object', 'instance'];
const ALL_TYPES = [...NUMERIC_TYPES, ...SPECIFIC_TYPES, ...INSTANCED_TYPES];
describe('GObject value (GValue)', function () {
@@ -44,6 +44,7 @@ describe('GObject value (GValue)', function () {
(e !== 'object' || !wasCreatingObject) &&
e !== 'boxed' &&
e !== 'gtype' &&
+ e !== 'instance' &&
e !== 'param' &&
// Include string when gobject-introspection!268 is merged
e !== 'string' &&
@@ -73,6 +74,9 @@ describe('GObject value (GValue)', function () {
setContent(value, valueType, getDefaultContentByType(valueType));
return value;
}
+ if (type === 'instance')
+ return new Regress.TestFundamentalSubObject(getDefaultContentByType('string'));
+
throw new Error(`No default content set for type ${type}`);
}
@@ -81,7 +85,7 @@ describe('GObject value (GValue)', function () {
if (type === 'schar')
return GObject.TYPE_CHAR;
- if (type === 'boxed' || type === 'gvalue')
+ if (type === 'boxed' || type === 'gvalue' || type === 'instance')
return getDefaultContentByType(type).constructor.$gtype;
return GObject[`TYPE_${type.toUpperCase()}`];
@@ -91,6 +95,11 @@ describe('GObject value (GValue)', function () {
if (type === 'gvalue')
type = 'boxed';
+ if (type === 'instance') {
+ pending('https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/268');
+ return GIMarshallingTests.gvalue_round_trip(gvalue);
+ }
+
return gvalue[`get_${type}`]();
}
@@ -98,6 +107,9 @@ describe('GObject value (GValue)', function () {
if (type === 'gvalue')
type = 'boxed';
+ if (type === 'instance')
+ pending('https://gitlab.gnome.org/GNOME/gjs/-/issues/402');
+
return gvalue[`set_${type}`](content);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]