[vala] D-Bus: Test async client and server methods with out parameters



commit a4802d1b91ab4131638c613c4dc38de097a054ef
Author: Jürg Billeter <j bitron ch>
Date:   Wed Sep 16 18:49:48 2009 +0200

    D-Bus: Test async client and server methods with out parameters

 tests/dbus/async.test |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/tests/dbus/async.test b/tests/dbus/async.test
index 0393bb2..03f4e6c 100644
--- a/tests/dbus/async.test
+++ b/tests/dbus/async.test
@@ -4,19 +4,21 @@ Program: client
 
 [DBus (name = "org.example.Test")]
 interface Test : Object {
-	public abstract async int test_int (int i) throws DBus.Error;
-	public abstract async string test_string (string s) throws DBus.Error;
+	public abstract async int test_int (int i, out int j) throws DBus.Error;
+	public abstract async string test_string (string s, out string t) throws DBus.Error;
 }
 
 MainLoop main_loop;
 
 async void run (Test test) {
-	int k;
-	k = yield test.test_int (42);
+	int j, k;
+	k = yield test.test_int (42, out j);
+	assert (j == 23);
 	assert (k == 11);
 
-	string u;
-	u = yield test.test_string ("hello");
+	string t, u;
+	u = yield test.test_string ("hello", out t);
+	assert (t == "world");
 	assert (u == "vala");
 
 	main_loop.quit ();
@@ -38,17 +40,19 @@ Program: server
 
 [DBus (name = "org.example.Test")]
 class Test : Object {
-	public async int test_int (int i) {
+	public async int test_int (int i, out int j) {
 		assert (i == 42);
 		Idle.add (test_int.callback);
 		yield;
+		j = 23;
 		return 11;
 	}
 
-	public async string test_string (string s) {
+	public async string test_string (string s, out string t) {
 		assert (s == "hello");
 		Idle.add (test_string.callback);
 		yield;
+		t = "world";
 		return "vala";
 	}
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]