summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-10-28 13:02:13 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-11-11 16:49:03 +0000
commit689c4297ff8cd7cf971ba4bf46ad605a3149f6b4 (patch)
tree7246bc44b23ec3cb1a7fb5a544c3d93bd7edab73 /tests
parent9cdd0c501a3c3d919468652f1ed3fad0202cb910 (diff)
downloadtelepathy-glib-689c4297ff8cd7cf971ba4bf46ad605a3149f6b4.tar.gz
tp_protocol_normalize_contact_async: add and test
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71048 Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Diffstat (limited to 'tests')
-rw-r--r--tests/dbus/protocol-objects.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/dbus/protocol-objects.c b/tests/dbus/protocol-objects.c
index 827e843da..248805728 100644
--- a/tests/dbus/protocol-objects.c
+++ b/tests/dbus/protocol-objects.c
@@ -535,6 +535,38 @@ test_protocol_object_from_file (Test *test,
check_avatar_requirements (req);
}
+static void
+test_normalize (Test *test,
+ gconstpointer data G_GNUC_UNUSED)
+{
+ GAsyncResult *result = NULL;
+ gchar *s;
+
+ tp_tests_proxy_run_until_prepared (test->cm, NULL);
+ test->protocol = g_object_ref (
+ tp_connection_manager_get_protocol_object (test->cm, "example"));
+
+ tp_protocol_normalize_contact_async (test->protocol,
+ "MiXeDcAsE", NULL, tp_tests_result_ready_cb, &result);
+ tp_tests_run_until_result (&result);
+ s = tp_protocol_normalize_contact_finish (test->protocol, result,
+ &test->error);
+ g_assert_no_error (test->error);
+ g_assert_cmpstr (s, ==, "mixedcase");
+ g_clear_object (&result);
+ g_free (s);
+
+ tp_protocol_normalize_contact_async (test->protocol,
+ "", NULL, tp_tests_result_ready_cb, &result);
+ tp_tests_run_until_result (&result);
+ s = tp_protocol_normalize_contact_finish (test->protocol, result,
+ &test->error);
+ g_assert_error (test->error, TP_ERROR, TP_ERROR_INVALID_HANDLE);
+ g_assert_cmpstr (s, ==, NULL);
+ g_clear_object (&result);
+ g_clear_error (&test->error);
+}
+
int
main (int argc,
char **argv)
@@ -558,6 +590,8 @@ main (int argc,
test_protocol_object_old, teardown);
g_test_add ("/protocol-objects/object-from-file", Test, NULL, setup,
test_protocol_object_from_file, teardown);
+ g_test_add ("/protocol-objects/normalize", Test, NULL, setup,
+ test_normalize, teardown);
return tp_tests_run_with_bus ();
}