[vala/staging: 1/5] tests: Extend "GLib.Value (un-)boxing" test to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging: 1/5] tests: Extend "GLib.Value (un-)boxing" test to increase coverage
- Date: Tue, 10 Mar 2020 17:11:06 +0000 (UTC)
commit cf01f3ee80e5b1204805ff9f35db11fc4e885a52
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Mar 10 16:38:07 2020 +0100
tests: Extend "GLib.Value (un-)boxing" test to increase coverage
tests/structs/gvalue.vala | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
---
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 ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]