Mon, 03 Feb 2025 21:07:27 -0600
Update the tests for Purple.Person
I also added Purple.Person.remove_all_contact_infos as we need it for the
tests and it could be useful for others maybe.
Testing Done:
Ran the tests under valgrind and called in the turtles.
Reviewed at https://reviews.imfreedom.org/r/3795/
| 41749 | 1 | /* |
| 2 | * Purple - Internet Messaging Library | |
| 3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> | |
| 4 | * | |
| 5 | * This library is free software; you can redistribute it and/or | |
| 6 | * modify it under the terms of the GNU Lesser General Public | |
| 7 | * License as published by the Free Software Foundation; either | |
| 8 | * version 2 of the License, or (at your option) any later version. | |
| 9 | * | |
| 10 | * This library is distributed in the hope that it will be useful, | |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | * Lesser General Public License for more details. | |
| 14 | * | |
| 15 | * You should have received a copy of the GNU Lesser General Public | |
| 16 | * License along with this library; if not, see <https://www.gnu.org/licenses/>. | |
| 17 | */ | |
| 18 | ||
| 19 | #include <glib.h> | |
| 20 | ||
| 21 | #include <purple.h> | |
| 22 | ||
| 23 | /****************************************************************************** | |
| 24 | * Callbacks | |
| 25 | *****************************************************************************/ | |
| 26 | static void | |
| 27 | test_purple_person_items_changed_cb(G_GNUC_UNUSED GListModel *model, | |
| 28 | G_GNUC_UNUSED guint position, | |
| 29 | G_GNUC_UNUSED guint removed, | |
| 30 | G_GNUC_UNUSED guint added, | |
| 31 | gpointer data) | |
| 32 | { | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
33 | guint *counter = data; |
| 41749 | 34 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
35 | *counter = *counter + 1; |
| 41749 | 36 | } |
| 37 | ||
| 38 | static void | |
| 39 | test_purple_person_notify_cb(G_GNUC_UNUSED GObject *obj, | |
| 40 | G_GNUC_UNUSED GParamSpec *pspec, | |
| 41 | gpointer data) | |
| 42 | { | |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
43 | guint *called = data; |
| 41749 | 44 | |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
45 | *called = *called + 1; |
| 41749 | 46 | } |
| 47 | ||
| 48 | /****************************************************************************** | |
| 49 | * Tests | |
| 50 | *****************************************************************************/ | |
| 51 | static void | |
| 52 | test_purple_person_new(void) { | |
| 53 | PurplePerson *person = NULL; | |
| 54 | ||
| 55 | person = purple_person_new(); | |
| 56 | ||
| 57 | g_assert_true(PURPLE_IS_PERSON(person)); | |
| 58 | ||
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
59 | g_assert_finalize_object(person); |
| 41749 | 60 | } |
| 61 | ||
| 62 | static void | |
| 63 | test_purple_person_properties(void) { | |
|
42312
7d6f0b8b6e77
Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents:
42309
diff
changeset
|
64 | PurpleAvatar *avatar = NULL; |
|
7d6f0b8b6e77
Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents:
42309
diff
changeset
|
65 | PurpleAvatar *avatar1 = NULL; |
|
7d6f0b8b6e77
Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents:
42309
diff
changeset
|
66 | PurpleAvatar *avatar_for_display = NULL; |
| 41749 | 67 | PurpleContact *person = NULL; |
| 68 | PurpleTags *tags = NULL; | |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
69 | char *id = NULL; |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
70 | char *alias = NULL; |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
71 | char *color = NULL; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
72 | char *color_for_display = NULL; |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
73 | char *name_for_display = NULL; |
| 41749 | 74 | |
| 75 | /* Create our avatar for testing. */ | |
|
42312
7d6f0b8b6e77
Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents:
42309
diff
changeset
|
76 | avatar = g_object_new(PURPLE_TYPE_AVATAR, NULL); |
| 41749 | 77 | |
| 78 | /* Use g_object_new so we can test setting properties by name. All of them | |
| 79 | * call the setter methods, so by doing it this way we exercise more of the | |
| 80 | * code. | |
| 81 | */ | |
| 82 | person = g_object_new( | |
| 83 | PURPLE_TYPE_PERSON, | |
| 84 | "alias", "alias", | |
| 85 | "avatar", avatar, | |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
86 | "color", "#794a85", |
| 41749 | 87 | NULL); |
| 88 | ||
| 89 | /* Now use g_object_get to read all of the properties. */ | |
| 90 | g_object_get(person, | |
| 91 | "id", &id, | |
| 92 | "alias", &alias, | |
| 93 | "avatar", &avatar1, | |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
94 | "avatar-for-display", &avatar_for_display, |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
95 | "color", &color, |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
96 | "color-for-display", &color_for_display, |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
97 | "name-for-display", &name_for_display, |
| 41749 | 98 | "tags", &tags, |
| 99 | NULL); | |
| 100 | ||
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
101 | /* Test all the things. */ |
| 41749 | 102 | g_assert_nonnull(id); |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
103 | g_clear_pointer(&id, g_free); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
104 | |
| 41749 | 105 | g_assert_cmpstr(alias, ==, "alias"); |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
106 | g_clear_pointer(&alias, g_free); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
107 | |
| 41749 | 108 | g_assert_true(avatar1 == avatar); |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
109 | g_clear_object(&avatar1); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
110 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
111 | g_assert_true(avatar_for_display == avatar); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
112 | g_clear_object(&avatar_for_display); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
113 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
114 | g_assert_cmpstr(color, ==, "#794a85"); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
115 | g_clear_pointer(&color, g_free); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
116 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
117 | g_assert_cmpstr(color_for_display, ==, "#794a85"); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
118 | g_clear_pointer(&color_for_display, g_free); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
119 | |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
120 | g_assert_cmpstr(name_for_display, ==, "alias"); |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
121 | g_clear_pointer(&name_for_display, g_free); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
122 | |
| 41749 | 123 | g_assert_nonnull(tags); |
| 124 | g_clear_object(&tags); | |
| 125 | ||
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
126 | /* Additional cleanup. */ |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
127 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
128 | g_assert_finalize_object(avatar); |
| 41749 | 129 | } |
| 130 | ||
| 131 | static void | |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
132 | test_purple_person_avatar_for_display_person(void) { |
|
42312
7d6f0b8b6e77
Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents:
42309
diff
changeset
|
133 | PurpleAvatar *avatar = NULL; |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
134 | PurpleContactInfo *info = NULL; |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
135 | PurplePerson *person = NULL; |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
136 | guint called = 0; |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
137 | |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
138 | person = purple_person_new(); |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
139 | g_signal_connect(person, "notify::avatar", |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
140 | G_CALLBACK(test_purple_person_notify_cb), &called); |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
141 | g_signal_connect(person, "notify::avatar-for-display", |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
142 | G_CALLBACK(test_purple_person_notify_cb), &called); |
|
42312
7d6f0b8b6e77
Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents:
42309
diff
changeset
|
143 | avatar = g_object_new(PURPLE_TYPE_AVATAR, NULL); |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
144 | purple_person_set_avatar(person, avatar); |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
145 | g_assert_cmpuint(called, ==, 2); |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
146 | |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
147 | info = purple_contact_info_new("id"); |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
148 | purple_person_add_contact_info(person, info); |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
149 | |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
150 | /* Make sure the person's avatar is overriding the contact info. */ |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
151 | g_assert_true(purple_person_get_avatar_for_display(person) == avatar); |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
152 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
153 | /* Contact info's have a reference on the person, so the easiest way to |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
154 | * remove that is to remove them from the person. |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
155 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
156 | purple_person_remove_contact_info(person, info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
157 | |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
158 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
159 | g_assert_finalize_object(info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
160 | g_assert_finalize_object(avatar); |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
161 | } |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
162 | |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
163 | static void |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
164 | test_purple_person_avatar_for_display_contact(void) { |
|
42312
7d6f0b8b6e77
Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents:
42309
diff
changeset
|
165 | PurpleAvatar *avatar = NULL; |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
166 | PurpleContactInfo *info = NULL; |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
167 | PurplePerson *person = NULL; |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
168 | guint called = 0; |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
169 | |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
170 | person = purple_person_new(); |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
171 | g_signal_connect(person, "notify::avatar-for-display", |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
172 | G_CALLBACK(test_purple_person_notify_cb), &called); |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
173 | |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
174 | info = purple_contact_info_new("id"); |
|
42312
7d6f0b8b6e77
Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents:
42309
diff
changeset
|
175 | avatar = g_object_new(PURPLE_TYPE_AVATAR, NULL); |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
176 | purple_contact_info_set_avatar(info, avatar); |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
177 | purple_person_add_contact_info(person, info); |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
178 | |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
179 | g_assert_cmpuint(called, ==, 1); |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
180 | called = 0; |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
181 | |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
182 | /* Make sure the person's alias is overriding the contact info. */ |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
183 | g_assert_true(purple_person_get_avatar_for_display(person) == avatar); |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
184 | g_clear_object(&avatar); |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
185 | |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
186 | /* Now change the avatar on the contact info an verify that we not notified |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
187 | * of the property changing. |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
188 | */ |
|
42312
7d6f0b8b6e77
Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents:
42309
diff
changeset
|
189 | called = 0; |
|
7d6f0b8b6e77
Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents:
42309
diff
changeset
|
190 | avatar = g_object_new(PURPLE_TYPE_AVATAR, NULL); |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
191 | purple_contact_info_set_avatar(info, avatar); |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
192 | g_assert_cmpuint(called, ==, 1); |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
193 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
194 | /* Contact info's have a reference on the person, so the easiest way to |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
195 | * remove that is to remove them from the person. |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
196 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
197 | purple_person_remove_contact_info(person, info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
198 | |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
199 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
200 | g_assert_finalize_object(info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
201 | g_assert_finalize_object(avatar); |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
202 | } |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
203 | |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
204 | static void |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
205 | test_purple_person_color_for_display_person(void) { |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
206 | PurpleContactInfo *info = NULL; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
207 | PurplePerson *person = NULL; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
208 | const char *color = NULL; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
209 | guint color_called = 0; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
210 | guint color_for_display_called = 0; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
211 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
212 | person = purple_person_new(); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
213 | g_signal_connect(person, "notify::color", |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
214 | G_CALLBACK(test_purple_person_notify_cb), &color_called); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
215 | g_signal_connect(person, "notify::color-for-display", |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
216 | G_CALLBACK(test_purple_person_notify_cb), |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
217 | &color_for_display_called); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
218 | purple_person_set_color(person, "#abcdef"); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
219 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
220 | g_assert_cmpuint(color_called, ==, 1); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
221 | color_called = 0; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
222 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
223 | g_assert_cmpuint(color_for_display_called, ==, 1); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
224 | color_for_display_called = 0; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
225 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
226 | /* Make sure the person's color is overriding the contact info. */ |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
227 | info = purple_contact_info_new("id"); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
228 | purple_person_add_contact_info(person, info); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
229 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
230 | color = purple_person_get_color_for_display(person); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
231 | g_assert_cmpstr(color, ==, "#abcdef"); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
232 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
233 | g_assert_cmpuint(color_called, ==, 0); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
234 | g_assert_cmpuint(color_for_display_called, ==, 0); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
235 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
236 | /* Contact info's have a reference on the person, so the easiest way to |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
237 | * remove that is to remove them from the person. |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
238 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
239 | purple_person_remove_contact_info(person, info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
240 | |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
241 | /* Cleanup. */ |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
242 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
243 | g_assert_finalize_object(info); |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
244 | } |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
245 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
246 | static void |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
247 | test_purple_person_color_for_display_contact(void) { |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
248 | PurpleContactInfo *info = NULL; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
249 | PurplePerson *person = NULL; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
250 | const char *color = NULL; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
251 | guint called = 0; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
252 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
253 | person = purple_person_new(); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
254 | g_signal_connect(person, "notify::color-for-display", |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
255 | G_CALLBACK(test_purple_person_notify_cb), &called); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
256 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
257 | info = purple_contact_info_new("id"); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
258 | purple_contact_info_set_color(info, "#012345"); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
259 | purple_person_add_contact_info(person, info); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
260 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
261 | g_assert_cmpuint(called, ==, 1); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
262 | called = 0; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
263 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
264 | /* Make sure the person's alias is overriding the contact info. */ |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
265 | color = purple_person_get_color_for_display(person); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
266 | g_assert_cmpstr(color, ==, "#012345"); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
267 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
268 | /* Now change the avatar on the contact info and verify that we are |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
269 | * notified of the property changing. |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
270 | */ |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
271 | purple_contact_info_set_color(info, "#6789ab"); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
272 | g_assert_cmpuint(called, ==, 1); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
273 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
274 | /* Contact info's have a reference on the person, so the easiest way to |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
275 | * remove that is to remove them from the person. |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
276 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
277 | purple_person_remove_contact_info(person, info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
278 | |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
279 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
280 | g_assert_finalize_object(info); |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
281 | } |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
282 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
283 | static void |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
284 | test_purple_person_name_for_display_person(void) { |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
285 | PurpleContactInfo *info = NULL; |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
286 | PurplePerson *person = NULL; |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
287 | |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
288 | person = purple_person_new(); |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
289 | purple_person_set_alias(person, "person-alias"); |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
290 | |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
291 | info = purple_contact_info_new("id"); |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
292 | purple_person_add_contact_info(person, info); |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
293 | |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
294 | /* Make sure the person's alias is overriding the contact info. */ |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
295 | g_assert_cmpstr(purple_person_get_name_for_display(person), ==, |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
296 | "person-alias"); |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
297 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
298 | /* Contact info's have a reference on the person, so the easiest way to |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
299 | * remove that is to remove them from the person. |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
300 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
301 | purple_person_remove_contact_info(person, info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
302 | |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
303 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
304 | g_assert_finalize_object(info); |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
305 | } |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
306 | |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
307 | static void |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
308 | test_purple_person_name_for_display_contact(void) { |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
309 | PurpleContactInfo *info = NULL; |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
310 | PurplePerson *person = NULL; |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
311 | guint called = 0; |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
312 | |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
313 | person = purple_person_new(); |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
314 | g_signal_connect(person, "notify::name-for-display", |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
315 | G_CALLBACK(test_purple_person_notify_cb), &called); |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
316 | |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
317 | info = purple_contact_info_new("id"); |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
318 | purple_person_add_contact_info(person, info); |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
319 | g_assert_cmpuint(called, ==, 1); |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
320 | |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
321 | /* Make sure the name for display matches the id of the contact. */ |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
322 | g_assert_cmpstr(purple_person_get_name_for_display(person), ==, "id"); |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
323 | |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
324 | /* Now set a username on the contact and verify that the name for display |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
325 | * matches and that the notify signal was emitted for the property. |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
326 | */ |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
327 | purple_contact_info_set_username(info, "clu"); |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
328 | g_assert_cmpstr(purple_person_get_name_for_display(person), ==, "clu"); |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
329 | g_assert_cmpuint(called, ==, 2); |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
330 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
331 | /* Contact info's have a reference on the person, so the easiest way to |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
332 | * remove that is to remove them from the person. |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
333 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
334 | purple_person_remove_contact_info(person, info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
335 | |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
336 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
337 | g_assert_finalize_object(info); |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
338 | } |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
339 | |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
340 | static void |
| 41749 | 341 | test_purple_person_contacts_single(void) { |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
342 | PurpleContactInfo *info = NULL; |
| 41749 | 343 | PurplePerson *person = NULL; |
|
41761
9dc5d28fca99
When a Contact is added to a Person set the Contact's Person to that Person.
Gary Kramlich <grim@reaperworld.com>
parents:
41749
diff
changeset
|
344 | PurplePerson *person1 = NULL; |
| 41749 | 345 | guint n_items = 0; |
| 346 | gboolean removed = FALSE; | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
347 | guint changed = 0; |
| 41749 | 348 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
349 | info = purple_contact_info_new("id"); |
| 41749 | 350 | person = purple_person_new(); |
| 351 | g_signal_connect(person, "items-changed", | |
| 352 | G_CALLBACK(test_purple_person_items_changed_cb), &changed); | |
| 353 | ||
| 354 | n_items = g_list_model_get_n_items(G_LIST_MODEL(person)); | |
| 355 | g_assert_cmpuint(n_items, ==, 0); | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
356 | purple_person_add_contact_info(person, info); |
| 41749 | 357 | n_items = g_list_model_get_n_items(G_LIST_MODEL(person)); |
| 358 | g_assert_cmpuint(n_items, ==, 1); | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
359 | g_assert_cmpuint(changed, ==, 1); |
| 41749 | 360 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
361 | person1 = purple_contact_info_get_person(info); |
|
41761
9dc5d28fca99
When a Contact is added to a Person set the Contact's Person to that Person.
Gary Kramlich <grim@reaperworld.com>
parents:
41749
diff
changeset
|
362 | g_assert_true(person1 == person); |
|
9dc5d28fca99
When a Contact is added to a Person set the Contact's Person to that Person.
Gary Kramlich <grim@reaperworld.com>
parents:
41749
diff
changeset
|
363 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
364 | changed = 0; |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
365 | removed = purple_person_remove_contact_info(person, info); |
| 41749 | 366 | g_assert_true(removed); |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
367 | g_assert_cmpuint(changed, ==, 1); |
| 41749 | 368 | n_items = g_list_model_get_n_items(G_LIST_MODEL(person)); |
| 369 | g_assert_cmpuint(n_items, ==, 0); | |
| 370 | ||
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
371 | person1 = purple_contact_info_get_person(info); |
|
41761
9dc5d28fca99
When a Contact is added to a Person set the Contact's Person to that Person.
Gary Kramlich <grim@reaperworld.com>
parents:
41749
diff
changeset
|
372 | g_assert_null(person1); |
|
9dc5d28fca99
When a Contact is added to a Person set the Contact's Person to that Person.
Gary Kramlich <grim@reaperworld.com>
parents:
41749
diff
changeset
|
373 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
374 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
375 | g_assert_finalize_object(info); |
| 41749 | 376 | } |
| 377 | ||
| 378 | static void | |
| 379 | test_purple_person_contacts_multiple(void) { | |
| 380 | PurplePerson *person = NULL; | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
381 | GPtrArray *infos = NULL; |
| 41749 | 382 | guint n_items = 0; |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
383 | const int n_infos = 5; |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
384 | guint changed = 0; |
| 41749 | 385 | |
| 386 | person = purple_person_new(); | |
| 387 | g_signal_connect(person, "items-changed", | |
| 388 | G_CALLBACK(test_purple_person_items_changed_cb), &changed); | |
| 389 | ||
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
390 | infos = g_ptr_array_new_full(n_infos, g_object_unref); |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
391 | for(int i = 0; i < n_infos; i++) { |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
392 | PurpleContactInfo *info = NULL; |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
393 | char *username = NULL; |
| 41749 | 394 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
395 | changed = 0; |
| 41749 | 396 | |
| 397 | n_items = g_list_model_get_n_items(G_LIST_MODEL(person)); | |
| 398 | g_assert_cmpuint(n_items, ==, i); | |
| 399 | ||
| 400 | username = g_strdup_printf("username%d", i); | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
401 | info = purple_contact_info_new(NULL); |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
402 | purple_contact_info_set_username(info, username); |
| 41749 | 403 | g_free(username); |
| 404 | ||
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
405 | /* Add the contact info to the ptr array so we can remove it below. */ |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
406 | g_ptr_array_add(infos, info); |
| 41749 | 407 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
408 | /* Add the contact info to the person and make sure that all the magic |
| 41749 | 409 | * happened. |
| 410 | */ | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
411 | purple_person_add_contact_info(person, info); |
| 41749 | 412 | n_items = g_list_model_get_n_items(G_LIST_MODEL(person)); |
| 413 | g_assert_cmpuint(n_items, ==, i + 1); | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
414 | g_assert_cmpuint(changed, ==, 1); |
| 41749 | 415 | } |
| 416 | ||
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
417 | for(int i = 0; i < n_infos; i++) { |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
418 | PurpleContactInfo *info = g_ptr_array_index(infos, i); |
| 41749 | 419 | gboolean removed = FALSE; |
| 420 | ||
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
421 | changed = 0; |
| 41749 | 422 | |
| 423 | n_items = g_list_model_get_n_items(G_LIST_MODEL(person)); | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
424 | g_assert_cmpuint(n_items, ==, n_infos - i); |
| 41749 | 425 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
426 | removed = purple_person_remove_contact_info(person, info); |
| 41749 | 427 | g_assert_true(removed); |
| 428 | ||
| 429 | n_items = g_list_model_get_n_items(G_LIST_MODEL(person)); | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
430 | g_assert_cmpuint(n_items, ==, n_infos - (i + 1)); |
| 41749 | 431 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
432 | g_assert_cmpuint(changed, ==, 1); |
| 41749 | 433 | } |
| 434 | ||
| 435 | /* Final sanity check that the person has no more contacts. */ | |
| 436 | n_items = g_list_model_get_n_items(G_LIST_MODEL(person)); | |
| 437 | g_assert_cmpuint(n_items, ==, 0); | |
| 438 | ||
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
439 | g_ptr_array_free(infos, TRUE); |
| 41749 | 440 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
441 | g_assert_finalize_object(person); |
| 41749 | 442 | } |
| 443 | ||
| 444 | static void | |
| 445 | test_purple_person_priority_single(void) { | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
446 | PurpleContactInfo *info = NULL; |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
447 | PurpleContactInfo *priority = NULL; |
| 41749 | 448 | PurplePerson *person = NULL; |
| 449 | PurplePresence *presence = NULL; | |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
450 | guint called = 0; |
| 41749 | 451 | |
| 452 | person = purple_person_new(); | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
453 | g_signal_connect(person, "notify::priority-contact-info", |
| 41749 | 454 | G_CALLBACK(test_purple_person_notify_cb), &called); |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
455 | priority = purple_person_get_priority_contact_info(person); |
| 41749 | 456 | g_assert_null(priority); |
| 457 | ||
|
41771
c5877e2c93f2
Create and add PurpleContacts to the manager when purple_buddy_new is called
Gary Kramlich <grim@reaperworld.com>
parents:
41761
diff
changeset
|
458 | /* Now create a real contact. */ |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
459 | info = purple_contact_info_new(NULL); |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
460 | purple_person_add_contact_info(person, info); |
|
41771
c5877e2c93f2
Create and add PurpleContacts to the manager when purple_buddy_new is called
Gary Kramlich <grim@reaperworld.com>
parents:
41761
diff
changeset
|
461 | |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
462 | /* Set the presence of the contact. */ |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
463 | presence = purple_contact_info_get_presence(info); |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
464 | purple_presence_set_primitive(presence, |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
465 | PURPLE_PRESENCE_PRIMITIVE_AVAILABLE); |
| 41749 | 466 | |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
467 | g_assert_cmpuint(called, ==, 1); |
| 41749 | 468 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
469 | priority = purple_person_get_priority_contact_info(person); |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
470 | g_assert_true(priority == info); |
| 41749 | 471 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
472 | /* Contact info's have a reference on the person, so the easiest way to |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
473 | * remove that is to remove them from the person. |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
474 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
475 | purple_person_remove_contact_info(person, info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
476 | |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
477 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
478 | g_assert_finalize_object(info); |
| 41749 | 479 | } |
| 480 | ||
| 481 | static void | |
| 482 | test_purple_person_priority_multiple_with_change(void) { | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
483 | PurpleContactInfo *priority = NULL; |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
484 | PurpleContactInfo *first = NULL; |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
485 | PurpleContactInfo *sorted_contact = NULL; |
| 41749 | 486 | PurplePerson *person = NULL; |
| 487 | PurplePresence *sorted_presence = NULL; | |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
488 | guint called = 0; |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
489 | int n_infos = 5; |
| 41749 | 490 | guint n_items = 0; |
| 491 | ||
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
492 | /* This unit test is a bit complicated, but it adds 5 contact infos to a |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
493 | * person all whose presences are set to offline. After adding all the |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
494 | * contact infos, we verify that the first contact info we added is the |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
495 | * priority contact info. Then we flip the active status of the n_infos - 2 |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
496 | * infos to available. This should make it the priority contact info which |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
497 | * we then assert. |
| 41749 | 498 | */ |
| 499 | ||
| 500 | /* Create the person and connected to the notify signal for the | |
| 501 | * priority-contact property. | |
| 502 | */ | |
| 503 | person = purple_person_new(); | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
504 | g_signal_connect(person, "notify::priority-contact-info", |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
505 | G_CALLBACK(test_purple_person_notify_cb), &called); |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
506 | priority = purple_person_get_priority_contact_info(person); |
| 41749 | 507 | g_assert_null(priority); |
| 508 | ||
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
509 | /* Create and add all contact infos. */ |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
510 | for(int i = 0; i < n_infos; i++) { |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
511 | PurpleContactInfo *info = NULL; |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
512 | char *username = NULL; |
| 41749 | 513 | |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
514 | /* Set called to 0 as it shouldn't be called as the priority contact |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
515 | * info shouldn't change except for the first index. |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
516 | */ |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
517 | called = 0; |
| 41749 | 518 | |
| 519 | /* Now create a real contact. */ | |
| 520 | username = g_strdup_printf("username%d", i + 1); | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
521 | info = purple_contact_info_new(NULL); |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
522 | purple_contact_info_set_username(info, username); |
| 41749 | 523 | g_free(username); |
|
41771
c5877e2c93f2
Create and add PurpleContacts to the manager when purple_buddy_new is called
Gary Kramlich <grim@reaperworld.com>
parents:
41761
diff
changeset
|
524 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
525 | purple_person_add_contact_info(person, info); |
| 41749 | 526 | |
| 527 | if(i == 0) { | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
528 | first = g_object_ref(info); |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
529 | g_assert_cmpuint(called, ==, 1); |
| 41749 | 530 | } else { |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
531 | g_assert_cmpuint(called, ==, 0); |
| 41749 | 532 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
533 | if(i == n_infos - 2) { |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
534 | PurplePresence *presence = NULL; |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
535 | |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
536 | /* Add a reference to the presence of this specific contact |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
537 | * info, as we want to tweak it later. |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
538 | */ |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
539 | presence = purple_contact_info_get_presence(info); |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
540 | sorted_presence = g_object_ref(presence); |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
541 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
542 | sorted_contact = g_object_ref(info); |
| 41749 | 543 | } |
| 544 | } | |
| 545 | ||
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
546 | g_clear_object(&info); |
| 41749 | 547 | } |
| 548 | ||
| 549 | n_items = g_list_model_get_n_items(G_LIST_MODEL(person)); | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
550 | g_assert_cmpuint(n_items, ==, n_infos); |
| 41749 | 551 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
552 | priority = purple_person_get_priority_contact_info(person); |
| 41749 | 553 | g_assert_true(priority == first); |
| 554 | g_clear_object(&first); | |
| 555 | ||
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
556 | /* Now set the second from the last contact info's status to available, and |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
557 | * verify that that contact info is now the priority contact info. |
| 41749 | 558 | */ |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
559 | called = 0; |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
560 | purple_presence_set_primitive(sorted_presence, |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
561 | PURPLE_PRESENCE_PRIMITIVE_AVAILABLE); |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
562 | priority = purple_person_get_priority_contact_info(person); |
| 41749 | 563 | g_assert_true(priority == sorted_contact); |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
564 | g_assert_cmpuint(called, ==, 1); |
| 41749 | 565 | |
| 566 | /* Cleanup. */ | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
567 | purple_person_remove_all_contact_infos(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
568 | |
| 41749 | 569 | g_clear_object(&sorted_contact); |
| 570 | g_clear_object(&sorted_presence); | |
| 571 | ||
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
572 | g_assert_finalize_object(person); |
| 41749 | 573 | } |
| 574 | ||
| 575 | /****************************************************************************** | |
|
42059
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
576 | * Matches tests |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
577 | *****************************************************************************/ |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
578 | static void |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
579 | test_purple_person_matches_accepts_null(void) { |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
580 | PurplePerson *person = purple_person_new(); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
581 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
582 | g_assert_true(purple_person_matches(person, NULL)); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
583 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
584 | g_assert_finalize_object(person); |
|
42059
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
585 | } |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
586 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
587 | static void |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
588 | test_purple_person_matches_empty_string(void) { |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
589 | PurplePerson *person = purple_person_new(); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
590 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
591 | g_assert_true(purple_person_matches(person, "")); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
592 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
593 | g_assert_finalize_object(person); |
|
42059
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
594 | } |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
595 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
596 | static void |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
597 | test_purple_person_matches_alias(void) { |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
598 | PurplePerson *person = purple_person_new(); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
599 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
600 | purple_person_set_alias(person, "this is the alias"); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
601 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
602 | g_assert_true(purple_person_matches(person, "the")); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
603 | g_assert_false(purple_person_matches(person, "what")); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
604 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
605 | g_assert_finalize_object(person); |
|
42059
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
606 | } |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
607 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
608 | static void |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
609 | test_purple_person_matches_contact_info(void) { |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
610 | PurplePerson *person = purple_person_new(); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
611 | PurpleContactInfo *info = purple_contact_info_new(NULL); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
612 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
613 | purple_contact_info_set_username(info, "user1"); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
614 | purple_person_add_contact_info(person, info); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
615 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
616 | g_assert_true(purple_person_matches(person, "user1")); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
617 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
618 | /* Contact info's have a reference on the person, so the easiest way to |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
619 | * remove that is to remove them from the person. |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
620 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
621 | purple_person_remove_contact_info(person, info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
622 | |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
623 | g_assert_finalize_object(person); |
|
42059
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
624 | } |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
625 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
626 | /****************************************************************************** |
| 41749 | 627 | * Main |
| 628 | *****************************************************************************/ | |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
629 | int |
|
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
630 | main(int argc, char *argv[]) { |
| 41749 | 631 | g_test_init(&argc, &argv, NULL); |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
632 | g_test_set_nonfatal_assertions(); |
| 41749 | 633 | |
| 634 | g_test_add_func("/person/new", | |
| 635 | test_purple_person_new); | |
| 636 | g_test_add_func("/person/properties", | |
| 637 | test_purple_person_properties); | |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
638 | |
|
42054
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
639 | g_test_add_func("/person/avatar-for-display/person", |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
640 | test_purple_person_avatar_for_display_person); |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
641 | g_test_add_func("/person/avatar-for-display/contact", |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
642 | test_purple_person_avatar_for_display_contact); |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
643 | |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
644 | g_test_add_func("/person/color-for-display/person", |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
645 | test_purple_person_color_for_display_person); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
646 | g_test_add_func("/person/color-for-display/contact", |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
647 | test_purple_person_color_for_display_contact); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
648 | |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
649 | g_test_add_func("/person/name-for-display/person", |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
650 | test_purple_person_name_for_display_person); |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
651 | g_test_add_func("/person/name-for-display/contact", |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
652 | test_purple_person_name_for_display_contact); |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
653 | |
| 41749 | 654 | g_test_add_func("/person/contacts/single", |
| 655 | test_purple_person_contacts_single); | |
| 656 | g_test_add_func("/person/contacts/multiple", | |
| 657 | test_purple_person_contacts_multiple); | |
| 658 | ||
| 659 | g_test_add_func("/person/priority/single", | |
| 660 | test_purple_person_priority_single); | |
| 661 | g_test_add_func("/person/priority/multiple-with-change", | |
| 662 | test_purple_person_priority_multiple_with_change); | |
| 663 | ||
|
42059
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
664 | g_test_add_func("/person/matches/accepts_null", |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
665 | test_purple_person_matches_accepts_null); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
666 | g_test_add_func("/person/matches/empty_string", |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
667 | test_purple_person_matches_empty_string); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
668 | g_test_add_func("/person/matches/alias", |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
669 | test_purple_person_matches_alias); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
670 | g_test_add_func("/person/matches/contact_info", |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
671 | test_purple_person_matches_contact_info); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
672 | |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
673 | return g_test_run(); |
|
42059
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
674 | } |