Thu, 23 Feb 2023 23:44:43 -0600
Update the libpurple tests for the warning level 2 update
Testing Done:
used `find libpurple/tests/ -iname "*.c" --execdir touch {} \;` and verified the warnings were all gone.
Reviewed at https://reviews.imfreedom.org/r/2278/
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * numerous to list here. Please refer to the COPYRIGHT file distributed |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * with this source distribution |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or (at |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * your option) any later version. |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, but |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * General Public License for more details. |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include <glib.h> |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | #include <string.h> |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | #include <purple.h> |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | |
|
38832
7ad7854d8e60
Create a very basic ui for testing
Gary Kramlich <grim@reaperworld.com>
parents:
38830
diff
changeset
|
28 | #include "test_ui.h" |
|
7ad7854d8e60
Create a very basic ui for testing
Gary Kramlich <grim@reaperworld.com>
parents:
38830
diff
changeset
|
29 | |
| 38830 | 30 | /****************************************************************************** |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | * PurpleProtcolXfer Implementations |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | *****************************************************************************/ |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | static GType test_purple_protocol_xfer_get_type(void); |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | typedef struct { |
|
38843
1e1822eeeb54
this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents:
38842
diff
changeset
|
36 | PurpleProtocol parent; |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | gboolean can_send; |
|
38844
8b77fd20fcea
Another sanity check
Gary Kramlich <grim@reaperworld.com>
parents:
38843
diff
changeset
|
39 | gboolean new_xfer_called; |
|
38845
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
40 | gboolean send_called; |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | } TestPurpleProtocolXfer; |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | typedef struct { |
|
38843
1e1822eeeb54
this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents:
38842
diff
changeset
|
44 | PurpleProtocolClass parent; |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | } TestPurpleProtocolXferClass; |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | static gboolean |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
49 | test_purple_protocol_xfer_can_receive(PurpleProtocolXfer *prplxfer, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
50 | G_GNUC_UNUSED PurpleConnection *c, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
51 | G_GNUC_UNUSED const gchar *who) |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
52 | { |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
53 | TestPurpleProtocolXfer *test_xfer = (TestPurpleProtocolXfer *)prplxfer; |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | |
|
38834
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38832
diff
changeset
|
55 | return test_xfer->can_send; |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | } |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | |
|
38845
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
58 | static void |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
59 | test_purple_protocol_xfer_send_file(PurpleProtocolXfer *prplxfer, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
60 | G_GNUC_UNUSED PurpleConnection *c, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
61 | G_GNUC_UNUSED const gchar *who, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
62 | G_GNUC_UNUSED const gchar *filename) |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
63 | { |
|
38845
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
64 | TestPurpleProtocolXfer *test_xfer = (TestPurpleProtocolXfer *)prplxfer; |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
65 | |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
66 | test_xfer->send_called = TRUE; |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
67 | } |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
68 | |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
69 | static PurpleXfer * |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
70 | test_purple_protocol_xfer_new_xfer(PurpleProtocolXfer *prplxfer, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
71 | PurpleConnection *c, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
72 | const gchar *who) |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
73 | { |
|
38844
8b77fd20fcea
Another sanity check
Gary Kramlich <grim@reaperworld.com>
parents:
38843
diff
changeset
|
74 | TestPurpleProtocolXfer *test_xfer = (TestPurpleProtocolXfer *)prplxfer; |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
75 | PurpleAccount *a = purple_connection_get_account(c); |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
76 | |
|
38844
8b77fd20fcea
Another sanity check
Gary Kramlich <grim@reaperworld.com>
parents:
38843
diff
changeset
|
77 | test_xfer->new_xfer_called = TRUE; |
|
8b77fd20fcea
Another sanity check
Gary Kramlich <grim@reaperworld.com>
parents:
38843
diff
changeset
|
78 | |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
79 | return purple_xfer_new(a, PURPLE_XFER_TYPE_SEND, who); |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
80 | } |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
81 | |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | static void |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | test_purple_protocol_xfer_iface_init(PurpleProtocolXferInterface *iface) { |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | iface->can_receive = test_purple_protocol_xfer_can_receive; |
|
39005
6a56e1366809
xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38974
diff
changeset
|
85 | iface->send_file = test_purple_protocol_xfer_send_file; |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
86 | iface->new_xfer = test_purple_protocol_xfer_new_xfer; |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | } |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | G_DEFINE_TYPE_WITH_CODE( |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | TestPurpleProtocolXfer, |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | test_purple_protocol_xfer, |
|
38843
1e1822eeeb54
this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents:
38842
diff
changeset
|
92 | PURPLE_TYPE_PROTOCOL, |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | G_IMPLEMENT_INTERFACE( |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | PURPLE_TYPE_PROTOCOL_XFER, |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | test_purple_protocol_xfer_iface_init |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | ) |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | ); |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | static void |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
100 | test_purple_protocol_xfer_init(G_GNUC_UNUSED TestPurpleProtocolXfer *prplxfer) { |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | } |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | static void |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
104 | test_purple_protocol_xfer_class_init(G_GNUC_UNUSED TestPurpleProtocolXferClass *klass) { |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | } |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | |
|
40813
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
39005
diff
changeset
|
107 | static TestPurpleProtocolXfer * |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
39005
diff
changeset
|
108 | test_purple_protocol_xfer_new(void) { |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
39005
diff
changeset
|
109 | return (TestPurpleProtocolXfer *)g_object_new( |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
39005
diff
changeset
|
110 | test_purple_protocol_xfer_get_type(), |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
39005
diff
changeset
|
111 | "id", "prpl-xfer", |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
39005
diff
changeset
|
112 | NULL); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
39005
diff
changeset
|
113 | } |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
39005
diff
changeset
|
114 | |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | /****************************************************************************** |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | * Tests |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | *****************************************************************************/ |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | static void |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
119 | test_purple_protocol_xfer_can_receive_func(void) { |
|
40813
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
39005
diff
changeset
|
120 | TestPurpleProtocolXfer *xfer = test_purple_protocol_xfer_new(); |
|
38843
1e1822eeeb54
this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents:
38842
diff
changeset
|
121 | PurpleAccount *a = purple_account_new("prpl-xfer-can-receive", "prpl-xfer"); |
| 38830 | 122 | PurpleConnection *c = g_object_new(PURPLE_TYPE_CONNECTION, "account", a, NULL); |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | gboolean actual = FALSE; |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | |
|
38834
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38832
diff
changeset
|
125 | g_assert_true(PURPLE_IS_PROTOCOL_XFER(xfer)); |
|
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38832
diff
changeset
|
126 | |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | xfer->can_send = FALSE; |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | actual = purple_protocol_xfer_can_receive( |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | PURPLE_PROTOCOL_XFER(xfer), |
|
40813
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
39005
diff
changeset
|
130 | c, |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | "foo" |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | ); |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | g_assert_false(actual); |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | xfer->can_send = TRUE; |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | actual = purple_protocol_xfer_can_receive( |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | PURPLE_PROTOCOL_XFER(xfer), |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | c, |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | "foo" |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | ); |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | g_assert_true(actual); |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | } |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
144 | static void |
|
39005
6a56e1366809
xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38974
diff
changeset
|
145 | test_purple_protocol_xfer_send_file_func(void) { |
|
38845
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
146 | TestPurpleProtocolXfer *prplxfer = g_object_new(test_purple_protocol_xfer_get_type(), NULL); |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
147 | PurpleAccount *a = purple_account_new("prpl-xfer-send", "prpl-xfer"); |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
148 | PurpleConnection *c = g_object_new(PURPLE_TYPE_CONNECTION, "account", a, NULL); |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
149 | |
|
39005
6a56e1366809
xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38974
diff
changeset
|
150 | purple_protocol_xfer_send_file(PURPLE_PROTOCOL_XFER(prplxfer), c, "foo", "somefile"); |
|
38845
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
151 | g_assert_true(prplxfer->send_called); |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
152 | } |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
153 | |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
154 | static void |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
155 | test_purple_protocol_xfer_new_func(void) { |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
156 | TestPurpleProtocolXfer *prplxfer = g_object_new(test_purple_protocol_xfer_get_type(), NULL); |
|
38843
1e1822eeeb54
this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents:
38842
diff
changeset
|
157 | PurpleAccount *a = purple_account_new("prpl-xfer-new-xfer", "prpl-xfer"); |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
158 | PurpleConnection *c = g_object_new(PURPLE_TYPE_CONNECTION, "account", a, NULL); |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
159 | PurpleXfer *xfer = NULL; |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
160 | |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
161 | xfer = purple_protocol_xfer_new_xfer(PURPLE_PROTOCOL_XFER(prplxfer), c, "foo"); |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
162 | g_assert_true(PURPLE_IS_XFER(xfer)); |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
163 | g_assert_cmpstr("foo", ==, purple_xfer_get_remote_user(xfer)); |
|
38844
8b77fd20fcea
Another sanity check
Gary Kramlich <grim@reaperworld.com>
parents:
38843
diff
changeset
|
164 | g_assert_true(prplxfer->new_xfer_called); |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
165 | } |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
166 | |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | /****************************************************************************** |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | * Main |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | *****************************************************************************/ |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | gint |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | main(gint argc, gchar **argv) { |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
172 | gint res = 0; |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
173 | |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | g_test_init(&argc, &argv, NULL); |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | g_test_set_nonfatal_assertions(); |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
178 | test_ui_purple_init(); |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
179 | |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
180 | g_test_add_func( |
| 38830 | 181 | "/protocol-xfer/can-receive", |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
182 | test_purple_protocol_xfer_can_receive_func |
| 38830 | 183 | ); |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
185 | g_test_add_func( |
|
39005
6a56e1366809
xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38974
diff
changeset
|
186 | "/protocol-xfer/send-file", |
|
6a56e1366809
xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38974
diff
changeset
|
187 | test_purple_protocol_xfer_send_file_func |
|
38845
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
188 | ); |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
189 | |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
190 | g_test_add_func( |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
191 | "/protocol-xfer/new", |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
192 | test_purple_protocol_xfer_new_func |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
193 | ); |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
194 | |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
195 | res = g_test_run(); |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
196 | |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
197 | return res; |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | } |