Thu, 07 Aug 2025 21:34:33 -0500
Replace Purple.Avatar with Purple.Image
Purple.Avatar was unnecessary and this just moves everything to Purple.Image
which should work just fine.
Testing Done:
Loaded a demo account and verified that the avatars were shown in the contact list properly. Also called in the turtles.
Reviewed at https://reviews.imfreedom.org/r/4084/
| 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 | ||
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
21 | #include <birb.h> |
| 41749 | 22 | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
23 | #include <purple.h> |
| 41749 | 24 | |
| 25 | /****************************************************************************** | |
| 26 | * Tests | |
| 27 | *****************************************************************************/ | |
| 28 | static void | |
| 29 | test_purple_person_new(void) { | |
| 30 | PurplePerson *person = NULL; | |
| 31 | ||
| 32 | person = purple_person_new(); | |
| 33 | ||
| 34 | g_assert_true(PURPLE_IS_PERSON(person)); | |
| 35 | ||
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
36 | g_assert_finalize_object(person); |
| 41749 | 37 | } |
| 38 | ||
| 39 | static void | |
| 40 | test_purple_person_properties(void) { | |
|
43301
0e43dc8462e8
Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents:
43265
diff
changeset
|
41 | PurpleImage *avatar = NULL; |
|
0e43dc8462e8
Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents:
43265
diff
changeset
|
42 | PurpleImage *avatar1 = NULL; |
|
0e43dc8462e8
Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents:
43265
diff
changeset
|
43 | PurpleImage *avatar_for_display = NULL; |
| 41749 | 44 | PurpleContact *person = NULL; |
| 45 | PurpleTags *tags = NULL; | |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
46 | char *id = NULL; |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
47 | char *alias = NULL; |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
48 | char *color = NULL; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
49 | char *color_for_display = NULL; |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
50 | char *name_for_display = NULL; |
| 41749 | 51 | |
| 52 | /* Create our avatar for testing. */ | |
|
43301
0e43dc8462e8
Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents:
43265
diff
changeset
|
53 | avatar = g_object_new(PURPLE_TYPE_IMAGE, NULL); |
| 41749 | 54 | |
| 55 | /* Use g_object_new so we can test setting properties by name. All of them | |
| 56 | * call the setter methods, so by doing it this way we exercise more of the | |
| 57 | * code. | |
| 58 | */ | |
| 59 | person = g_object_new( | |
| 60 | PURPLE_TYPE_PERSON, | |
| 61 | "alias", "alias", | |
| 62 | "avatar", avatar, | |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
63 | "color", "#794a85", |
| 41749 | 64 | NULL); |
| 65 | ||
| 66 | /* Now use g_object_get to read all of the properties. */ | |
| 67 | g_object_get(person, | |
| 68 | "id", &id, | |
| 69 | "alias", &alias, | |
| 70 | "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
|
71 | "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
|
72 | "color", &color, |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
73 | "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
|
74 | "name-for-display", &name_for_display, |
| 41749 | 75 | "tags", &tags, |
| 76 | NULL); | |
| 77 | ||
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
78 | /* Test all the things. */ |
| 41749 | 79 | g_assert_nonnull(id); |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
80 | 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
|
81 | |
| 41749 | 82 | 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
|
83 | 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
|
84 | |
| 41749 | 85 | 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
|
86 | g_clear_object(&avatar1); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
87 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
88 | 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
|
89 | 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
|
90 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
91 | g_assert_cmpstr(color, ==, "#794a85"); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
92 | 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
|
93 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
94 | 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
|
95 | 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
|
96 | |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
97 | 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
|
98 | 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
|
99 | |
| 41749 | 100 | g_assert_nonnull(tags); |
| 101 | g_clear_object(&tags); | |
| 102 | ||
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
103 | /* Additional cleanup. */ |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
104 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
105 | g_assert_finalize_object(avatar); |
| 41749 | 106 | } |
| 107 | ||
| 108 | 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
|
109 | test_purple_person_avatar_for_display_person(void) { |
|
43301
0e43dc8462e8
Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents:
43265
diff
changeset
|
110 | PurpleImage *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
|
111 | 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
|
112 | PurplePerson *person = NULL; |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
113 | guint avatar_counter = 0; |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
114 | guint avatar_for_display_counter = 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
|
115 | |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
116 | person = purple_person_new(); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
117 | birb_count_property_changed(G_OBJECT(person), "avatar", &avatar_counter); |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
118 | birb_count_property_changed(G_OBJECT(person), "avatar-for-display", |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
119 | &avatar_for_display_counter); |
|
43301
0e43dc8462e8
Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents:
43265
diff
changeset
|
120 | avatar = g_object_new(PURPLE_TYPE_IMAGE, 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
|
121 | purple_person_set_avatar(person, avatar); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
122 | g_assert_cmpuint(avatar_counter, ==, 1); |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
123 | g_assert_cmpuint(avatar_for_display_counter, ==, 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
|
124 | |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
125 | 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
|
126 | 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
|
127 | |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
128 | /* 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
|
129 | 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
|
130 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
131 | /* 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
|
132 | * 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
|
133 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
134 | purple_person_remove_contact_info(person, info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
135 | |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
136 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
137 | g_assert_finalize_object(info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
138 | 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
|
139 | } |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
140 | |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
141 | 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
|
142 | test_purple_person_avatar_for_display_contact(void) { |
|
43301
0e43dc8462e8
Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents:
43265
diff
changeset
|
143 | PurpleImage *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 | 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
|
145 | PurplePerson *person = NULL; |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
146 | guint counter = 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
|
147 | |
|
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 | person = purple_person_new(); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
149 | birb_count_property_changed(G_OBJECT(person), "avatar-for-display", |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
150 | &counter); |
|
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 | |
|
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 | info = purple_contact_info_new("id"); |
|
43301
0e43dc8462e8
Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents:
43265
diff
changeset
|
153 | avatar = g_object_new(PURPLE_TYPE_IMAGE, 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
|
154 | 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
|
155 | 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
|
156 | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
157 | g_assert_cmpuint(counter, ==, 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
|
158 | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
159 | /* 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
|
160 | 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
|
161 | g_clear_object(&avatar); |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
162 | |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
163 | /* 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
|
164 | * of the property changing. |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
165 | */ |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
166 | counter = 0; |
|
43301
0e43dc8462e8
Replace Purple.Avatar with Purple.Image
Gary Kramlich <grim@reaperworld.com>
parents:
43265
diff
changeset
|
167 | avatar = g_object_new(PURPLE_TYPE_IMAGE, NULL); |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
168 | purple_contact_info_set_avatar(info, avatar); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
169 | g_assert_cmpuint(counter, ==, 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
|
170 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
171 | /* 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
|
172 | * 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
|
173 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
174 | purple_person_remove_contact_info(person, info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
175 | |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
176 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
177 | g_assert_finalize_object(info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
178 | 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
|
179 | } |
|
7aa77854392d
Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42053
diff
changeset
|
180 | |
|
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 | static void |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
182 | 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
|
183 | PurpleContactInfo *info = NULL; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
184 | PurplePerson *person = NULL; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
185 | const char *color = NULL; |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
186 | guint color_counter = 0; |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
187 | guint color_for_display_counter = 0; |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
188 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
189 | person = purple_person_new(); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
190 | birb_count_property_changed(G_OBJECT(person), "color", &color_counter); |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
191 | birb_count_property_changed(G_OBJECT(person), "color-for-display", |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
192 | &color_for_display_counter); |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
193 | 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
|
194 | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
195 | g_assert_cmpuint(color_counter, ==, 1); |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
196 | g_assert_cmpuint(color_for_display_counter, ==, 1); |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
197 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
198 | /* Make sure the person's color is overriding the contact info. */ |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
199 | color_counter = 0; |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
200 | color_for_display_counter = 0; |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
201 | 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
|
202 | 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
|
203 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
204 | 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
|
205 | g_assert_cmpstr(color, ==, "#abcdef"); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
206 | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
207 | g_assert_cmpuint(color_counter, ==, 0); |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
208 | g_assert_cmpuint(color_for_display_counter, ==, 0); |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
209 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
210 | /* 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
|
211 | * 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
|
212 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
213 | purple_person_remove_contact_info(person, info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
214 | |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
215 | /* Cleanup. */ |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
216 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
217 | 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
|
218 | } |
|
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 | static void |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
221 | 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
|
222 | PurpleContactInfo *info = NULL; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
223 | PurplePerson *person = NULL; |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
224 | const char *color = NULL; |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
225 | guint counter = 0; |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
226 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
227 | person = purple_person_new(); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
228 | birb_count_property_changed(G_OBJECT(person), "color-for-display", |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
229 | &counter); |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
230 | |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
231 | 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
|
232 | 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
|
233 | 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
|
234 | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
235 | g_assert_cmpuint(counter, ==, 1); |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
236 | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
237 | /* Make sure the person's color is overriding the contact info. */ |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
238 | 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
|
239 | g_assert_cmpstr(color, ==, "#012345"); |
|
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
240 | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
241 | /* Now change the color on the contact info and verify that we are notified |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
242 | * of the property changing. |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
243 | */ |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
244 | counter = 0; |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
245 | purple_contact_info_set_color(info, "#6789ab"); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
246 | g_assert_cmpuint(counter, ==, 1); |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
247 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
248 | /* 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
|
249 | * 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
|
250 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
251 | purple_person_remove_contact_info(person, info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
252 | |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
253 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
254 | 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
|
255 | } |
|
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 | static void |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
258 | 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
|
259 | PurpleContactInfo *info = NULL; |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
260 | PurplePerson *person = NULL; |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
261 | |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
262 | person = purple_person_new(); |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
263 | 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
|
264 | |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
265 | info = purple_contact_info_new("id"); |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
266 | 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
|
267 | |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
268 | /* 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
|
269 | 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
|
270 | "person-alias"); |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
271 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
272 | /* 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
|
273 | * 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
|
274 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
275 | purple_person_remove_contact_info(person, info); |
|
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 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
278 | g_assert_finalize_object(info); |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
279 | } |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
280 | |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
281 | static void |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
282 | 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
|
283 | PurpleContactInfo *info = NULL; |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
284 | PurplePerson *person = NULL; |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
285 | guint counter = 0; |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
286 | |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
287 | person = purple_person_new(); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
288 | birb_count_property_changed(G_OBJECT(person), "name-for-display", |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
289 | &counter); |
|
42053
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); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
293 | g_assert_cmpuint(counter, ==, 1); |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
294 | |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
295 | /* 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
|
296 | 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
|
297 | |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
298 | /* 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
|
299 | * 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
|
300 | */ |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
301 | counter = 0; |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
302 | 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
|
303 | g_assert_cmpstr(purple_person_get_name_for_display(person), ==, "clu"); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
304 | g_assert_cmpuint(counter, ==, 1); |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
305 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
306 | /* 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
|
307 | * 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
|
308 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
309 | purple_person_remove_contact_info(person, info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
310 | |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
311 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
312 | g_assert_finalize_object(info); |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
313 | } |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
314 | |
|
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
315 | static void |
| 41749 | 316 | test_purple_person_contacts_single(void) { |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
317 | PurpleContactInfo *info = NULL; |
| 41749 | 318 | 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
|
319 | PurplePerson *person1 = NULL; |
| 41749 | 320 | gboolean removed = FALSE; |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
321 | guint counter = 0; |
| 41749 | 322 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
323 | info = purple_contact_info_new("id"); |
| 41749 | 324 | person = purple_person_new(); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
325 | birb_count_list_model_items_changed(G_LIST_MODEL(person), &counter); |
| 41749 | 326 | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
327 | birb_assert_list_model_n_items(person, 0); |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
328 | purple_person_add_contact_info(person, info); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
329 | birb_assert_list_model_n_items(person, 1); |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
330 | g_assert_cmpuint(counter, ==, 1); |
| 41749 | 331 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
332 | 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
|
333 | 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
|
334 | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
335 | counter = 0; |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
336 | removed = purple_person_remove_contact_info(person, info); |
| 41749 | 337 | g_assert_true(removed); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
338 | g_assert_cmpuint(counter, ==, 1); |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
339 | birb_assert_list_model_n_items(person, 0); |
| 41749 | 340 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
341 | 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
|
342 | 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
|
343 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
344 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
345 | g_assert_finalize_object(info); |
| 41749 | 346 | } |
| 347 | ||
| 348 | static void | |
| 349 | test_purple_person_contacts_multiple(void) { | |
| 350 | PurplePerson *person = NULL; | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
351 | GPtrArray *infos = NULL; |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
352 | const int n_infos = 5; |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
353 | guint counter = 0; |
| 41749 | 354 | |
| 355 | person = purple_person_new(); | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
356 | birb_count_list_model_items_changed(G_LIST_MODEL(person), &counter); |
| 41749 | 357 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
358 | 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
|
359 | for(int i = 0; i < n_infos; i++) { |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
360 | PurpleContactInfo *info = NULL; |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
361 | char *username = NULL; |
| 41749 | 362 | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
363 | counter = 0; |
| 41749 | 364 | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
365 | birb_assert_list_model_n_items(person, i); |
| 41749 | 366 | |
| 367 | username = g_strdup_printf("username%d", i); | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
368 | info = purple_contact_info_new(NULL); |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
369 | purple_contact_info_set_username(info, username); |
| 41749 | 370 | g_free(username); |
| 371 | ||
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
372 | /* 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
|
373 | g_ptr_array_add(infos, info); |
| 41749 | 374 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
375 | /* Add the contact info to the person and make sure that all the magic |
| 41749 | 376 | * happened. |
| 377 | */ | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
378 | purple_person_add_contact_info(person, info); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
379 | birb_assert_list_model_n_items(person, i + 1); |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
380 | g_assert_cmpuint(counter, ==, 1); |
| 41749 | 381 | } |
| 382 | ||
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
383 | for(int i = 0; i < n_infos; i++) { |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
384 | PurpleContactInfo *info = g_ptr_array_index(infos, i); |
| 41749 | 385 | gboolean removed = FALSE; |
| 386 | ||
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
387 | counter = 0; |
| 41749 | 388 | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
389 | birb_assert_list_model_n_items(person, n_infos - i); |
| 41749 | 390 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
391 | removed = purple_person_remove_contact_info(person, info); |
| 41749 | 392 | g_assert_true(removed); |
| 393 | ||
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
394 | birb_assert_list_model_n_items(person, n_infos - (i + 1)); |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
395 | g_assert_cmpuint(counter, ==, 1); |
| 41749 | 396 | } |
| 397 | ||
| 398 | /* Final sanity check that the person has no more contacts. */ | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
399 | birb_assert_list_model_n_items(person, 0); |
| 41749 | 400 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
401 | g_ptr_array_free(infos, TRUE); |
| 41749 | 402 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
403 | g_assert_finalize_object(person); |
| 41749 | 404 | } |
| 405 | ||
| 406 | static void | |
| 407 | test_purple_person_priority_single(void) { | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
408 | PurpleContactInfo *info = NULL; |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
409 | PurpleContactInfo *priority = NULL; |
| 41749 | 410 | PurplePerson *person = NULL; |
| 411 | PurplePresence *presence = NULL; | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
412 | guint counter = 0; |
| 41749 | 413 | |
| 414 | person = purple_person_new(); | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
415 | birb_count_property_changed(G_OBJECT(person), "priority-contact-info", |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
416 | &counter); |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
417 | priority = purple_person_get_priority_contact_info(person); |
| 41749 | 418 | g_assert_null(priority); |
| 419 | ||
|
41771
c5877e2c93f2
Create and add PurpleContacts to the manager when purple_buddy_new is called
Gary Kramlich <grim@reaperworld.com>
parents:
41761
diff
changeset
|
420 | /* Now create a real contact. */ |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
421 | info = purple_contact_info_new(NULL); |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
422 | 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
|
423 | |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
424 | /* Set the presence of the contact. */ |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
425 | 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
|
426 | 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
|
427 | PURPLE_PRESENCE_PRIMITIVE_AVAILABLE); |
| 41749 | 428 | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
429 | g_assert_cmpuint(counter, ==, 1); |
| 41749 | 430 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
431 | priority = purple_person_get_priority_contact_info(person); |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
432 | g_assert_true(priority == info); |
| 41749 | 433 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
434 | /* 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
|
435 | * 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
|
436 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
437 | purple_person_remove_contact_info(person, info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
438 | |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
439 | g_assert_finalize_object(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
440 | g_assert_finalize_object(info); |
| 41749 | 441 | } |
| 442 | ||
| 443 | static void | |
| 444 | test_purple_person_priority_multiple_with_change(void) { | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
445 | PurpleContactInfo *priority = NULL; |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
446 | PurpleContactInfo *first = NULL; |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
447 | PurpleContactInfo *sorted_contact = NULL; |
| 41749 | 448 | PurplePerson *person = NULL; |
| 449 | PurplePresence *sorted_presence = NULL; | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
450 | guint counter = 0; |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
451 | int n_infos = 5; |
| 41749 | 452 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
453 | /* 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
|
454 | * 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
|
455 | * 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
|
456 | * 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
|
457 | * 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
|
458 | * we then assert. |
| 41749 | 459 | */ |
| 460 | ||
| 461 | /* Create the person and connected to the notify signal for the | |
| 462 | * priority-contact property. | |
| 463 | */ | |
| 464 | person = purple_person_new(); | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
465 | birb_count_property_changed(G_OBJECT(person), "priority-contact-info", |
|
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
466 | &counter); |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
467 | priority = purple_person_get_priority_contact_info(person); |
| 41749 | 468 | g_assert_null(priority); |
| 469 | ||
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
470 | /* Create and add all contact infos. */ |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
471 | for(int i = 0; i < n_infos; i++) { |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
472 | PurpleContactInfo *info = NULL; |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
473 | char *username = NULL; |
| 41749 | 474 | |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
475 | /* Set counter to 0 as it shouldn't be called as the priority contact |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
476 | * 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
|
477 | */ |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
478 | counter = 0; |
| 41749 | 479 | |
| 480 | /* Now create a real contact. */ | |
| 481 | username = g_strdup_printf("username%d", i + 1); | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
482 | info = purple_contact_info_new(NULL); |
|
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
483 | purple_contact_info_set_username(info, username); |
| 41749 | 484 | 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
|
485 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
486 | purple_person_add_contact_info(person, info); |
| 41749 | 487 | |
| 488 | if(i == 0) { | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
489 | first = g_object_ref(info); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
490 | g_assert_cmpuint(counter, ==, 1); |
| 41749 | 491 | } else { |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
492 | g_assert_cmpuint(counter, ==, 0); |
| 41749 | 493 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
494 | 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
|
495 | PurplePresence *presence = NULL; |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
496 | |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
497 | /* 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
|
498 | * 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
|
499 | */ |
|
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
500 | 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
|
501 | 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
|
502 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
503 | sorted_contact = g_object_ref(info); |
| 41749 | 504 | } |
| 505 | } | |
| 506 | ||
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
507 | g_clear_object(&info); |
| 41749 | 508 | } |
| 509 | ||
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
510 | birb_assert_list_model_n_items(person, n_infos); |
| 41749 | 511 | |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
512 | priority = purple_person_get_priority_contact_info(person); |
| 41749 | 513 | g_assert_true(priority == first); |
| 514 | g_clear_object(&first); | |
| 515 | ||
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
516 | /* 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
|
517 | * verify that that contact info is now the priority contact info. |
| 41749 | 518 | */ |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
519 | counter = 0; |
|
42270
1bdd57a0c0d1
Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
520 | 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
|
521 | PURPLE_PRESENCE_PRIMITIVE_AVAILABLE); |
|
41948
6d844d2faff1
Split PurpleContactInfo out of PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
522 | priority = purple_person_get_priority_contact_info(person); |
| 41749 | 523 | g_assert_true(priority == sorted_contact); |
|
43265
7960b5f85729
Update to birb 0.4 and use the testing helpers in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
43171
diff
changeset
|
524 | g_assert_cmpuint(counter, ==, 1); |
| 41749 | 525 | |
| 526 | /* Cleanup. */ | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
527 | purple_person_remove_all_contact_infos(person); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
528 | |
| 41749 | 529 | g_clear_object(&sorted_contact); |
| 530 | g_clear_object(&sorted_presence); | |
| 531 | ||
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
532 | g_assert_finalize_object(person); |
| 41749 | 533 | } |
| 534 | ||
| 535 | /****************************************************************************** | |
|
42059
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
536 | * Matches tests |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
537 | *****************************************************************************/ |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
538 | static void |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
539 | test_purple_person_matches_accepts_null(void) { |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
540 | PurplePerson *person = purple_person_new(); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
541 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
542 | 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
|
543 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
544 | g_assert_finalize_object(person); |
|
42059
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
545 | } |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
546 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
547 | static void |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
548 | test_purple_person_matches_empty_string(void) { |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
549 | PurplePerson *person = purple_person_new(); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
550 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
551 | g_assert_true(purple_person_matches(person, "")); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
552 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
553 | g_assert_finalize_object(person); |
|
42059
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
554 | } |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
555 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
556 | static void |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
557 | test_purple_person_matches_alias(void) { |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
558 | PurplePerson *person = purple_person_new(); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
559 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
560 | 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
|
561 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
562 | 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
|
563 | 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
|
564 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
565 | g_assert_finalize_object(person); |
|
42059
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
566 | } |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
567 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
568 | static void |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
569 | test_purple_person_matches_contact_info(void) { |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
570 | PurplePerson *person = purple_person_new(); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
571 | PurpleContactInfo *info = purple_contact_info_new(NULL); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
572 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
573 | purple_contact_info_set_username(info, "user1"); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
574 | purple_person_add_contact_info(person, info); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
575 | |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
576 | 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
|
577 | |
|
43171
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
578 | /* 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
|
579 | * 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
|
580 | */ |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
581 | purple_person_remove_contact_info(person, info); |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
582 | |
|
914049a55a72
Update the tests for Purple.Person
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
583 | g_assert_finalize_object(person); |
|
42059
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
584 | } |
|
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 | /****************************************************************************** |
| 41749 | 587 | * Main |
| 588 | *****************************************************************************/ | |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
589 | int |
|
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
590 | main(int argc, char *argv[]) { |
| 41749 | 591 | g_test_init(&argc, &argv, NULL); |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
592 | g_test_set_nonfatal_assertions(); |
| 41749 | 593 | |
| 594 | g_test_add_func("/person/new", | |
| 595 | test_purple_person_new); | |
| 596 | g_test_add_func("/person/properties", | |
| 597 | test_purple_person_properties); | |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
598 | |
|
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
|
599 | 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
|
600 | 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
|
601 | 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
|
602 | 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
|
603 | |
|
42309
52571584c0ae
Add color and color-for-display properties to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
42270
diff
changeset
|
604 | 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
|
605 | 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
|
606 | 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
|
607 | 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
|
608 | |
|
42053
742efe62e610
Add a name-for-display property to PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents:
41948
diff
changeset
|
609 | 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
|
610 | 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
|
611 | 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
|
612 | 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
|
613 | |
| 41749 | 614 | g_test_add_func("/person/contacts/single", |
| 615 | test_purple_person_contacts_single); | |
| 616 | g_test_add_func("/person/contacts/multiple", | |
| 617 | test_purple_person_contacts_multiple); | |
| 618 | ||
| 619 | g_test_add_func("/person/priority/single", | |
| 620 | test_purple_person_priority_single); | |
| 621 | g_test_add_func("/person/priority/multiple-with-change", | |
| 622 | test_purple_person_priority_multiple_with_change); | |
| 623 | ||
|
42059
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
624 | 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
|
625 | test_purple_person_matches_accepts_null); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
626 | 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
|
627 | test_purple_person_matches_empty_string); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
628 | g_test_add_func("/person/matches/alias", |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
629 | test_purple_person_matches_alias); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
630 | 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
|
631 | test_purple_person_matches_contact_info); |
|
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
632 | |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42312
diff
changeset
|
633 | return g_test_run(); |
|
42059
e6dcbf0db616
Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents:
42054
diff
changeset
|
634 | } |