summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2020-03-10 16:38:07 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2020-03-10 18:10:01 +0100
commitcf01f3ee80e5b1204805ff9f35db11fc4e885a52 (patch)
treedb67726c0af81641ea91eedd7b2a1315e5f16e32
parentfc2536f783bc15922f87d6dfb9dc65dc6276885c (diff)
downloadvala-cf01f3ee80e5b1204805ff9f35db11fc4e885a52.tar.gz
tests: Extend "GLib.Value (un-)boxing" test to increase coverage
-rw-r--r--tests/structs/gvalue.vala38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/structs/gvalue.vala b/tests/structs/gvalue.vala
index 927db0304..5283fc818 100644
--- a/tests/structs/gvalue.vala
+++ b/tests/structs/gvalue.vala
@@ -48,6 +48,41 @@ void test_nullable_value_array () {
}
}
+class Bar {
+ public int i;
+}
+
+interface Manam : Object {
+}
+
+class Foo : Object, Manam {
+ public int i;
+}
+
+void test_gtype () {
+ var o = new Bar ();
+ o.i = 42;
+ Value vo = o;
+ Bar o2 = (Bar) vo;
+ assert (o2.i == 42);
+}
+
+void test_gobject () {
+ var o = new Foo ();
+ o.i = 42;
+ Value vo = o;
+ Foo o2 = (Foo) vo;
+ assert (o2.i == 42);
+}
+
+void test_ginterface () {
+ Manam i = new Foo ();
+ ((Foo) i).i = 42;
+ Value vi = i;
+ Manam i2 = (Manam) vi;
+ assert (((Foo) i2).i == 42);
+}
+
void take_value (Value v) {
}
@@ -78,6 +113,9 @@ void main () {
test_value_array ();
test_nullable_value ();
test_nullable_value_array ();
+ test_gtype ();
+ test_gobject ();
+ test_ginterface ();
take_value (make_bool ());
test_try_cast_value ();
}