[gjs: 4/6] tests: Add tests for GObject-valued properties
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 4/6] tests: Add tests for GObject-valued properties
- Date: Sat, 3 Feb 2018 00:09:02 +0000 (UTC)
commit 12a9091ba8f194735fb1c8f3041797c5efd46f02
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Tue Dec 18 21:02:46 2012 +0100
tests: Add tests for GObject-valued properties
This was left over from an old patch of Giovanni's that I (Philip)
rebased.
installed-tests/js/testEverythingBasic.js | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
---
diff --git a/installed-tests/js/testEverythingBasic.js b/installed-tests/js/testEverythingBasic.js
index 98e4f453..d1663f6d 100644
--- a/installed-tests/js/testEverythingBasic.js
+++ b/installed-tests/js/testEverythingBasic.js
@@ -416,6 +416,35 @@ describe('Life, the Universe and Everything', function () {
expect(Regress.TestEnum.param(Regress.TestEnum.VALUE4)).toEqual('value4');
});
+ describe('Object-valued GProperty', function () {
+ let o1, t1, t2;
+ beforeEach(function () {
+ o1 = new GObject.Object();
+ t1 = new Regress.TestObj({bare: o1});
+ t2 = new Regress.TestSubObj();
+ t2.bare = o1;
+ });
+
+ it('marshals correctly in the getter', function () {
+ expect(t1.bare).toBe(o1);
+ });
+
+ it('marshals correctly when inherited', function () {
+ expect(t2.bare).toBe(o1);
+ });
+
+ it('marshals into setter function', function () {
+ let o2 = new GObject.Object();
+ t2.set_bare(o2);
+ expect(t2.bare).toBe(o2);
+ });
+
+ it('marshals null', function () {
+ t2.unset_bare();
+ expect(t2.bare).toBeNull();
+ });
+ });
+
describe('Signal connection', function () {
let o;
beforeEach(function () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]