summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Bocklage-Ryannel <juergen@ryannel.org>2018-03-07 18:59:32 +0100
committerJuergen Bocklage-Ryannel <juergen@ryannel.org>2018-03-07 18:59:32 +0100
commit6f3f1ec8b1121c0c3bfb812377a2d6adcd55498d (patch)
tree029eb818da1f016665c65481cfb48681e62343dc
parent7a06dde5e8c28173b8509786d11f1fae5e7a3506 (diff)
downloadqtivi-qface-6f3f1ec8b1121c0c3bfb812377a2d6adcd55498d.tar.gz
Added test for structs with lists and maps
-rw-r--r--tests/in/com.pelagicore.ivi.tuner.qface4
-rw-r--r--tests/test_parser.py36
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/in/com.pelagicore.ivi.tuner.qface b/tests/in/com.pelagicore.ivi.tuner.qface
index 1c27fdf..5d5b7ad 100644
--- a/tests/in/com.pelagicore.ivi.tuner.qface
+++ b/tests/in/com.pelagicore.ivi.tuner.qface
@@ -75,6 +75,10 @@ struct Station {
int stationId;
/** member name */
string name;
+ list<int> primitiveList;
+ list<Station> complexList;
+ map<int> primitiveMap;
+ map<Station> complexMap;
}
diff --git a/tests/test_parser.py b/tests/test_parser.py
index 4361004..61d680c 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -157,6 +157,24 @@ def test_list():
assert property.type.nested.name == 'Station'
+def test_struct_list():
+ system = load_tuner()
+ struct = system.lookup('com.pelagicore.ivi.tuner.Station')
+ field = struct._fieldMap['primitiveList']
+ assert type(field) is domain.Field
+ assert field.type.name == 'list'
+ assert field.type.is_list is True
+ assert field.type.nested.is_primitive
+ assert field.type.nested.name == 'int'
+
+ field = struct._fieldMap['complexList']
+ assert type(field) is domain.Field
+ assert field.type.name == 'list'
+ assert field.type.is_list is True
+ assert field.type.nested.is_complex
+ assert field.type.nested.name == 'Station'
+
+
def test_map():
system = load_tuner()
interface = system.lookup('com.pelagicore.ivi.tuner.Tuner')
@@ -175,6 +193,24 @@ def test_map():
assert property.type.nested.name == 'Station'
+def test_struct_map():
+ system = load_tuner()
+ struct = system.lookup('com.pelagicore.ivi.tuner.Station')
+ field = struct._fieldMap['primitiveMap']
+ assert type(field) is domain.Field
+ assert field.type.name == 'map'
+ assert field.type.is_map is True
+ assert field.type.nested.is_primitive
+ assert field.type.nested.name == 'int'
+
+ field = struct._fieldMap['complexMap']
+ assert type(field) is domain.Field
+ assert field.type.name == 'map'
+ assert field.type.is_map is True
+ assert field.type.nested.is_complex
+ assert field.type.nested.name == 'Station'
+
+
def test_model():
system = load_tuner()
interface = system.lookup('com.pelagicore.ivi.tuner.Tuner')