[evolution-data-server/treitter-test-suites] Pass the full closure into the test util async callback functions, for greater flexibility in the te
- From: Travis Reitter <treitter src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-data-server/treitter-test-suites] Pass the full closure into the test util async callback functions, for greater flexibility in the te
- Date: Wed, 30 Dec 2009 00:55:31 +0000 (UTC)
commit 32aab1b5232dbec77c4a83303abe2cdbad629c20
Author: Travis Reitter <treitter gmail com>
Date: Tue Dec 29 12:41:19 2009 -0800
Pass the full closure into the test util async callback functions, for greater flexibility in the tests.
addressbook/tests/ebook/ebook-test-utils.c | 21 ++++++++++++++-----
addressbook/tests/ebook/ebook-test-utils.h | 3 ++
addressbook/tests/ebook/test-ebook-add-contact.c | 2 +-
addressbook/tests/ebook/test-ebook-get-contact.c | 3 +-
.../tests/ebook/test-ebook-remove-contact-by-id.c | 2 +-
.../tests/ebook/test-ebook-remove-contact.c | 3 +-
.../tests/ebook/test-ebook-remove-contacts.c | 2 +-
addressbook/tests/ebook/test-ebook-remove.c | 2 +-
8 files changed, 26 insertions(+), 12 deletions(-)
---
diff --git a/addressbook/tests/ebook/ebook-test-utils.c b/addressbook/tests/ebook/ebook-test-utils.c
index 8efb722..1385c7b 100644
--- a/addressbook/tests/ebook/ebook-test-utils.c
+++ b/addressbook/tests/ebook/ebook-test-utils.c
@@ -7,6 +7,15 @@
#include "ebook-test-utils.h"
+gboolean
+ebook_test_utils_callback_quit (gpointer user_data)
+{
+ EBookTestClosure *closure = user_data;
+ g_main_loop_quit ((GMainLoop*) closure->user_data);
+
+ return FALSE;
+}
+
char*
ebook_test_utils_new_vcard_from_test_case (const char *case_name)
{
@@ -111,7 +120,7 @@ add_contact_cb (EBook *book,
g_print ("successfully asynchronously added the contact "
"addressbook\n");
if (closure) {
- (*closure->cb) (closure->user_data);
+ (*closure->cb) (closure);
g_free (closure);
}
}
@@ -227,7 +236,7 @@ get_contact_cb (EBook *book,
uid);
if (closure) {
- (*closure->cb) (closure->user_data);
+ (*closure->cb) (closure);
g_free (closure);
}
}
@@ -281,7 +290,7 @@ remove_contact_cb (EBook *book,
g_print ("successfully asynchronously removed the contact\n");
if (closure) {
- (*closure->cb) (closure->user_data);
+ (*closure->cb) (closure);
g_free (closure);
}
}
@@ -319,7 +328,7 @@ remove_contact_by_id_cb (EBook *book,
g_print ("successfully asynchronously removed the contact by id\n");
if (closure) {
- (*closure->cb) (closure->user_data);
+ (*closure->cb) (closure);
g_free (closure);
}
}
@@ -373,7 +382,7 @@ remove_contacts_cb (EBook *book,
g_print ("successfully asynchronously removed the contacts\n");
if (closure) {
- (*closure->cb) (closure->user_data);
+ (*closure->cb) (closure);
g_free (closure);
}
}
@@ -477,7 +486,7 @@ remove_cb (EBook *book, EBookStatus status, EBookTestClosure *closure)
g_print ("successfully asynchronously removed the temporary "
"addressbook\n");
if (closure)
- (*closure->cb) (closure->user_data);
+ (*closure->cb) (closure);
}
void
diff --git a/addressbook/tests/ebook/ebook-test-utils.h b/addressbook/tests/ebook/ebook-test-utils.h
index 74dd96f..d76d126 100644
--- a/addressbook/tests/ebook/ebook-test-utils.h
+++ b/addressbook/tests/ebook/ebook-test-utils.h
@@ -33,6 +33,9 @@ typedef struct {
gpointer user_data;
} EBookTestClosure;
+gboolean
+ebook_test_utils_callback_quit (gpointer user_data);
+
char*
ebook_test_utils_new_vcard_from_test_case (const char *case_name);
diff --git a/addressbook/tests/ebook/test-ebook-add-contact.c b/addressbook/tests/ebook/test-ebook-add-contact.c
index b352057..5d0b887 100644
--- a/addressbook/tests/ebook/test-ebook-add-contact.c
+++ b/addressbook/tests/ebook/test-ebook-add-contact.c
@@ -43,7 +43,7 @@ main (gint argc, gchar **argv)
loop = g_main_loop_new (NULL, TRUE);
ebook_test_utils_book_async_add_contact (book, contact,
- (GSourceFunc) g_main_loop_quit, loop);
+ ebook_test_utils_callback_quit, loop);
g_free (uid);
g_main_loop_run (loop);
diff --git a/addressbook/tests/ebook/test-ebook-get-contact.c b/addressbook/tests/ebook/test-ebook-get-contact.c
index 6bcce72..9adcfcb 100644
--- a/addressbook/tests/ebook/test-ebook-get-contact.c
+++ b/addressbook/tests/ebook/test-ebook-get-contact.c
@@ -34,7 +34,8 @@ main (gint argc, gchar **argv)
*/
loop = g_main_loop_new (NULL, TRUE);
ebook_test_utils_book_async_get_contact (book, uid,
- (GSourceFunc) g_main_loop_quit, loop);
+ ebook_test_utils_callback_quit, loop);
+
g_main_loop_run (loop);
ebook_test_utils_book_remove (book);
diff --git a/addressbook/tests/ebook/test-ebook-remove-contact-by-id.c b/addressbook/tests/ebook/test-ebook-remove-contact-by-id.c
index 8b99cf0..7f5a497 100644
--- a/addressbook/tests/ebook/test-ebook-remove-contact-by-id.c
+++ b/addressbook/tests/ebook/test-ebook-remove-contact-by-id.c
@@ -29,7 +29,7 @@ main (gint argc, gchar **argv)
loop = g_main_loop_new (NULL, TRUE);
ebook_test_utils_book_async_remove_contact_by_id (book, uid,
- (GSourceFunc) g_main_loop_quit, loop);
+ ebook_test_utils_callback_quit, loop);
g_main_loop_run (loop);
diff --git a/addressbook/tests/ebook/test-ebook-remove-contact.c b/addressbook/tests/ebook/test-ebook-remove-contact.c
index b307280..a8ebd4e 100644
--- a/addressbook/tests/ebook/test-ebook-remove-contact.c
+++ b/addressbook/tests/ebook/test-ebook-remove-contact.c
@@ -47,7 +47,8 @@ main (gint argc, gchar **argv)
loop = g_main_loop_new (NULL, TRUE);
/* contact_final is unref'd by e_book_remove_contact() here */
ebook_test_utils_book_async_remove_contact (book, contact_final,
- (GSourceFunc) g_main_loop_quit, loop);
+ ebook_test_utils_callback_quit, loop);
+
g_main_loop_run (loop);
diff --git a/addressbook/tests/ebook/test-ebook-remove-contacts.c b/addressbook/tests/ebook/test-ebook-remove-contacts.c
index 369050a..1f9f401 100644
--- a/addressbook/tests/ebook/test-ebook-remove-contacts.c
+++ b/addressbook/tests/ebook/test-ebook-remove-contacts.c
@@ -58,7 +58,7 @@ main (gint argc, gchar **argv)
loop = g_main_loop_new (NULL, TRUE);
ebook_test_utils_book_async_remove_contacts (book, uids,
- (GSourceFunc) g_main_loop_quit, loop);
+ ebook_test_utils_callback_quit, loop);
g_main_loop_run (loop);
diff --git a/addressbook/tests/ebook/test-ebook-remove.c b/addressbook/tests/ebook/test-ebook-remove.c
index 5011490..3f21fef 100644
--- a/addressbook/tests/ebook/test-ebook-remove.c
+++ b/addressbook/tests/ebook/test-ebook-remove.c
@@ -25,7 +25,7 @@ main (gint argc, gchar **argv)
loop = g_main_loop_new (NULL, TRUE);
ebook_test_utils_book_async_remove (book,
- (GSourceFunc) g_main_loop_quit, loop);
+ ebook_test_utils_callback_quit, loop);
g_main_loop_run (loop);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]