diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2013-09-27 12:25:34 +0200 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2013-09-27 13:42:56 +0200 |
commit | bb5133759bc92716c24770e46fc95ad7d8073980 (patch) | |
tree | 10f563ae7a679ca71912960b6b3e4a25eada5dc9 /tests/dbus | |
parent | 9acc98e7c25b1b9bb7f779c595e05a9d88035c48 (diff) | |
download | telepathy-logger-bb5133759bc92716c24770e46fc95ad7d8073980.tar.gz |
Prepare TpAccount if needed
Make sure that the TpAccount we receive from public API is prepared as more
and more API are relying on it.
https://bugs.freedesktop.org/show_bug.cgi?id=69814
Diffstat (limited to 'tests/dbus')
-rw-r--r-- | tests/dbus/test-log-manager.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/dbus/test-log-manager.c b/tests/dbus/test-log-manager.c index a6e9f5f..5441b87 100644 --- a/tests/dbus/test-log-manager.c +++ b/tests/dbus/test-log-manager.c @@ -387,6 +387,47 @@ test_get_events_for_date (TestCaseFixture *fixture, g_list_free (fixture->ret); } +static void +test_get_events_for_date_account_unprepared (TestCaseFixture *fixture, + gconstpointer user_data) +{ + GHashTable *params = (GHashTable *) user_data; + TplEntity *entity; + GDate *date; + TpAccount *account; + const gchar *account_path; + + g_clear_object (&fixture->account); + + account_path = g_value_get_string ( + (const GValue *) g_hash_table_lookup (params, "account-path")); + + account = tp_simple_client_factory_ensure_account (fixture->factory, + account_path, NULL, NULL); + g_assert (!tp_proxy_is_prepared (account, TP_ACCOUNT_FEATURE_CORE)); + + entity = tpl_entity_new (ID, TPL_ENTITY_CONTACT, NULL, NULL); + date = g_date_new_dmy (13, 1, 2010); + + tpl_log_manager_get_events_for_date_async (fixture->manager, + account, + entity, + TPL_EVENT_MASK_TEXT, + date, + get_events_for_date_cb, + fixture); + g_main_loop_run (fixture->main_loop); + + g_object_unref (entity); + g_date_free (date); + + /* We got 6 events in old Empathy and 6 in new TpLogger storage */ + g_assert_cmpint (g_list_length (fixture->ret), ==, 12); + + g_list_foreach (fixture->ret, (GFunc) g_object_unref, NULL); + g_list_free (fixture->ret); + g_object_unref (account); +} static void get_filtered_events_cb (GObject *object, @@ -738,6 +779,10 @@ main (int argc, char **argv) TestCaseFixture, params, setup, test_get_events_for_date, teardown); + g_test_add ("/log-manager/get-events-for-date-account-unprepared", + TestCaseFixture, params, + setup, test_get_events_for_date_account_unprepared, teardown); + g_test_add ("/log-manager/get-filtered-events", TestCaseFixture, params, setup, test_get_filtered_events, teardown); |