[gjs: 1/3] testFundamental: Ensure a fundamental can be converted to GValue in both ways
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 1/3] testFundamental: Ensure a fundamental can be converted to GValue in both ways
- Date: Thu, 8 Apr 2021 04:34:20 +0000 (UTC)
commit 5bf547b745da065f2db9b16ccc7d308c147968f1
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Wed Apr 7 22:35:25 2021 +0200
testFundamental: Ensure a fundamental can be converted to GValue in both ways
We did test if a fundamental could be converted into a gvalue, but we
did not test the other way around.
This can be easily done by using signal emissions so that we get this
conversion done, so do it
installed-tests/js/testFundamental.js | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/installed-tests/js/testFundamental.js b/installed-tests/js/testFundamental.js
index 8a61f5f7..19b638a8 100644
--- a/installed-tests/js/testFundamental.js
+++ b/installed-tests/js/testFundamental.js
@@ -1,11 +1,24 @@
// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
// SPDX-FileCopyrightText: 2013 Lionel Landwerlin <llandwerlin gmail com>
+// SPDX-FileCopyrightText: 2021 Marco Trevisan <marco trevisan canonical com>
const {GObject, Regress} = imports.gi;
+const TestObj = GObject.registerClass({
+ Signals: {
+ 'test-fundamental-value-funcs': {param_types: [Regress.TestFundamentalSubObject.$gtype]},
+ },
+}, class TestObj extends GObject.Object {});
+
describe('Fundamental type support', function () {
it('can marshal a subtype of a custom fundamental type into a GValue', function () {
const fund = new Regress.TestFundamentalSubObject('plop');
expect(() => GObject.strdup_value_contents(fund)).not.toThrow();
+
+ const obj = new TestObj();
+ const signalSpy = jasmine.createSpy('signalSpy');
+ obj.connect('test-fundamental-value-funcs', signalSpy);
+ obj.emit('test-fundamental-value-funcs', fund);
+ expect(signalSpy).toHaveBeenCalledWith(obj, fund);
});
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]