[Pkg-telepathy-commits] [telepathy-glib] 89/111: test-protocol-objects: factor out check_tp_protocol()

Simon McVittie smcv at debian.org
Wed Mar 19 18:07:28 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository telepathy-glib.

commit a4d1165fcd95eaadbc662c89497386545c90ca56
Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Fri Feb 28 16:24:39 2014 +0100

    test-protocol-objects: factor out check_tp_protocol()
---
 tests/dbus/protocol-objects.c | 62 ++++++++++++++++++++++++-------------------
 1 file changed, 34 insertions(+), 28 deletions(-)

diff --git a/tests/dbus/protocol-objects.c b/tests/dbus/protocol-objects.c
index f33122d..5a75156 100644
--- a/tests/dbus/protocol-objects.c
+++ b/tests/dbus/protocol-objects.c
@@ -387,74 +387,80 @@ check_avatar_requirements (TpAvatarRequirements *req)
 }
 
 static void
-test_protocol_object (Test *test,
-    gconstpointer data G_GNUC_UNUSED)
+check_tp_protocol (TpProtocol *protocol)
 {
   TpAvatarRequirements *req;
   GList *l;
   TpConnectionManagerParam *param;
 
-  g_assert_cmpstr (tp_connection_manager_get_name (test->cm), ==,
-      "example_echo_2");
-  tp_tests_proxy_run_until_prepared (test->cm, NULL);
-  test->protocol = g_object_ref (
-      tp_connection_manager_get_protocol_object (test->cm, "example"));
-
-  g_assert_cmpstr (tp_protocol_get_name (test->protocol), ==, "example");
+  g_assert_cmpstr (tp_protocol_get_name (protocol), ==, "example");
 
-  g_assert_cmpstr (tp_protocol_get_cm_name (test->protocol),
+  g_assert_cmpstr (tp_protocol_get_cm_name (protocol),
       ==, "example_echo_2");
 
-  g_assert (tp_proxy_has_interface_by_id (test->protocol,
+  g_assert (tp_proxy_has_interface_by_id (protocol,
       TP_IFACE_QUARK_PROTOCOL));
-  g_assert (tp_proxy_has_interface_by_id (test->protocol,
+  g_assert (tp_proxy_has_interface_by_id (protocol,
       TP_IFACE_QUARK_PROTOCOL_INTERFACE_AVATARS));
 
-  g_assert (tp_proxy_is_prepared (test->protocol,
+  g_assert (tp_proxy_is_prepared (protocol,
         TP_PROTOCOL_FEATURE_PARAMETERS));
 
-  g_assert (tp_protocol_has_param (test->protocol, "account"));
-  g_assert (!tp_protocol_has_param (test->protocol, "no-way"));
+  g_assert (tp_protocol_has_param (protocol, "account"));
+  g_assert (!tp_protocol_has_param (protocol, "no-way"));
 
-  g_assert (tp_proxy_is_prepared (test->protocol, TP_PROTOCOL_FEATURE_CORE));
+  g_assert (tp_proxy_is_prepared (protocol, TP_PROTOCOL_FEATURE_CORE));
 
-  g_assert_cmpstr (tp_protocol_get_icon_name (test->protocol), ==,
+  g_assert_cmpstr (tp_protocol_get_icon_name (protocol), ==,
       "im-icq");
-  g_assert_cmpstr (tp_protocol_get_english_name (test->protocol), ==,
+  g_assert_cmpstr (tp_protocol_get_english_name (protocol), ==,
       "Echo II example");
-  g_assert_cmpstr (tp_protocol_get_vcard_field (test->protocol), ==,
+  g_assert_cmpstr (tp_protocol_get_vcard_field (protocol), ==,
       "x-telepathy-example");
   g_assert (TP_IS_CAPABILITIES (tp_protocol_get_capabilities (
-          test->protocol)));
+          protocol)));
 
-  req = tp_protocol_get_avatar_requirements (test->protocol);
+  req = tp_protocol_get_avatar_requirements (protocol);
   check_avatar_requirements (req);
 
-  g_object_get (test->protocol, "avatar-requirements", &req, NULL);
+  g_object_get (protocol, "avatar-requirements", &req, NULL);
   check_avatar_requirements (req);
 
-  l = tp_protocol_dup_params (test->protocol);
+  l = tp_protocol_dup_params (protocol);
   g_assert_cmpuint (g_list_length (l), ==, 1);
   param = l->data;
   g_assert_cmpstr (param->name, ==, "account");
   g_list_free_full (l, (GDestroyNotify) tp_connection_manager_param_free);
 
-  g_assert_cmpstr (tp_protocol_get_param (test->protocol, "account")->name, ==,
+  g_assert_cmpstr (tp_protocol_get_param (protocol, "account")->name, ==,
       "account");
 
-  param = tp_protocol_dup_param (test->protocol, "account");
+  param = tp_protocol_dup_param (protocol, "account");
   /* it's a copy */
-  g_assert (param != tp_protocol_get_param (test->protocol, "account"));
+  g_assert (param != tp_protocol_get_param (protocol, "account"));
   g_assert_cmpstr (param->name, ==, "account");
   tp_connection_manager_param_free (param);
 
-  g_assert_cmpstr (tp_protocol_borrow_params (test->protocol)[0].name, ==,
+  g_assert_cmpstr (tp_protocol_borrow_params (protocol)[0].name, ==,
       "account");
-  g_assert_cmpstr (tp_protocol_borrow_params (test->protocol)[1].name, ==,
+  g_assert_cmpstr (tp_protocol_borrow_params (protocol)[1].name, ==,
       NULL);
 }
 
 static void
+test_protocol_object (Test *test,
+    gconstpointer data G_GNUC_UNUSED)
+{
+  g_assert_cmpstr (tp_connection_manager_get_name (test->cm), ==,
+      "example_echo_2");
+  tp_tests_proxy_run_until_prepared (test->cm, NULL);
+  test->protocol = g_object_ref (
+      tp_connection_manager_get_protocol_object (test->cm, "example"));
+
+  check_tp_protocol (test->protocol);
+}
+
+static void
 test_protocol_object_old (Test *test,
     gconstpointer data G_GNUC_UNUSED)
 {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/telepathy-glib.git



More information about the Pkg-telepathy-commits mailing list