libpurple/tests/test_protocol_xfer.c

Sat, 22 Aug 2020 02:58:07 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Sat, 22 Aug 2020 02:58:07 -0500
changeset 40516
fefaa6596e74
parent 39005
6a56e1366809
child 40813
71305a7d7423
permissions
-rw-r--r--

Remove the Gtk Ticker plugin as it doesn't scale to today's IM networks

Remove the ticker plugin as it doesn't scale to todays typical IM usage.

Testing Done:
Compile and install.

Reviewed at https://reviews.imfreedom.org/r/81/

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
515b117f1d0f Some testing stuff
Gary Kramlich <grim@reaperworld.com>
parents: 38829
diff changeset
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
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
49 test_purple_protocol_xfer_can_receive(PurpleProtocolXfer *prplxfer, PurpleConnection *c, const gchar *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
50 TestPurpleProtocolXfer *test_xfer = (TestPurpleProtocolXfer *)prplxfer;
38829
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51
38834
e4144efa975e Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents: 38832
diff changeset
52 return test_xfer->can_send;
38829
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 }
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54
38845
f451f9216e9d add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents: 38844
diff changeset
55 static void
39005
6a56e1366809 xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents: 38974
diff changeset
56 test_purple_protocol_xfer_send_file(PurpleProtocolXfer *prplxfer, PurpleConnection *c, const gchar *who, const gchar *filename) {
38845
f451f9216e9d add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents: 38844
diff changeset
57 TestPurpleProtocolXfer *test_xfer = (TestPurpleProtocolXfer *)prplxfer;
f451f9216e9d add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents: 38844
diff changeset
58
f451f9216e9d add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents: 38844
diff changeset
59 test_xfer->send_called = TRUE;
f451f9216e9d add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents: 38844
diff changeset
60 }
f451f9216e9d add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents: 38844
diff changeset
61
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
62 static PurpleXfer *
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
63 test_purple_protocol_xfer_new_xfer(PurpleProtocolXfer *prplxfer, PurpleConnection *c, const gchar *who) {
38844
8b77fd20fcea Another sanity check
Gary Kramlich <grim@reaperworld.com>
parents: 38843
diff changeset
64 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
65 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
66
38844
8b77fd20fcea Another sanity check
Gary Kramlich <grim@reaperworld.com>
parents: 38843
diff changeset
67 test_xfer->new_xfer_called = TRUE;
8b77fd20fcea Another sanity check
Gary Kramlich <grim@reaperworld.com>
parents: 38843
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 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
70 }
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
71
38829
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 static void
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 test_purple_protocol_xfer_iface_init(PurpleProtocolXferInterface *iface) {
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 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
75 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
76 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
77 }
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 G_DEFINE_TYPE_WITH_CODE(
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 TestPurpleProtocolXfer,
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 test_purple_protocol_xfer,
38843
1e1822eeeb54 this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents: 38842
diff changeset
82 PURPLE_TYPE_PROTOCOL,
38829
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 G_IMPLEMENT_INTERFACE(
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 PURPLE_TYPE_PROTOCOL_XFER,
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 test_purple_protocol_xfer_iface_init
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 )
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 static void
38843
1e1822eeeb54 this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents: 38842
diff changeset
90 test_purple_protocol_xfer_init(TestPurpleProtocolXfer *prplxfer) {
1e1822eeeb54 this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents: 38842
diff changeset
91 PurpleProtocol *prpl = PURPLE_PROTOCOL(prplxfer);
1e1822eeeb54 this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents: 38842
diff changeset
92
1e1822eeeb54 this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents: 38842
diff changeset
93 prpl->id = "prpl-xfer";
38829
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 }
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 static void
38843
1e1822eeeb54 this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents: 38842
diff changeset
97 test_purple_protocol_xfer_class_init(TestPurpleProtocolXferClass *klass) {
38829
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
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 /******************************************************************************
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 * Tests
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
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
104 test_purple_protocol_xfer_can_receive_func(void) {
38829
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 TestPurpleProtocolXfer *xfer = 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
106 PurpleAccount *a = purple_account_new("prpl-xfer-can-receive", "prpl-xfer");
38830
515b117f1d0f Some testing stuff
Gary Kramlich <grim@reaperworld.com>
parents: 38829
diff changeset
107 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
108 gboolean actual = FALSE;
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109
38834
e4144efa975e Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents: 38832
diff changeset
110 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
111
38829
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 xfer->can_send = FALSE;
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 actual = purple_protocol_xfer_can_receive(
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 PURPLE_PROTOCOL_XFER(xfer),
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 c,
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 "foo"
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 g_assert_false(actual);
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 xfer->can_send = TRUE;
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 actual = purple_protocol_xfer_can_receive(
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 PURPLE_PROTOCOL_XFER(xfer),
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 c,
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 "foo"
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 );
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 g_assert_true(actual);
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 }
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128
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
129 static void
39005
6a56e1366809 xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents: 38974
diff changeset
130 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
131 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
132 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
133 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
134
39005
6a56e1366809 xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents: 38974
diff changeset
135 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
136 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
137 }
f451f9216e9d add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents: 38844
diff changeset
138
f451f9216e9d add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents: 38844
diff changeset
139 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
140 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
141 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
142 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
143 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
144 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
145
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
146 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
147 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
148 g_assert_cmpstr("foo", ==, purple_xfer_get_remote_user(xfer));
38844
8b77fd20fcea Another sanity check
Gary Kramlich <grim@reaperworld.com>
parents: 38843
diff changeset
149 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
150 }
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
151
38829
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 /******************************************************************************
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 * Main
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 *****************************************************************************/
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 gint
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 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
157 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
158
38829
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 g_test_init(&argc, &argv, NULL);
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 g_test_set_nonfatal_assertions();
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162
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
163 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
164
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 g_test_add_func(
38830
515b117f1d0f Some testing stuff
Gary Kramlich <grim@reaperworld.com>
parents: 38829
diff changeset
166 "/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
167 test_purple_protocol_xfer_can_receive_func
38830
515b117f1d0f Some testing stuff
Gary Kramlich <grim@reaperworld.com>
parents: 38829
diff changeset
168 );
38829
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169
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
170 g_test_add_func(
39005
6a56e1366809 xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents: 38974
diff changeset
171 "/protocol-xfer/send-file",
6a56e1366809 xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents: 38974
diff changeset
172 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
173 );
f451f9216e9d add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents: 38844
diff changeset
174
f451f9216e9d add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents: 38844
diff changeset
175 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
176 "/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
177 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
178 );
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 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
181
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 return res;
38829
2be373489ef1 Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 }

mercurial