blob: 3f7424d848c6b15617dad72f0dddac5e18556dac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
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 ();
try {
Connection c;
// Test async
print ("Getting connection async\n");
c = yield Connection.get_async ();
print ("Got it %p\n", c);
print ("Creating app with connection\n");
TestApp app = new TestApp (c);
print ("Running app\n");
res = app.run();
} catch (GLib.IOError e1) {
warning ("Couldn't perform test: %s", e1.message);
} catch (Tracker.Sparql.Error e2) {
warning ("Couldn't perform test: %s", e2.message);
}
print ("\n");
}
private void test_sync () {
try {
Connection c;
// Test async
print ("Getting connection\n");
c = Connection.get ();
print ("Got it %p\n", c);
print ("Creating app with connection\n");
TestApp app = new TestApp (c);
print ("Running app\n");
res = app.run();
} catch (GLib.IOError e1) {
warning ("Couldn't perform test: %s", e1.message);
} catch (Tracker.Sparql.Error e2) {
warning ("Couldn't perform test: %s", e2.message);
}
print ("\n");
}
int
main( string[] args )
{
print ("Starting...\n");
loop = new MainLoop (null, false);
test_sync ();
if (res < 0) {
return res;
}
// Do async second
test_async.begin ();
loop.run ();
return res;
}
|