Commit f86701b1 authored by Simon Feltman's avatar Simon Feltman
Browse files

tests: Change GHashTable<string,GValue> marshaling test to use GValue

Add test to explicitly use a boxed GStrv GValue in addition to a
Python list sub-class.

https://bugzilla.gnome.org/show_bug.cgi?id=666636
parent 6ea41b60
...@@ -480,17 +480,15 @@ class TestEverything(unittest.TestCase): ...@@ -480,17 +480,15 @@ class TestEverything(unittest.TestCase):
self.assertEqual(Everything.test_ghash_nested_everything_return2(), {}) self.assertEqual(Everything.test_ghash_nested_everything_return2(), {})
def test_hash_in(self): def test_hash_in(self):
# specifying a simple string array for "strings" does not work due to
# https://bugzilla.gnome.org/show_bug.cgi?id=666636
# workaround by explicitly building a GStrv object
class GStrv(list):
__gtype__ = GObject.TYPE_STRV
expected = {'foo': 'bar', 'baz': 'bat', 'qux': 'quux'} expected = {'foo': 'bar', 'baz': 'bat', 'qux': 'quux'}
Everything.test_ghash_nothing_in(expected) Everything.test_ghash_nothing_in(expected)
Everything.test_ghash_nothing_in2(expected) Everything.test_ghash_nothing_in2(expected)
def test_hash_in_with_typed_strv(self):
class GStrv(list):
__gtype__ = GObject.TYPE_STRV
data = {'integer': 12, data = {'integer': 12,
'boolean': True, 'boolean': True,
'string': 'some text', 'string': 'some text',
...@@ -501,6 +499,17 @@ class TestEverything(unittest.TestCase): ...@@ -501,6 +499,17 @@ class TestEverything(unittest.TestCase):
Everything.test_ghash_gvalue_in(data) Everything.test_ghash_gvalue_in(data)
data = None data = None
def test_hash_in_with_gvalue_strv(self):
data = {'integer': 12,
'boolean': True,
'string': 'some text',
'strings': GObject.Value(GObject.TYPE_STRV, ['first', 'second', 'third']),
'flags': Everything.TestFlags.FLAG1 | Everything.TestFlags.FLAG3,
'enum': Everything.TestEnum.VALUE2,
}
Everything.test_ghash_gvalue_in(data)
data = None
def test_struct_gpointer(self): def test_struct_gpointer(self):
glist = GLib.List() glist = GLib.List()
raw = RawGList.from_wrapped(glist) raw = RawGList.from_wrapped(glist)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment