Tue, 13 Aug 2024 03:11:09 -0500
Modernize the Purple.Notification tests
Testing Done:
Ran the tests under valgrind and called in the turtles to get the rest.
Reviewed at https://reviews.imfreedom.org/r/3400/
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This library is free software; you can redistribute it and/or |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * modify it under the terms of the GNU Lesser General Public |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * License as published by the Free Software Foundation; either |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * version 2 of the License, or (at your option) any later version. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This library is distributed in the hope that it will be useful, |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * Lesser General Public License for more details. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU Lesser General Public |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * License along with this library; if not, see <https://www.gnu.org/licenses/>. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #include <glib.h> |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | #include <purple.h> |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | /****************************************************************************** |
|
42871
210e5f7d72a3
Modernize the Purple.Notification tests
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
24 | * Callbacks |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | *****************************************************************************/ |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | static void |
|
42871
210e5f7d72a3
Modernize the Purple.Notification tests
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
27 | test_purple_notification_destroy_data_cb(gpointer data) { |
|
210e5f7d72a3
Modernize the Purple.Notification tests
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
28 | guint *counter = data; |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | |
|
42871
210e5f7d72a3
Modernize the Purple.Notification tests
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
30 | *counter = *counter + 1; |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | } |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | /****************************************************************************** |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | * Tests |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | *****************************************************************************/ |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | static void |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | test_purple_notification_new(void) { |
|
42871
210e5f7d72a3
Modernize the Purple.Notification tests
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
38 | PurpleAccount *account1 = NULL; |
|
210e5f7d72a3
Modernize the Purple.Notification tests
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
39 | PurpleAccount *account2 = NULL; |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | PurpleNotification *notification = NULL; |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | PurpleNotificationType type = PURPLE_NOTIFICATION_TYPE_UNKNOWN; |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | GDateTime *created_timestamp = NULL; |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42648
diff
changeset
|
43 | const char *id = NULL; |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | account1 = purple_account_new("test", "test"); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | notification = purple_notification_new(PURPLE_NOTIFICATION_TYPE_GENERIC, |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | account1, |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | NULL, |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | NULL); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | /* Make sure we got a valid notification. */ |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | g_assert_true(PURPLE_IS_NOTIFICATION(notification)); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | /* Check the type. */ |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | type = purple_notification_get_notification_type(notification); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | g_assert_cmpint(PURPLE_NOTIFICATION_TYPE_GENERIC, ==, type); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | /* Verify the account is set properly. */ |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | account2 = purple_notification_get_account(notification); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | g_assert_nonnull(account2); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | g_assert_true(account1 == account2); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | /* Make sure that the id was generated. */ |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | id = purple_notification_get_id(notification); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | g_assert_nonnull(id); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | /* Make sure that the created-timestamp was set. */ |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | created_timestamp = purple_notification_get_created_timestamp(notification); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | g_assert_nonnull(created_timestamp); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | g_clear_object(&account1); |
|
42871
210e5f7d72a3
Modernize the Purple.Notification tests
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
73 | g_assert_finalize_object(notification); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | } |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | static void |
|
42565
c035e2eba80d
Fix several minor typos
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42184
diff
changeset
|
77 | test_purple_notification_destroy_data_func(void) { |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | PurpleNotification *notification = NULL; |
|
42871
210e5f7d72a3
Modernize the Purple.Notification tests
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
79 | guint counter = 0; |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | /* Create the notification. */ |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | notification = purple_notification_new(PURPLE_NOTIFICATION_TYPE_GENERIC, |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | NULL, |
|
42871
210e5f7d72a3
Modernize the Purple.Notification tests
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
84 | &counter, |
|
210e5f7d72a3
Modernize the Purple.Notification tests
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
85 | test_purple_notification_destroy_data_cb); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | /* Sanity check. */ |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | g_assert_true(PURPLE_IS_NOTIFICATION(notification)); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | |
|
42565
c035e2eba80d
Fix several minor typos
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42184
diff
changeset
|
90 | /* Unref it to force the destroy callback to be called. */ |
|
42871
210e5f7d72a3
Modernize the Purple.Notification tests
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
91 | g_assert_finalize_object(notification); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | /* Make sure the callback was called. */ |
|
42871
210e5f7d72a3
Modernize the Purple.Notification tests
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
94 | g_assert_cmpuint(counter, ==, 1); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | } |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | static void |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | test_purple_notification_properties(void) { |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | PurpleNotification *notification = NULL; |
|
42648
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
100 | GDateTime *created_timestamp = NULL; |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
101 | GDateTime *created_timestamp1 = NULL; |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
102 | char *icon_name1 = NULL; |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
103 | char *subtitle1 = NULL; |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
104 | char *title1 = NULL; |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
105 | gboolean interactive = FALSE; |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
106 | gboolean read = FALSE; |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
107 | |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
108 | created_timestamp = g_date_time_new_now_utc(); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | |
|
42648
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
110 | notification = g_object_new( |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
111 | PURPLE_TYPE_NOTIFICATION, |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
112 | "created-timestamp", created_timestamp, |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
113 | "icon-name", "icon-name", |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
114 | "interactive", TRUE, |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
115 | "read", TRUE, |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
116 | "subtitle", "subtitle", |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
117 | "title", "title", |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
118 | "type", PURPLE_NOTIFICATION_TYPE_GENERIC, |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
119 | NULL); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | g_assert_true(PURPLE_IS_NOTIFICATION(notification)); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | |
|
42648
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
123 | g_object_get( |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
124 | notification, |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
125 | "created-timestamp", &created_timestamp1, |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
126 | "icon-name", &icon_name1, |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
127 | "interactive", &interactive, |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
128 | "read", &read, |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
129 | "subtitle", &subtitle1, |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
130 | "title", &title1, |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
131 | NULL); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | |
|
42648
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
133 | g_assert_nonnull(created_timestamp1); |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
134 | g_assert_true(g_date_time_equal(created_timestamp, created_timestamp1)); |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
135 | g_date_time_unref(created_timestamp1); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | |
|
42648
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
137 | g_assert_cmpstr(title1, ==, "title"); |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
138 | g_clear_pointer(&title1, g_free); |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
139 | |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
140 | g_assert_cmpstr(subtitle1, ==, "subtitle"); |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
141 | g_clear_pointer(&subtitle1, g_free); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | |
|
42648
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
143 | g_assert_cmpstr(icon_name1, ==, "icon-name"); |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
144 | g_clear_pointer(&icon_name1, g_free); |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
145 | |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
146 | g_assert_true(read); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | |
|
42648
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
148 | g_assert_true(interactive); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | |
|
42871
210e5f7d72a3
Modernize the Purple.Notification tests
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
150 | g_date_time_unref(created_timestamp); |
|
42648
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
151 | |
|
42871
210e5f7d72a3
Modernize the Purple.Notification tests
Gary Kramlich <grim@reaperworld.com>
parents:
42866
diff
changeset
|
152 | g_assert_finalize_object(notification); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | } |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | /****************************************************************************** |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | * Main |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | *****************************************************************************/ |
|
42648
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
158 | int |
|
70d33d4dac09
Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents:
42565
diff
changeset
|
159 | main(int argc, char *argv[]) { |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | g_test_init(&argc, &argv, NULL); |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42648
diff
changeset
|
161 | g_test_set_nonfatal_assertions(); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | g_test_add_func("/notification/new", |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | test_purple_notification_new); |
|
42565
c035e2eba80d
Fix several minor typos
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42184
diff
changeset
|
165 | g_test_add_func("/notification/destroy-data-func", |
|
c035e2eba80d
Fix several minor typos
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42184
diff
changeset
|
166 | test_purple_notification_destroy_data_func); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | g_test_add_func("/notification/properties", |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | test_purple_notification_properties); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | |
|
42866
4b201e18638f
Modernize most of the unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42648
diff
changeset
|
170 | return g_test_run(); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | } |