From: José Dapena Paz Date: Mon, 18 Jan 2010 13:31:48 +0000 (+0100) Subject: Test app for update_folder_counts method X-Git-Tag: 3.2.10-1~11 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=8ae56695b765259b3574ae7101eff477e24020c3 Test app for update_folder_counts method --- diff --git a/tests/dbus_api/Makefile.am b/tests/dbus_api/Makefile.am index 061ac5c..4908403 100644 --- a/tests/dbus_api/Makefile.am +++ b/tests/dbus_api/Makefile.am @@ -31,6 +31,7 @@ noinst_PROGRAMS = \ test_get_folders \ test_top_application \ test_update_account \ + test_update_folder_counts \ test_open_account \ test_open_edit_accounts_dialog @@ -61,6 +62,9 @@ test_top_application_LDADD = $(objects) test_update_account_SOURCES = test_update_account.c test_update_account_LDADD = $(objects) +test_update_folder_counts_SOURCES = test_update_folder_counts.c +test_update_folder_counts_LDADD = $(objects) + test_open_account_SOURCES = test_open_account.c test_open_account_LDADD = $(objects) diff --git a/tests/dbus_api/test_update_folder_counts.c b/tests/dbus_api/test_update_folder_counts.c new file mode 100644 index 0000000..42d068d --- /dev/null +++ b/tests/dbus_api/test_update_folder_counts.c @@ -0,0 +1,52 @@ +#include +#include +#include +#include + +static gchar *account_id = NULL; + +static GOptionEntry option_entries [] = +{ + { "account", 'a', 0, G_OPTION_ARG_STRING, &account_id, "Account to perform update folder accounts into", NULL }, + { NULL } +}; + + +int +main (int argc, char *argv[]) +{ + osso_context_t *osso_context; + GOptionContext *context; + gboolean result; + GError *error = NULL; + + context = g_option_context_new ("- Modest email client"); + g_option_context_add_main_entries (context, option_entries, NULL); + if (!g_option_context_parse (context, &argc, &argv, &error)) { + g_print ("option parsing failed: %s\n", error->message); + g_option_context_free (context); + exit (1); + } + g_option_context_free (context); + + osso_context = osso_initialize ("test_update_account", + "0.0.1", + TRUE, + NULL); + + if (osso_context == NULL) { + g_printerr ("osso_initialize() failed.\n"); + return -1; + } + + if (account_id == NULL) { + g_printerr ("Provide an account id\n"); + return -1; + } + + result = libmodest_dbus_client_update_folder_counts (osso_context, account_id); + g_free (account_id); + + return result; + +}