[tracker/gdbus-evolution: 1/28] functional-tests: Do not use nested mainloop in libtracker-sparql tests
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/gdbus-evolution: 1/28] functional-tests: Do not use nested mainloop in libtracker-sparql tests
- Date: Thu, 28 Oct 2010 08:29:16 +0000 (UTC)
commit f4ce9307476579bfc308099c2cfd5a09cad1a501
Author: Jürg Billeter <j bitron ch>
Date: Fri Oct 22 14:18:56 2010 +0200
functional-tests: Do not use nested mainloop in libtracker-sparql tests
tests/functional-tests/default-update-test.vala | 19 +++++++++----------
tests/functional-tests/direct-query-test.vala | 18 +++++++++---------
2 files changed, 18 insertions(+), 19 deletions(-)
---
diff --git a/tests/functional-tests/default-update-test.vala b/tests/functional-tests/default-update-test.vala
index 3f7424d..c7fd137 100644
--- a/tests/functional-tests/default-update-test.vala
+++ b/tests/functional-tests/default-update-test.vala
@@ -3,16 +3,18 @@ using Tracker.Sparql;
private static int res;
private static MainLoop loop;
-private async void test_async () {
- // Quite this loo because we start another one in app.run ()
- loop.quit ();
-
+private void test_async () {
try {
- Connection c;
+ Connection c = null;
// Test async
print ("Getting connection async\n");
- c = yield Connection.get_async ();
+ loop = new MainLoop (null, false);
+ Connection.get_async.begin (null, (o, res) => {
+ c = Connection.get_async.end (res);
+ loop.quit ();
+ });
+ loop.run ();
print ("Got it %p\n", c);
@@ -58,7 +60,6 @@ int
main( string[] args )
{
print ("Starting...\n");
- loop = new MainLoop (null, false);
test_sync ();
@@ -67,9 +68,7 @@ main( string[] args )
}
// Do async second
- test_async.begin ();
-
- loop.run ();
+ test_async ();
return res;
}
diff --git a/tests/functional-tests/direct-query-test.vala b/tests/functional-tests/direct-query-test.vala
index a322a4a..4c87cf7 100644
--- a/tests/functional-tests/direct-query-test.vala
+++ b/tests/functional-tests/direct-query-test.vala
@@ -4,16 +4,18 @@ using Tracker.Sparql;
private static int res;
private static MainLoop loop;
-private async void test_async () {
- // Quite this loo because we start another one in app.run ()
- loop.quit ();
-
+private void test_async () {
try {
- Connection c;
+ Connection c = null;
// Test async
print ("Getting connection asynchronously\n");
- c = yield Connection.get_async ();
+ loop = new MainLoop (null, false);
+ Connection.get_async.begin (null, (o, res) => {
+ c = Connection.get_async.end (res);
+ loop.quit ();
+ });
+ loop.run ();
print ("Got it %p\n", c);
@@ -59,7 +61,6 @@ int
main( string[] args )
{
print ("Starting...\n");
- loop = new MainLoop (null, false);
test_sync ();
@@ -67,8 +68,7 @@ main( string[] args )
return res;
}
- test_async.begin ();
- loop.run ();
+ test_async ();
return res;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]