[Galago-commits] r2831 - in trunk/libgalago: . tests

galago-commits at freedesktop.org galago-commits at freedesktop.org
Sun Jun 11 19:36:26 PDT 2006


Author: chipx86
Date: 2006-06-11 19:36:22 -0700 (Sun, 11 Jun 2006)
New Revision: 2831

Modified:
   trunk/libgalago/ChangeLog
   trunk/libgalago/tests/check-libgalago.c
Log:
Added some test cases for synchronous and asynchronous calls.


Modified: trunk/libgalago/ChangeLog
===================================================================
--- trunk/libgalago/ChangeLog	2006-06-12 01:40:22 UTC (rev 2830)
+++ trunk/libgalago/ChangeLog	2006-06-12 02:36:22 UTC (rev 2831)
@@ -1,3 +1,8 @@
+Sun Jun 11 19:36:02 PDT 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	* tests/check-libgalago.c:
+	  - Added some test cases for synchronous and asynchronous calls.
+
 Sun Jun 11 18:16:36 PDT 2006  Christian Hammond <chipx86 at chipx86.com>
 
 	* docs/reference/libgalago-sections.txt:

Modified: trunk/libgalago/tests/check-libgalago.c
===================================================================
--- trunk/libgalago/tests/check-libgalago.c	2006-06-12 01:40:22 UTC (rev 2830)
+++ trunk/libgalago/tests/check-libgalago.c	2006-06-12 02:36:22 UTC (rev 2831)
@@ -354,6 +354,62 @@
 
 
 /**************************************************************************
+ * Test synchronous calls
+ **************************************************************************/
+START_TEST(test_service_get_account)
+{
+	GalagoService *service;
+	GalagoAccount *account;
+
+	galago_init("check-libgalago", GALAGO_INIT_CLIENT);
+
+	service = galago_get_service("aim", GALAGO_REMOTE, TRUE);
+	fail_unless(service != NULL,
+				"Couldn't fetch aim service. Is presence-feed running?");
+
+	account = galago_service_get_account(service, "GalagoAIMUser", TRUE);
+	fail_unless(service != NULL,
+				"Couldn't get account GalagoAIMUser. "
+				"Is presence-feed running?");
+}
+END_TEST
+
+
+/**************************************************************************
+ * Test asynchronous calls
+ **************************************************************************/
+static void
+account_received_cb(GalagoService *service, GalagoAccount *account,
+					GMainLoop *loop)
+{
+	fail_unless(account != NULL &&
+				!strcmp(galago_account_get_username(account), "GalagoAIMUser"),
+				"Couldn't get account GalagoAIMUser. "
+				"Is presence-feed running?");
+	g_main_loop_quit(loop);
+}
+
+START_TEST(test_service_get_account_async)
+{
+	GalagoService *service;
+	GMainLoop *loop;
+
+	loop = g_main_loop_new(NULL, FALSE);
+
+	galago_init("check-libgalago", GALAGO_INIT_CLIENT);
+
+	service = galago_get_service("aim", GALAGO_REMOTE, TRUE);
+	fail_unless(service != NULL,
+				"Couldn't fetch aim service. Is presence-feed running?");
+
+	galago_service_get_account_async(service, "GalagoAIMUser",
+									 G_CALLBACK(account_received_cb), loop);
+
+	g_main_loop_run(loop);
+}
+END_TEST
+
+/**************************************************************************
  * Core tests
  **************************************************************************/
 START_TEST(test_core)
@@ -402,6 +458,12 @@
 	/* Test the Service object */
 	ADD_TCASE("service_normalize", test_service_normalize);
 
+	/* Test synchronous queries */
+	ADD_TCASE("service_get_account", test_service_get_account);
+
+	/* Test asynchronous queries */
+	ADD_TCASE("service_get_account_async", test_service_get_account_async);
+
 	return s;
 }
 



More information about the galago-commits mailing list