[libgames-support] Update tests for async add_score
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgames-support] Update tests for async add_score
- Date: Sun, 20 Sep 2015 18:50:58 +0000 (UTC)
commit 0bc1214f19068e87db9417578fd8c353e1c71755
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sun Sep 20 13:50:38 2015 -0500
Update tests for async add_score
Tests are still broken ;)
tests/test-scores.vala | 39 ++++++++++++++++++++++++---------------
1 files changed, 24 insertions(+), 15 deletions(-)
---
diff --git a/tests/test-scores.vala b/tests/test-scores.vala
index 2200768..a2e9728 100644
--- a/tests/test-scores.vala
+++ b/tests/test-scores.vala
@@ -27,24 +27,33 @@ private Category category_request (string category_key)
return new Category("test", "test");
}
+private void add_score_sync (Context context, int score, Category category) {
+ var main_loop = new MainLoop (MainContext default (), false);
+ context.add_score.begin (score, category, (object, result) => {
+ try
+ {
+ (void) context.add_score.end (result);
+ }
+ catch (Error e)
+ {
+ assert_not_reached ();
+ }
+ main_loop.quit ();
+ });
+ main_loop.run ();
+}
+
private void create_scores ()
{
- try
- {
- Context context = new Context ("libgames-scores-test", "Games Type", null, category_request,
Style.PLAIN_DESCENDING);
- Category cat = new Category ("cat1", "cat1");
- context.add_score (101, cat);
- context.add_score (102, cat);
-
- cat.key = "cat2";
- cat.name = "cat2";
- context.add_score (21, cat);
- context.add_score (24, cat);
- }
- catch (Error e)
- {
- error (e.message);
- }
+ Context context = new Context ("libgames-scores-test", "Games Type", null, category_request,
Style.PLAIN_DESCENDING);
+ Category cat = new Category ("cat1", "cat1");
+ add_score_sync (context, 101, cat);
+ add_score_sync (context, 102, cat);
+
+ cat.key = "cat2";
+ cat.name = "cat2";
+ add_score_sync (context, 21, cat);
+ add_score_sync (context, 24, cat);
}
private string get_filename (string category_name)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]