diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-03-28 11:31:33 +0200 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-03-29 11:56:47 +0200 |
commit | 19cd507119858c8b4a5656dad6da02f4bae9b98e (patch) | |
tree | f63e2f3b11a2aa9cd2a0d484e1d60fc34271221c | |
parent | ea0800451b9ef3577edad6048a30ddffab7e3462 (diff) | |
download | telepathy-glib-19cd507119858c8b4a5656dad6da02f4bae9b98e.tar.gz |
Tests: Add more supported ContactInfo fields
Those are needed for folks tests
-rw-r--r-- | tests/dbus/contacts.c | 41 | ||||
-rw-r--r-- | tests/lib/contacts-conn.c | 31 |
2 files changed, 59 insertions, 13 deletions
diff --git a/tests/dbus/contacts.c b/tests/dbus/contacts.c index 6d0e4c56f..e1d4b786c 100644 --- a/tests/dbus/contacts.c +++ b/tests/dbus/contacts.c @@ -216,24 +216,41 @@ contact_info_prepare_cb (GObject *object, if (tp_proxy_prepare_finish (connection, res, &result->error)) { TpContactInfoFlags flags; - GList *specs; - TpContactInfoFieldSpec *spec; + GList *specs, *l; flags = tp_connection_get_contact_info_flags (connection); g_assert_cmpint (flags, ==, TP_CONTACT_INFO_FLAG_PUSH | TP_CONTACT_INFO_FLAG_CAN_SET); specs = tp_connection_get_contact_info_supported_fields (connection); - g_assert (specs != NULL); - g_assert (specs->data != NULL); - g_assert (specs->next == NULL); - - spec = specs->data; - g_assert_cmpstr (spec->name, ==, "n"); - g_assert (spec->parameters != NULL); - g_assert (spec->parameters[0] == NULL); - g_assert_cmpint (spec->flags, ==, 0); - g_assert_cmpint (spec->max, ==, 0); + g_assert_cmpuint (g_list_length (specs), ==, 5); + + for (l = specs; l != NULL; l = l->next) + { + TpContactInfoFieldSpec *spec = l->data; + + if (!tp_strdiff (spec->name, "bday") || + !tp_strdiff (spec->name, "fn")) + { + g_assert (spec->parameters != NULL); + g_assert (spec->parameters[0] == NULL); + g_assert_cmpint (spec->flags, ==, 0); + g_assert_cmpint (spec->max, ==, 1); + } + else if (!tp_strdiff (spec->name, "email") || + !tp_strdiff (spec->name, "tel") || + !tp_strdiff (spec->name, "url")) + { + g_assert (spec->parameters != NULL); + g_assert (spec->parameters[0] == NULL); + g_assert_cmpint (spec->flags, ==, 0); + g_assert_cmpint (spec->max, ==, G_MAXUINT32); + } + else + { + g_assert_not_reached (); + } + } g_list_free (specs); } diff --git a/tests/lib/contacts-conn.c b/tests/lib/contacts-conn.c index c022c1f55..672181a93 100644 --- a/tests/lib/contacts-conn.c +++ b/tests/lib/contacts-conn.c @@ -330,11 +330,40 @@ conn_contact_info_properties_getter (GObject *object, if (supported_fields == NULL) { supported_fields = g_ptr_array_new (); + + g_ptr_array_add (supported_fields, tp_value_array_build (4, + G_TYPE_STRING, "bday", + G_TYPE_STRV, NULL, + G_TYPE_UINT, 0, + G_TYPE_UINT, 1, + G_TYPE_INVALID)); + + g_ptr_array_add (supported_fields, tp_value_array_build (4, + G_TYPE_STRING, "email", + G_TYPE_STRV, NULL, + G_TYPE_UINT, 0, + G_TYPE_UINT, G_MAXUINT32, + G_TYPE_INVALID)); + + g_ptr_array_add (supported_fields, tp_value_array_build (4, + G_TYPE_STRING, "fn", + G_TYPE_STRV, NULL, + G_TYPE_UINT, 0, + G_TYPE_UINT, 1, + G_TYPE_INVALID)); + g_ptr_array_add (supported_fields, tp_value_array_build (4, - G_TYPE_STRING, "n", + G_TYPE_STRING, "tel", G_TYPE_STRV, NULL, G_TYPE_UINT, 0, + G_TYPE_UINT, G_MAXUINT32, + G_TYPE_INVALID)); + + g_ptr_array_add (supported_fields, tp_value_array_build (4, + G_TYPE_STRING, "url", + G_TYPE_STRV, NULL, G_TYPE_UINT, 0, + G_TYPE_UINT, G_MAXUINT32, G_TYPE_INVALID)); } g_value_set_boxed (value, supported_fields); |