summaryrefslogtreecommitdiff
path: root/valadoc
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2017-11-21 09:10:09 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2017-11-29 17:05:40 +0100
commit78bc143508e64a622ab509059d4a8f33490d4ef9 (patch)
tree5796163454638e53e831c24a5729f0b2a37d811a /valadoc
parent7c85ebe3c0ba2dd78ceceffc9947700e376e7459 (diff)
downloadvala-78bc143508e64a622ab509059d4a8f33490d4ef9.tar.gz
valadoc: Acknowledge possible properties in structs
https://bugzilla.gnome.org/show_bug.cgi?id=784705
Diffstat (limited to 'valadoc')
-rw-r--r--valadoc/tests/drivers/api-test.data.vapi3
-rw-r--r--valadoc/tests/drivers/generic-api-test.vala159
2 files changed, 161 insertions, 1 deletions
diff --git a/valadoc/tests/drivers/api-test.data.vapi b/valadoc/tests/drivers/api-test.data.vapi
index 4a3236502..f0b27ac5b 100644
--- a/valadoc/tests/drivers/api-test.data.vapi
+++ b/valadoc/tests/drivers/api-test.data.vapi
@@ -85,6 +85,9 @@ public struct TestStructGlobal {
public void method ();
public static void static_method ();
public const int constant;
+ public int property1 { get; set; }
+ public int property2 { get; }
+ public int property3 { owned get; set; }
}
diff --git a/valadoc/tests/drivers/generic-api-test.vala b/valadoc/tests/drivers/generic-api-test.vala
index 759120543..48c54b537 100644
--- a/valadoc/tests/drivers/generic-api-test.vala
+++ b/valadoc/tests/drivers/generic-api-test.vala
@@ -1386,6 +1386,164 @@ public static void test_struct_global (Api.Struct? stru, Api.Package pkg, Api.Na
assert (field2 == true);
+ Vala.List<Api.Node> properties = stru.get_children_by_type (Api.NodeType.PROPERTY, false);
+ bool prop1 = false;
+ bool prop2 = false;
+ bool prop3 = false;
+
+ foreach (Api.Node node in properties) {
+ Api.Property property = node as Api.Property;
+ assert (property != null);
+
+ switch (property.name) {
+ case "property1":
+ assert (property.get_cname () == "property1");
+ assert (property.property_type != null);
+ assert (property.is_virtual == false);
+ assert (property.is_abstract == false);
+ assert (property.is_override == false);
+ assert (property.is_dbus_visible == true);
+ assert (property.setter != null);
+ assert (property.getter != null);
+ assert (property.base_property == null);
+ // (.Symbol check)
+ assert (property.is_deprecated == false);
+ assert (property.accessibility == Api.SymbolAccessibility.PUBLIC);
+ // (.Node)
+ assert (property.get_full_name () == "TestStructGlobal.property1");
+ assert (property.get_filename () == "api-test.data.vapi");
+ assert (property.nspace == global_ns);
+ assert (property.package == pkg);
+
+
+ assert (property.getter.get_cname () == "test_struct_global_get_property1");
+ assert (property.getter.is_construct == false);
+ assert (property.getter.is_set == false);
+ assert (property.getter.is_get == true);
+ assert (property.getter.is_owned == false);
+ // (.Symbol check)
+ assert (property.getter.is_deprecated == false);
+ assert (property.getter.accessibility == Api.SymbolAccessibility.PUBLIC);
+ // (.Node)
+ //assert (property.getter.get_full_name () == "TestInterfaceGlobal.property2");
+ assert (property.getter.get_filename () == "api-test.data.vapi");
+ assert (property.getter.nspace == global_ns);
+ assert (property.getter.package == pkg);
+
+
+ assert (property.setter.get_cname () == "test_struct_global_set_property1");
+ assert (property.setter.is_construct == false);
+ assert (property.setter.is_get == false);
+ assert (property.setter.is_set == true);
+ assert (property.setter.is_owned == false);
+ // (.Symbol check)
+ assert (property.setter.is_deprecated == false);
+ assert (property.setter.accessibility == Api.SymbolAccessibility.PUBLIC);
+ // (.Node)
+ //assert (property.getter.get_full_name () == "TestInterfaceGlobal.property2");
+ assert (property.setter.get_filename () == "api-test.data.vapi");
+ assert (property.setter.nspace == global_ns);
+ assert (property.setter.package == pkg);
+
+ prop1 = true;
+ break;
+
+ case "property2":
+ assert (property.get_cname () == "property2");
+ assert (property.property_type != null);
+ assert (property.is_virtual == false);
+ assert (property.is_abstract == false);
+ assert (property.is_override == false);
+ assert (property.is_dbus_visible == true);
+ assert (property.setter == null);
+ assert (property.getter != null);
+ assert (property.base_property == null);
+ // (.Symbol check)
+ assert (property.is_deprecated == false);
+ assert (property.accessibility == Api.SymbolAccessibility.PUBLIC);
+ // (.Node)
+ assert (property.get_full_name () == "TestStructGlobal.property2");
+ assert (property.get_filename () == "api-test.data.vapi");
+ assert (property.nspace == global_ns);
+ assert (property.package == pkg);
+
+ assert (property.getter.get_cname () == "test_struct_global_get_property2");
+ assert (property.getter.is_construct == false);
+ assert (property.getter.is_set == false);
+ assert (property.getter.is_get == true);
+ assert (property.getter.is_owned == false);
+ // (.Symbol check)
+ assert (property.getter.is_deprecated == false);
+ assert (property.getter.accessibility == Api.SymbolAccessibility.PUBLIC);
+ // (.Node)
+ //assert (property.getter.get_full_name () == "TestInterfaceGlobal.property2");
+ assert (property.getter.get_filename () == "api-test.data.vapi");
+ assert (property.getter.nspace == global_ns);
+ assert (property.getter.package == pkg);
+
+ prop2 = true;
+ break;
+
+ case "property3":
+ assert (property.get_cname () == "property3");
+ assert (property.property_type != null);
+ assert (property.is_virtual == false);
+ assert (property.is_abstract == false);
+ assert (property.is_override == false);
+ assert (property.is_dbus_visible == true);
+ assert (property.setter != null);
+ assert (property.getter != null);
+ assert (property.base_property == null);
+ // (.Symbol check)
+ assert (property.is_deprecated == false);
+ assert (property.accessibility == Api.SymbolAccessibility.PUBLIC);
+ // (.Node)
+ assert (property.get_full_name () == "TestStructGlobal.property3");
+ assert (property.get_filename () == "api-test.data.vapi");
+ assert (property.nspace == global_ns);
+ assert (property.package == pkg);
+
+ assert (property.getter.get_cname () == "test_struct_global_get_property3");
+ assert (property.getter.is_construct == false);
+ assert (property.getter.is_set == false);
+ assert (property.getter.is_get == true);
+ assert (property.getter.is_owned == true);
+ // (.Symbol check)
+ assert (property.getter.is_deprecated == false);
+ assert (property.getter.accessibility == Api.SymbolAccessibility.PUBLIC);
+ // (.Node)
+ //assert (property.getter.get_full_name () == "TestInterfaceGlobal.property3");
+ assert (property.getter.get_filename () == "api-test.data.vapi");
+ assert (property.getter.nspace == global_ns);
+ assert (property.getter.package == pkg);
+
+
+ assert (property.setter.get_cname () == "test_struct_global_set_property3");
+ assert (property.setter.is_construct == false);
+ assert (property.setter.is_get == false);
+ assert (property.setter.is_set == true);
+ assert (property.setter.is_owned == false);
+ // (.Symbol check)
+ assert (property.setter.is_deprecated == false);
+ assert (property.setter.accessibility == Api.SymbolAccessibility.PUBLIC);
+ // (.Node)
+ //assert (property.getter.get_full_name () == "TestInterfaceGlobal.property3");
+ assert (property.setter.get_filename () == "api-test.data.vapi");
+ assert (property.setter.nspace == global_ns);
+ assert (property.setter.package == pkg);
+
+
+ prop3 = true;
+ break;
+
+ default:
+ assert_not_reached ();
+ }
+ }
+ assert (prop1);
+ assert (prop2);
+ assert (prop3);
+
Api.NodeType[] forbidden = {
Api.NodeType.CLASS,
@@ -1398,7 +1556,6 @@ public static void test_struct_global (Api.Struct? stru, Api.Package pkg, Api.Na
Api.NodeType.INTERFACE,
Api.NodeType.NAMESPACE,
Api.NodeType.PACKAGE,
- Api.NodeType.PROPERTY,
Api.NodeType.PROPERTY_ACCESSOR,
Api.NodeType.SIGNAL,
Api.NodeType.STRUCT,