Tue, 27 Aug 2024 00:01:29 -0500
Add a logging property to Purple.Conversation
This property is used to determine whether or not we are logging messages.
It's setup in a way to mimic the way log toggling works in Google Chat so that
can be replicated, but our users may want to ignore that in the future.
Testing Done:
Ran the conversation tests under valgrind and let the turtles handle the rest.
Reviewed at https://reviews.imfreedom.org/r/3441/
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This library is free software; you can redistribute it and/or |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * modify it under the terms of the GNU Lesser General Public |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * License as published by the Free Software Foundation; either |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * version 2 of the License, or (at your option) any later version. |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This library is distributed in the hope that it will be useful, |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * Lesser General Public License for more details. |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU Lesser General Public |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * License along with this library; if not, see <https://www.gnu.org/licenses/>. |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #include <glib.h> |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | #include <purple.h> |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include "test_ui.h" |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | /****************************************************************************** |
|
42773
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
26 | * Callbacks |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
27 | *****************************************************************************/ |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
28 | static void |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
29 | test_purple_conversation_notify_counter_cb(GObject *obj, |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
30 | G_GNUC_UNUSED GParamSpec *pspec, |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
31 | gpointer data) |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
32 | { |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
33 | guint *counter = data; |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
34 | |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
35 | g_assert_true(PURPLE_IS_CONVERSATION(obj)); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
36 | |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
37 | *counter = *counter + 1; |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
38 | } |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
39 | |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
40 | /****************************************************************************** |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | * Tests |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | *****************************************************************************/ |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | static void |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | test_purple_conversation_properties(void) { |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | PurpleAccount *account = NULL; |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | PurpleAccount *account1 = NULL; |
|
42355
6f7c6b84aaa0
Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42316
diff
changeset
|
47 | PurpleAvatar *avatar = NULL; |
|
6f7c6b84aaa0
Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42316
diff
changeset
|
48 | PurpleAvatar *avatar1 = NULL; |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
49 | PurpleContactInfo *creator = NULL; |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
50 | PurpleContactInfo *creator1 = NULL; |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
51 | PurpleContactInfo *topic_author = NULL; |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
52 | PurpleContactInfo *topic_author1 = NULL; |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | PurpleConversation *conversation = NULL; |
|
42653
584895b844d2
PurpleConversationType's values were pascal case when they should be upper snake case
Gary Kramlich <grim@reaperworld.com>
parents:
42535
diff
changeset
|
54 | PurpleConversationType type = PURPLE_CONVERSATION_TYPE_UNSET; |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
55 | PurpleTags *tags = NULL; |
|
42884
5a7d425c9d1b
Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents:
42857
diff
changeset
|
56 | PurpleTypingState typing_state; |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
57 | GDateTime *created_on = NULL; |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
58 | GDateTime *created_on1 = NULL; |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
59 | GDateTime *topic_updated = NULL; |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
60 | GDateTime *topic_updated1 = NULL; |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | GListModel *members = NULL; |
|
42773
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
62 | char *alias = NULL; |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
63 | char *description = NULL; |
|
42800
5c55680a1a6b
Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents:
42773
diff
changeset
|
64 | char *global_id = NULL; |
|
42272
015257326ad4
Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
65 | char *id = NULL; |
|
015257326ad4
Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
66 | char *name = NULL; |
|
42760
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
67 | char *title = NULL; |
|
42773
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
68 | char *title_for_display = NULL; |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
69 | char *topic = NULL; |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
70 | char *user_nickname = NULL; |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
71 | gboolean age_restricted = FALSE; |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
72 | gboolean favorite = FALSE; |
|
42848
f9a04b0bed1f
Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42823
diff
changeset
|
73 | gboolean needs_attention = FALSE; |
|
42908
64bbb9d4bf94
Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents:
42901
diff
changeset
|
74 | gboolean logging = FALSE; |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | |
|
42800
5c55680a1a6b
Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents:
42773
diff
changeset
|
76 | account = g_object_new( |
|
5c55680a1a6b
Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents:
42773
diff
changeset
|
77 | PURPLE_TYPE_ACCOUNT, |
|
5c55680a1a6b
Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents:
42773
diff
changeset
|
78 | "id", "test", |
|
5c55680a1a6b
Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents:
42773
diff
changeset
|
79 | "protocol-id", "test", |
|
5c55680a1a6b
Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents:
42773
diff
changeset
|
80 | NULL); |
|
5c55680a1a6b
Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents:
42773
diff
changeset
|
81 | |
|
42355
6f7c6b84aaa0
Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42316
diff
changeset
|
82 | avatar = g_object_new(PURPLE_TYPE_AVATAR, NULL); |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
83 | creator = purple_contact_info_new(NULL); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
84 | created_on = g_date_time_new_now_utc(); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
85 | topic_author = purple_contact_info_new(NULL); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
86 | topic_updated = g_date_time_new_now_utc(); |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | /* Use g_object_new so we can test setting properties by name. All of them |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | * call the setter methods, so by doing it this way we exercise more of the |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | * code. |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | */ |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | conversation = g_object_new( |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | PURPLE_TYPE_CONVERSATION, |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | "account", account, |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
95 | "age-restricted", TRUE, |
|
42773
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
96 | "alias", "talky talk", |
|
42355
6f7c6b84aaa0
Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42316
diff
changeset
|
97 | "avatar", avatar, |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
98 | "created-on", created_on, |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
99 | "creator", creator, |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
100 | "description", "to describe or not to describe...", |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
101 | "favorite", TRUE, |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
102 | "id", "id1", |
|
42908
64bbb9d4bf94
Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents:
42901
diff
changeset
|
103 | "logging", TRUE, |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | "name", "name1", |
|
42848
f9a04b0bed1f
Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42823
diff
changeset
|
105 | "needs-attention", TRUE, |
|
42760
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
106 | "title", "test conversation", |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
107 | "topic", "the topic...", |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
108 | "topic-author", topic_author, |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
109 | "topic-updated", topic_updated, |
|
42653
584895b844d2
PurpleConversationType's values were pascal case when they should be upper snake case
Gary Kramlich <grim@reaperworld.com>
parents:
42535
diff
changeset
|
110 | "type", PURPLE_CONVERSATION_TYPE_THREAD, |
|
42884
5a7d425c9d1b
Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents:
42857
diff
changeset
|
111 | "typing-state", PURPLE_TYPING_STATE_TYPING, |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
112 | "user-nickname", "knick-knack", |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | NULL); |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | /* Now use g_object_get to read all of the properties. */ |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | g_object_get(conversation, |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
117 | "account", &account1, |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
118 | "age-restricted", &age_restricted, |
|
42773
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
119 | "alias", &alias, |
|
42355
6f7c6b84aaa0
Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42316
diff
changeset
|
120 | "avatar", &avatar1, |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
121 | "created-on", &created_on1, |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
122 | "creator", &creator1, |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
123 | "description", &description, |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
124 | "favorite", &favorite, |
|
42800
5c55680a1a6b
Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents:
42773
diff
changeset
|
125 | "global-id", &global_id, |
|
42272
015257326ad4
Add an id property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
126 | "id", &id, |
|
42908
64bbb9d4bf94
Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents:
42901
diff
changeset
|
127 | "logging", &logging, |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | "members", &members, |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | "name", &name, |
|
42848
f9a04b0bed1f
Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42823
diff
changeset
|
130 | "needs-attention", &needs_attention, |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
131 | "tags", &tags, |
|
42760
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
132 | "title", &title, |
|
42773
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
133 | "title-for-display", &title_for_display, |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
134 | "topic", &topic, |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
135 | "topic-author", &topic_author1, |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
136 | "topic-updated", &topic_updated1, |
|
42316
3985c3404f20
Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents:
42302
diff
changeset
|
137 | "type", &type, |
|
42884
5a7d425c9d1b
Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents:
42857
diff
changeset
|
138 | "typing-state", &typing_state, |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
139 | "user-nickname", &user_nickname, |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | NULL); |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | /* Compare all the things. */ |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | g_assert_true(account1 == account); |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
144 | g_clear_object(&account1); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
145 | |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
146 | g_assert_true(age_restricted); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
147 | |
|
42773
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
148 | g_assert_cmpstr(alias, ==, "talky talk"); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
149 | g_clear_pointer(&alias, g_free); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
150 | |
|
42355
6f7c6b84aaa0
Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42316
diff
changeset
|
151 | g_assert_true(avatar1 == avatar); |
|
6f7c6b84aaa0
Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42316
diff
changeset
|
152 | g_clear_object(&avatar1); |
|
6f7c6b84aaa0
Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42316
diff
changeset
|
153 | |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
154 | g_assert_nonnull(created_on1); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
155 | g_assert_true(g_date_time_equal(created_on1, created_on)); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
156 | g_clear_pointer(&created_on1, g_date_time_unref); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
157 | |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
158 | g_assert_true(creator1 == creator); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
159 | g_clear_object(&creator1); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
160 | |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
161 | g_assert_cmpstr(description, ==, "to describe or not to describe..."); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
162 | g_clear_pointer(&description, g_free); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
163 | |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
164 | g_assert_true(favorite); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
165 | |
|
42800
5c55680a1a6b
Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents:
42773
diff
changeset
|
166 | g_assert_cmpstr(global_id, ==, "test-id1"); |
|
5c55680a1a6b
Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents:
42773
diff
changeset
|
167 | g_clear_pointer(&global_id, g_free); |
|
5c55680a1a6b
Add Purple.Conversation:global-id
Gary Kramlich <grim@reaperworld.com>
parents:
42773
diff
changeset
|
168 | |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
169 | g_assert_cmpstr(id, ==, "id1"); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
170 | g_clear_pointer(&id, g_free); |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
172 | g_assert_true(G_IS_LIST_MODEL(members)); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
173 | g_clear_object(&members); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
174 | |
|
42908
64bbb9d4bf94
Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents:
42901
diff
changeset
|
175 | g_assert_true(logging); |
|
64bbb9d4bf94
Add a logging property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents:
42901
diff
changeset
|
176 | |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
177 | g_assert_cmpstr(name, ==, "name1"); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
178 | g_clear_pointer(&name, g_free); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
179 | |
|
42848
f9a04b0bed1f
Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42823
diff
changeset
|
180 | g_assert_true(needs_attention); |
|
f9a04b0bed1f
Add a needs-attention property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42823
diff
changeset
|
181 | |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
182 | g_assert_true(PURPLE_IS_TAGS(tags)); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
183 | g_clear_object(&tags); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
184 | |
|
42760
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
185 | g_assert_cmpstr(title, ==, "test conversation"); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
186 | g_clear_pointer(&title, g_free); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
187 | |
|
42773
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
188 | g_assert_cmpstr(title_for_display, ==, "talky talk"); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
189 | g_clear_pointer(&title_for_display, g_free); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
190 | |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
191 | g_assert_cmpstr(topic, ==, "the topic..."); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
192 | g_clear_pointer(&topic, g_free); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
193 | |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
194 | g_assert_true(topic_author == topic_author1); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
195 | g_clear_object(&topic_author1); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
196 | |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
197 | g_assert_nonnull(topic_updated1); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
198 | g_assert_true(g_date_time_equal(topic_updated1, topic_updated)); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
199 | g_clear_pointer(&topic_updated1, g_date_time_unref); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
200 | |
|
42653
584895b844d2
PurpleConversationType's values were pascal case when they should be upper snake case
Gary Kramlich <grim@reaperworld.com>
parents:
42535
diff
changeset
|
201 | g_assert_cmpuint(type, ==, PURPLE_CONVERSATION_TYPE_THREAD); |
|
42316
3985c3404f20
Add PurpleConversationType
Gary Kramlich <grim@reaperworld.com>
parents:
42302
diff
changeset
|
202 | |
|
42884
5a7d425c9d1b
Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents:
42857
diff
changeset
|
203 | g_assert_cmpuint(typing_state, ==, PURPLE_TYPING_STATE_TYPING); |
|
5a7d425c9d1b
Add a typing-state property to Purple.Conversation
Gary Kramlich <grim@reaperworld.com>
parents:
42857
diff
changeset
|
204 | |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
205 | g_assert_cmpstr(user_nickname, ==, "knick-knack"); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
206 | g_clear_pointer(&user_nickname, g_free); |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | |
|
42355
6f7c6b84aaa0
Add an avatar property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42316
diff
changeset
|
208 | g_clear_object(&avatar); |
|
42292
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
209 | g_clear_object(&topic_author); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
210 | g_clear_pointer(&topic_updated, g_date_time_unref); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
211 | g_clear_pointer(&created_on, g_date_time_unref); |
|
5bc9561e5f2b
Add a bunch of properties to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42272
diff
changeset
|
212 | g_clear_object(&creator); |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | g_clear_object(&account); |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | g_clear_object(&conversation); |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | } |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | |
|
42302
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
217 | static void |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
218 | test_purple_conversation_set_topic_full(void) { |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
219 | PurpleAccount *account = NULL; |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
220 | PurpleConversation *conversation = NULL; |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
221 | PurpleContactInfo *author = NULL; |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
222 | GDateTime *updated = NULL; |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
223 | GDateTime *updated1 = NULL; |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
224 | const char *topic = "this is the topic"; |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
225 | |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
226 | account = purple_account_new("test", "test"); |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
227 | conversation = g_object_new( |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
228 | PURPLE_TYPE_CONVERSATION, |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
229 | "account", account, |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
230 | NULL); |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
231 | |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
232 | g_assert_true(PURPLE_IS_CONVERSATION(conversation)); |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
233 | |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
234 | author = purple_contact_info_new(NULL); |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
235 | updated = g_date_time_new_now_utc(); |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
236 | |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
237 | purple_conversation_set_topic_full(conversation, topic, author, updated); |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
238 | |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
239 | g_assert_cmpstr(purple_conversation_get_topic(conversation), ==, topic); |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
240 | g_assert_true(purple_conversation_get_topic_author(conversation) == |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
241 | author); |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
242 | |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
243 | updated1 = purple_conversation_get_topic_updated(conversation); |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
244 | g_assert_nonnull(updated1); |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
245 | g_assert_true(g_date_time_equal(updated1, updated)); |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
246 | |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
247 | g_clear_pointer(&updated, g_date_time_unref); |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
248 | g_clear_object(&author); |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
249 | g_clear_object(&account); |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
250 | g_clear_object(&conversation); |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
251 | } |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
252 | |
|
42773
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
253 | static void |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
254 | test_purple_conversation_title_for_display(void) { |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
255 | PurpleAccount *account = NULL; |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
256 | PurpleConversation *conversation = NULL; |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
257 | const char *title_for_display = NULL; |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
258 | guint counter = 0; |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
259 | |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
260 | account = purple_account_new("test", "test"); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
261 | conversation = g_object_new( |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
262 | PURPLE_TYPE_CONVERSATION, |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
263 | "account", account, |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
264 | "id", "id1", |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
265 | NULL); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
266 | g_signal_connect(conversation, "notify::title-for-display", |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
267 | G_CALLBACK(test_purple_conversation_notify_counter_cb), |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
268 | &counter); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
269 | |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
270 | /* Make sure the defaults are all as expected. */ |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
271 | g_assert_cmpuint(counter, ==, 0); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
272 | title_for_display = purple_conversation_get_title_for_display(conversation); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
273 | g_assert_cmpstr(title_for_display, ==, "id1"); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
274 | |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
275 | /* Set the alias, verify that the notify was sent for name-for-display and |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
276 | * that it returns the right value. |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
277 | */ |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
278 | purple_conversation_set_alias(conversation, "alias1"); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
279 | g_assert_cmpuint(counter, ==, 1); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
280 | title_for_display = purple_conversation_get_title_for_display(conversation); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
281 | g_assert_cmpstr(title_for_display, ==, "alias1"); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
282 | |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
283 | /* Set the title, which won't change the name for display because alias is |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
284 | * set, but it should still emit the signal because we don't track the |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
285 | * name-for-display in every setter. |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
286 | */ |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
287 | purple_conversation_set_title(conversation, "title1"); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
288 | g_assert_cmpuint(counter, ==, 2); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
289 | title_for_display = purple_conversation_get_title_for_display(conversation); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
290 | g_assert_cmpstr(title_for_display, ==, "alias1"); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
291 | |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
292 | /* Now set the alias to NULL which should emit the signal and |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
293 | * title_for_display should now return title1. |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
294 | */ |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
295 | purple_conversation_set_alias(conversation, NULL); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
296 | g_assert_cmpuint(counter, ==, 3); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
297 | title_for_display = purple_conversation_get_title_for_display(conversation); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
298 | g_assert_cmpstr(title_for_display, ==, "title1"); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
299 | |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
300 | /* Finally remove the title as well, which should emit the signal and |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
301 | * get_title_for_display should return the id. |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
302 | */ |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
303 | purple_conversation_set_title(conversation, NULL); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
304 | g_assert_cmpuint(counter, ==, 4); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
305 | title_for_display = purple_conversation_get_title_for_display(conversation); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
306 | g_assert_cmpstr(title_for_display, ==, "id1"); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
307 | |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
308 | /* We're done!! */ |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
309 | g_assert_finalize_object(conversation); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
310 | |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
311 | /* We can't use g_assert_finalize_object because accounts automatically |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
312 | * get added to the account manager. |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
313 | */ |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
314 | g_clear_object(&account); |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
315 | } |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
316 | |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
317 | /****************************************************************************** |
|
42669
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
318 | * "is" tests |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
319 | *****************************************************************************/ |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
320 | static void |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
321 | test_purple_conversation_is_dm(void) { |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
322 | PurpleAccount *account = NULL; |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
323 | PurpleConversation *conversation = NULL; |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
324 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
325 | account = purple_account_new("test", "test"); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
326 | conversation = g_object_new( |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
327 | PURPLE_TYPE_CONVERSATION, |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
328 | "account", account, |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
329 | "type", PURPLE_CONVERSATION_TYPE_DM, |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
330 | NULL); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
331 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
332 | g_assert_true(PURPLE_IS_CONVERSATION(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
333 | g_assert_true(purple_conversation_is_dm(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
334 | g_assert_false(purple_conversation_is_group_dm(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
335 | g_assert_false(purple_conversation_is_channel(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
336 | g_assert_false(purple_conversation_is_thread(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
337 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
338 | g_assert_finalize_object(conversation); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
339 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
340 | g_clear_object(&account); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
341 | } |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
342 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
343 | static void |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
344 | test_purple_conversation_is_group_dm(void) { |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
345 | PurpleAccount *account = NULL; |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
346 | PurpleConversation *conversation = NULL; |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
347 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
348 | account = purple_account_new("test", "test"); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
349 | conversation = g_object_new( |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
350 | PURPLE_TYPE_CONVERSATION, |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
351 | "account", account, |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
352 | "type", PURPLE_CONVERSATION_TYPE_GROUP_DM, |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
353 | NULL); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
354 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
355 | g_assert_true(PURPLE_IS_CONVERSATION(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
356 | g_assert_false(purple_conversation_is_dm(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
357 | g_assert_true(purple_conversation_is_group_dm(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
358 | g_assert_false(purple_conversation_is_channel(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
359 | g_assert_false(purple_conversation_is_thread(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
360 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
361 | g_assert_finalize_object(conversation); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
362 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
363 | g_clear_object(&account); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
364 | } |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
365 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
366 | static void |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
367 | test_purple_conversation_is_channel(void) { |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
368 | PurpleAccount *account = NULL; |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
369 | PurpleConversation *conversation = NULL; |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
370 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
371 | account = purple_account_new("test", "test"); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
372 | conversation = g_object_new( |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
373 | PURPLE_TYPE_CONVERSATION, |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
374 | "account", account, |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
375 | "type", PURPLE_CONVERSATION_TYPE_CHANNEL, |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
376 | NULL); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
377 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
378 | g_assert_true(PURPLE_IS_CONVERSATION(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
379 | g_assert_false(purple_conversation_is_dm(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
380 | g_assert_false(purple_conversation_is_group_dm(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
381 | g_assert_true(purple_conversation_is_channel(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
382 | g_assert_false(purple_conversation_is_thread(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
383 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
384 | g_assert_finalize_object(conversation); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
385 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
386 | g_clear_object(&account); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
387 | } |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
388 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
389 | static void |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
390 | test_purple_conversation_is_thread(void) { |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
391 | PurpleAccount *account = NULL; |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
392 | PurpleConversation *conversation = NULL; |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
393 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
394 | account = purple_account_new("test", "test"); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
395 | conversation = g_object_new( |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
396 | PURPLE_TYPE_CONVERSATION, |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
397 | "account", account, |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
398 | "type", PURPLE_CONVERSATION_TYPE_THREAD, |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
399 | NULL); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
400 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
401 | g_assert_true(PURPLE_IS_CONVERSATION(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
402 | g_assert_false(purple_conversation_is_dm(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
403 | g_assert_false(purple_conversation_is_group_dm(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
404 | g_assert_false(purple_conversation_is_channel(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
405 | g_assert_true(purple_conversation_is_thread(conversation)); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
406 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
407 | g_assert_finalize_object(conversation); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
408 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
409 | g_clear_object(&account); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
410 | } |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
411 | |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
412 | /****************************************************************************** |
|
42299
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
413 | * Message Tests |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
414 | *****************************************************************************/ |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
415 | static void |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
416 | test_purple_conversation_message_write_one(void) { |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
417 | PurpleAccount *account = NULL; |
|
42901
d3ff1696a39a
Update Purple.Message to use the Purple.ContactInfo
Gary Kramlich <grim@reaperworld.com>
parents:
42891
diff
changeset
|
418 | PurpleContactInfo *info = NULL; |
|
42299
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
419 | PurpleConversation *conversation = NULL; |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
420 | PurpleMessage *message = NULL; |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
421 | GListModel *messages = NULL; |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
422 | |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
423 | account = purple_account_new("test", "test"); |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
424 | conversation = g_object_new( |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
425 | PURPLE_TYPE_CONVERSATION, |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
426 | "account", account, |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
427 | NULL); |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
428 | |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
429 | messages = purple_conversation_get_messages(conversation); |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
430 | g_assert_nonnull(messages); |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
431 | g_assert_cmpuint(g_list_model_get_n_items(messages), ==, 0); |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
432 | |
|
42901
d3ff1696a39a
Update Purple.Message to use the Purple.ContactInfo
Gary Kramlich <grim@reaperworld.com>
parents:
42891
diff
changeset
|
433 | info = purple_account_get_contact_info(account); |
|
d3ff1696a39a
Update Purple.Message to use the Purple.ContactInfo
Gary Kramlich <grim@reaperworld.com>
parents:
42891
diff
changeset
|
434 | message = purple_message_new(info, "hello world!"); |
|
42299
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
435 | purple_conversation_write_message(conversation, message); |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
436 | g_assert_cmpuint(g_list_model_get_n_items(messages), ==, 1); |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
437 | |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
438 | g_clear_object(&message); |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
439 | g_clear_object(&account); |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
440 | g_clear_object(&conversation); |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
441 | } |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
442 | |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
443 | /****************************************************************************** |
|
42736
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
444 | * Signal tests |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
445 | *****************************************************************************/ |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
446 | static void |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
447 | test_purple_conversation_present_cb(PurpleConversation *conversation, |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
448 | gpointer data) |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
449 | { |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
450 | guint *counter = data; |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
451 | |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
452 | g_assert_true(PURPLE_IS_CONVERSATION(conversation)); |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
453 | |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
454 | *counter = *counter + 1; |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
455 | } |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
456 | |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
457 | static void |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
458 | test_purple_conversation_signals_present(void) { |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
459 | PurpleAccount *account = NULL; |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
460 | PurpleConversation *conversation = NULL; |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
461 | guint counter = 0; |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
462 | |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
463 | account = purple_account_new("test", "test"); |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
464 | conversation = g_object_new( |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
465 | PURPLE_TYPE_CONVERSATION, |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
466 | "account", account, |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
467 | "type", PURPLE_CONVERSATION_TYPE_DM, |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
468 | "name", "bleh", |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
469 | NULL); |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
470 | |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
471 | g_signal_connect(conversation, "present", |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
472 | G_CALLBACK(test_purple_conversation_present_cb), |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
473 | &counter); |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
474 | |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
475 | g_assert_cmpuint(counter, ==, 0); |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
476 | purple_conversation_present(conversation); |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
477 | g_assert_cmpuint(counter, ==, 1); |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
478 | |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
479 | g_assert_finalize_object(conversation); |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
480 | g_clear_object(&account); |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
481 | } |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
482 | |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
483 | /****************************************************************************** |
|
42760
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
484 | * generate_title tests |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
485 | *****************************************************************************/ |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
486 | static void |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
487 | test_purple_conversation_generate_title_empty(void) { |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
488 | PurpleAccount *account = NULL; |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
489 | PurpleConversation *conversation = NULL; |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
490 | const char *title = NULL; |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
491 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
492 | account = purple_account_new("test", "test"); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
493 | conversation = g_object_new( |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
494 | PURPLE_TYPE_CONVERSATION, |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
495 | "account", account, |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
496 | "type", PURPLE_CONVERSATION_TYPE_DM, |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
497 | NULL); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
498 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
499 | title = purple_conversation_get_title(conversation); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
500 | g_assert_null(title); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
501 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
502 | purple_conversation_set_title(conversation, "test"); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
503 | title = purple_conversation_get_title(conversation); |
|
42823
77214989b64c
Fix dead assignment bug reported by scan-build
Markus Fischer <ivanhoe@fiscari.de>
parents:
42805
diff
changeset
|
504 | g_assert_cmpstr(title, ==, "test"); |
|
42760
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
505 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
506 | /* There are no members in this conversation, so calling generate_title |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
507 | * doesn't change the title. |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
508 | */ |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
509 | purple_conversation_generate_title(conversation); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
510 | title = purple_conversation_get_title(conversation); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
511 | g_assert_cmpstr(title, ==, "test"); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
512 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
513 | g_assert_finalize_object(conversation); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
514 | g_clear_object(&account); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
515 | } |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
516 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
517 | static void |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
518 | test_purple_conversation_generate_title_dm(void) { |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
519 | PurpleAccount *account = NULL; |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
520 | PurpleContact *contact = NULL; |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
521 | PurpleConversation *conversation = NULL; |
|
42891
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
522 | PurpleConversationMembers *members = NULL; |
|
42760
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
523 | const char *title = NULL; |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
524 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
525 | account = purple_account_new("test", "test"); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
526 | conversation = g_object_new( |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
527 | PURPLE_TYPE_CONVERSATION, |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
528 | "account", account, |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
529 | "type", PURPLE_CONVERSATION_TYPE_DM, |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
530 | NULL); |
|
42891
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
531 | members = purple_conversation_get_members(conversation); |
|
42760
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
532 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
533 | title = purple_conversation_get_title(conversation); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
534 | g_assert_null(title); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
535 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
536 | contact = purple_contact_new(account, NULL); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
537 | purple_contact_info_set_username(PURPLE_CONTACT_INFO(contact), "Alice"); |
|
42891
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
538 | purple_conversation_members_add_member(members, |
|
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
539 | PURPLE_CONTACT_INFO(contact), FALSE, |
|
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
540 | NULL); |
|
42760
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
541 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
542 | title = purple_conversation_get_title(conversation); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
543 | g_assert_cmpstr(title, ==, "Alice"); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
544 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
545 | /* Make sure the title updates when the display name changes. */ |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
546 | purple_contact_info_set_username(PURPLE_CONTACT_INFO(contact), "alice!"); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
547 | title = purple_conversation_get_title(conversation); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
548 | g_assert_cmpstr(title, ==, "alice!"); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
549 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
550 | g_assert_finalize_object(conversation); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
551 | g_assert_finalize_object(contact); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
552 | g_clear_object(&account); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
553 | } |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
554 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
555 | static void |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
556 | test_purple_conversation_generate_title_group_dm(void) { |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
557 | PurpleAccount *account = NULL; |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
558 | PurpleContact *contact1 = NULL; |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
559 | PurpleContact *contact2 = NULL; |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
560 | PurpleContact *contact3 = NULL; |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
561 | PurpleConversation *conversation = NULL; |
|
42891
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
562 | PurpleConversationMembers *members = NULL; |
|
42760
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
563 | const char *title = NULL; |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
564 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
565 | account = purple_account_new("test", "test"); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
566 | conversation = g_object_new( |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
567 | PURPLE_TYPE_CONVERSATION, |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
568 | "account", account, |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
569 | "type", PURPLE_CONVERSATION_TYPE_GROUP_DM, |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
570 | NULL); |
|
42891
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
571 | members = purple_conversation_get_members(conversation); |
|
42760
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
572 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
573 | title = purple_conversation_get_title(conversation); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
574 | g_assert_null(title); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
575 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
576 | contact1 = purple_contact_new(account, NULL); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
577 | purple_contact_info_set_username(PURPLE_CONTACT_INFO(contact1), "Alice"); |
|
42891
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
578 | purple_conversation_members_add_member(members, |
|
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
579 | PURPLE_CONTACT_INFO(contact1), |
|
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
580 | FALSE, NULL); |
|
42760
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
581 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
582 | contact2 = purple_contact_new(account, NULL); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
583 | purple_contact_info_set_username(PURPLE_CONTACT_INFO(contact2), "Bob"); |
|
42891
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
584 | purple_conversation_members_add_member(members, |
|
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
585 | PURPLE_CONTACT_INFO(contact2), |
|
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
586 | FALSE, NULL); |
|
42760
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
587 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
588 | contact3 = purple_contact_new(account, NULL); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
589 | purple_contact_info_set_username(PURPLE_CONTACT_INFO(contact3), "Eve"); |
|
42891
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
590 | purple_conversation_members_add_member(members, |
|
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
591 | PURPLE_CONTACT_INFO(contact3), |
|
7f8daf96e7d3
Move Purple.Conversation:members to Purple.ConversationMembers
Gary Kramlich <grim@reaperworld.com>
parents:
42890
diff
changeset
|
592 | FALSE, NULL); |
|
42760
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
593 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
594 | title = purple_conversation_get_title(conversation); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
595 | g_assert_cmpstr(title, ==, "Alice, Bob, Eve"); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
596 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
597 | /* Change some names around and verify the title was generated properly. */ |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
598 | purple_contact_info_set_username(PURPLE_CONTACT_INFO(contact2), "Robert"); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
599 | purple_contact_info_set_username(PURPLE_CONTACT_INFO(contact3), "Evelyn"); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
600 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
601 | title = purple_conversation_get_title(conversation); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
602 | g_assert_cmpstr(title, ==, "Alice, Robert, Evelyn"); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
603 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
604 | g_assert_finalize_object(conversation); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
605 | g_assert_finalize_object(contact1); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
606 | g_assert_finalize_object(contact2); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
607 | g_assert_finalize_object(contact3); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
608 | g_clear_object(&account); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
609 | } |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
610 | |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
611 | /****************************************************************************** |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
612 | * Main |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
613 | *****************************************************************************/ |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
614 | gint |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
615 | main(gint argc, gchar *argv[]) { |
|
42184
4e1bf25f5575
Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42114
diff
changeset
|
616 | gint ret = 0; |
|
4e1bf25f5575
Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42114
diff
changeset
|
617 | |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
618 | g_test_init(&argc, &argv, NULL); |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
619 | |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
620 | test_ui_purple_init(); |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
621 | |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
622 | g_test_add_func("/conversation/properties", |
|
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
623 | test_purple_conversation_properties); |
|
42302
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
624 | g_test_add_func("/conversation/set-topic-full", |
|
54e2bf5af34a
Add purple_conversation_set_topic_full
Gary Kramlich <grim@reaperworld.com>
parents:
42299
diff
changeset
|
625 | test_purple_conversation_set_topic_full); |
|
42773
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
626 | g_test_add_func("/conversation/title-for-display", |
|
2718698a94b9
Add Conversation:alias and Conversation:title-for-display properties
Gary Kramlich <grim@reaperworld.com>
parents:
42760
diff
changeset
|
627 | test_purple_conversation_title_for_display); |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
628 | |
|
42669
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
629 | g_test_add_func("/conversation/is-dm", test_purple_conversation_is_dm); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
630 | g_test_add_func("/conversation/is-group-dm", |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
631 | test_purple_conversation_is_group_dm); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
632 | g_test_add_func("/conversation/is-channel", |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
633 | test_purple_conversation_is_channel); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
634 | g_test_add_func("/conversation/is-thread", |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
635 | test_purple_conversation_is_thread); |
|
6d41b29637ef
Add some "is" methods to PurpleConversation to make type checking easier
Gary Kramlich <grim@reaperworld.com>
parents:
42654
diff
changeset
|
636 | |
|
42299
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
637 | g_test_add_func("/conversation/message/write-one", |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
638 | test_purple_conversation_message_write_one); |
|
2dce52f93848
Add a "messages" property to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42292
diff
changeset
|
639 | |
|
42736
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
640 | g_test_add_func("/conversation/signals/present", |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
641 | test_purple_conversation_signals_present); |
|
630084f39cc5
Add a present signal to PurpleConversation and propagate it from PurpleConversationManager
Gary Kramlich <grim@reaperworld.com>
parents:
42669
diff
changeset
|
642 | |
|
42760
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
643 | g_test_add_func("/conversation/generate-title/empty", |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
644 | test_purple_conversation_generate_title_empty); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
645 | g_test_add_func("/conversation/generate-title/dm", |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
646 | test_purple_conversation_generate_title_dm); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
647 | g_test_add_func("/conversation/generate-title/group-dm", |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
648 | test_purple_conversation_generate_title_group_dm); |
|
0c293ecd56c2
Automatically generate titles for DMs and GroupDMs
Gary Kramlich <grim@reaperworld.com>
parents:
42736
diff
changeset
|
649 | |
|
42184
4e1bf25f5575
Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42114
diff
changeset
|
650 | ret = g_test_run(); |
|
4e1bf25f5575
Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42114
diff
changeset
|
651 | |
|
4e1bf25f5575
Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42114
diff
changeset
|
652 | test_ui_purple_uninit(); |
|
4e1bf25f5575
Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42114
diff
changeset
|
653 | |
|
4e1bf25f5575
Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42114
diff
changeset
|
654 | return ret; |
|
42114
d3fe2b899c89
Add membership management to PurpleConversation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
655 | } |