libpurple/tests/test_contact_info.c

changeset 42596
b64b96f3b781
parent 42581
73eda937c387
child 42747
801025bad2e1
equal deleted inserted replaced
42595:e2078e5dc55c 42596:b64b96f3b781
58 char *email = NULL; 58 char *email = NULL;
59 char *phone_number = NULL; 59 char *phone_number = NULL;
60 char *note = NULL; 60 char *note = NULL;
61 char *sid = NULL; 61 char *sid = NULL;
62 char *name_for_display = NULL; 62 char *name_for_display = NULL;
63 gboolean favorite = FALSE;
63 64
64 avatar = g_object_new(PURPLE_TYPE_AVATAR, NULL); 65 avatar = g_object_new(PURPLE_TYPE_AVATAR, NULL);
65 person = purple_person_new(); 66 person = purple_person_new();
66 67
67 time_zone = g_time_zone_new_utc(); 68 time_zone = g_time_zone_new_utc();
83 "note", "message in a bottle", 84 "note", "message in a bottle",
84 "avatar", avatar, 85 "avatar", avatar,
85 "person", person, 86 "person", person,
86 "permission", PURPLE_CONTACT_INFO_PERMISSION_ALLOW, 87 "permission", PURPLE_CONTACT_INFO_PERMISSION_ALLOW,
87 "sid", "sid", 88 "sid", "sid",
89 "favorite", TRUE,
88 NULL); 90 NULL);
89 91
90 /* Now use g_object_get to read all of the properties. */ 92 /* Now use g_object_get to read all of the properties. */
91 g_object_get(info, 93 g_object_get(info,
92 "id", &id, 94 "id", &id,
103 "tags", &tags, 105 "tags", &tags,
104 "person", &person1, 106 "person", &person1,
105 "permission", &permission, 107 "permission", &permission,
106 "sid", &sid, 108 "sid", &sid,
107 "name-for-display", &name_for_display, 109 "name-for-display", &name_for_display,
110 "favorite", &favorite,
108 NULL); 111 NULL);
109 112
110 /* Compare all the things. */ 113 /* Compare all the things. */
111 g_assert_cmpstr(id, ==, "id1"); 114 g_assert_cmpstr(id, ==, "id1");
112 g_assert_cmpstr(username, ==, "username"); 115 g_assert_cmpstr(username, ==, "username");
123 g_assert_nonnull(presence1); 126 g_assert_nonnull(presence1);
124 g_assert_nonnull(tags); 127 g_assert_nonnull(tags);
125 g_assert_true(person1 == person); 128 g_assert_true(person1 == person);
126 g_assert_true(permission == PURPLE_CONTACT_INFO_PERMISSION_ALLOW); 129 g_assert_true(permission == PURPLE_CONTACT_INFO_PERMISSION_ALLOW);
127 g_assert_cmpstr(sid, ==, "sid"); 130 g_assert_cmpstr(sid, ==, "sid");
131 g_assert_true(favorite);
128 132
129 /* Free/unref all the things. */ 133 /* Free/unref all the things. */
130 g_clear_pointer(&id, g_free); 134 g_clear_pointer(&id, g_free);
131 g_clear_pointer(&username, g_free); 135 g_clear_pointer(&username, g_free);
132 g_clear_pointer(&display_name, g_free); 136 g_clear_pointer(&display_name, g_free);

mercurial