[gjs: 1/2] tests: Add test for child_set_property() with null values
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 1/2] tests: Add test for child_set_property() with null values
- Date: Tue, 13 Aug 2019 20:41:12 +0000 (UTC)
commit e16a28807f6d92daeced1efce77fb5de73f821b4
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Aug 13 00:50:38 2019 +0200
tests: Add test for child_set_property() with null values
We have a custom override for this, as it's a difficult problem:
null is too generic for meaningful type information (unset string,
object, boxed, ...?), but the method will bail out if we pass a
GValue of the wrong type.
It is certainly worth a test case.
https://gitlab.gnome.org/GNOME/gjs/issues/99
installed-tests/js/testGtk.js | 11 +++++++++++
1 file changed, 11 insertions(+)
---
diff --git a/installed-tests/js/testGtk.js b/installed-tests/js/testGtk.js
index 6cae626b..97038e38 100755
--- a/installed-tests/js/testGtk.js
+++ b/installed-tests/js/testGtk.js
@@ -204,4 +204,15 @@ describe('Gtk overrides', function () {
*/
expect(() => Gtk.Clipboard.get(null)).toThrowError(/null/);
});
+
+ it('uses the correct GType for null child properties', function () {
+ let s = new Gtk.Stack();
+ let p = new Gtk.Box();
+
+ s.add_named(p, 'foo');
+ expect(s.get_child_by_name('foo')).toBe(p);
+
+ s.child_set_property(p, 'name', null);
+ expect(s.get_child_by_name('foo')).toBeNull();
+ });
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]