[vala/tintou/dbus-signals-extend-coverage] dbus: increase signal handling coverage
- From: Corentin Noël <corentinnoel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/tintou/dbus-signals-extend-coverage] dbus: increase signal handling coverage
- Date: Sun, 5 Apr 2020 12:37:00 +0000 (UTC)
commit 72e05a89284e7896e55e2a9e59e545f67b224e45
Author: Corentin Noël <corentin elementary io>
Date: Sun Apr 5 14:25:29 2020 +0200
dbus: increase signal handling coverage
This adds code coverage for generating multiple signals, tests for arrays and ensures that the private
signals are not leaking.
tests/dbus/signals.test | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/tests/dbus/signals.test b/tests/dbus/signals.test
index 10544c520..26ad34ca3 100644
--- a/tests/dbus/signals.test
+++ b/tests/dbus/signals.test
@@ -6,8 +6,11 @@ Program: client
[DBus (name = "org.example.Test")]
interface Test : Object {
public signal void foo (int i);
+ public signal void bar (string[] baz);
+ internal signal void finish ();
- public abstract void do_foo (int i) throws IOError;
+ public abstract void do_foo (int i) throws GLib.DBusError, GLib.IOError;
+ public abstract void do_bar (string[] baz) throws GLib.DBusError, GLib.IOError;
}
MainLoop main_loop;
@@ -18,10 +21,22 @@ void main () {
test.foo.connect ((i) => {
assert (i == 42);
+ });
+
+ test.bar.connect ((baz) => {
+ assert (baz.length == 3);
+ assert (baz[0] == "zero");
+ assert (baz[1] == "one");
+ assert (baz[2] == "two");
main_loop.quit ();
});
+ test.finish.connect (() => {
+ assert_not_reached ();
+ });
+
test.do_foo (42);
+ test.do_bar ({"zero", "one", "two"});
main_loop = new MainLoop ();
main_loop.run ();
@@ -32,9 +47,16 @@ Program: server
[DBus (name = "org.example.Test")]
class Test : Object {
public signal void foo (int i);
+ public signal void bar (string[] baz);
+ private signal void finish ();
- public void do_foo (int i) {
+ public void do_foo (int i) throws GLib.DBusError, GLib.IOError {
this.foo (i);
+ finish ();
+ }
+
+ public void do_bar (string[] baz) throws GLib.DBusError, GLib.IOError {
+ this.bar (baz);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]