Sun, 26 Nov 2017 21:13:44 -0600
We require glib 2.40 now
|
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 | |
| 38830 | 28 | #include "dbus-server.h" |
| 29 | ||
|
38832
7ad7854d8e60
Create a very basic ui for testing
Gary Kramlich <grim@reaperworld.com>
parents:
38830
diff
changeset
|
30 | #include "test_ui.h" |
|
7ad7854d8e60
Create a very basic ui for testing
Gary Kramlich <grim@reaperworld.com>
parents:
38830
diff
changeset
|
31 | |
| 38830 | 32 | /****************************************************************************** |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | * PurpleProtcolXfer Implementations |
|
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 | 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
|
36 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | typedef struct { |
|
38843
1e1822eeeb54
this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents:
38842
diff
changeset
|
38 | PurpleProtocol parent; |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | gboolean can_send; |
|
38844
8b77fd20fcea
Another sanity check
Gary Kramlich <grim@reaperworld.com>
parents:
38843
diff
changeset
|
41 | gboolean new_xfer_called; |
|
38845
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
42 | gboolean send_called; |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | } TestPurpleProtocolXfer; |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | typedef struct { |
|
38843
1e1822eeeb54
this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents:
38842
diff
changeset
|
46 | PurpleProtocolClass parent; |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | } TestPurpleProtocolXferClass; |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | 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
|
51 | 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
|
52 | TestPurpleProtocolXfer *test_xfer = (TestPurpleProtocolXfer *)prplxfer; |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | |
|
38834
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38832
diff
changeset
|
54 | return test_xfer->can_send; |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | } |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | |
|
38845
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
57 | static void |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
58 | test_purple_protocol_xfer_send(PurpleProtocolXfer *prplxfer, PurpleConnection *c, const gchar *who, const gchar *filename) { |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
59 | TestPurpleProtocolXfer *test_xfer = (TestPurpleProtocolXfer *)prplxfer; |
|
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 | test_xfer->send_called = TRUE; |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
62 | } |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
63 | |
|
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
|
64 | 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
|
65 | 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
|
66 | 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
|
67 | 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
|
68 | |
|
38844
8b77fd20fcea
Another sanity check
Gary Kramlich <grim@reaperworld.com>
parents:
38843
diff
changeset
|
69 | test_xfer->new_xfer_called = TRUE; |
|
8b77fd20fcea
Another sanity check
Gary Kramlich <grim@reaperworld.com>
parents:
38843
diff
changeset
|
70 | |
|
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
|
71 | 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
|
72 | } |
|
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
|
73 | |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | static void |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | test_purple_protocol_xfer_iface_init(PurpleProtocolXferInterface *iface) { |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | iface->can_receive = test_purple_protocol_xfer_can_receive; |
|
38845
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
77 | iface->send = test_purple_protocol_xfer_send; |
|
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
|
78 | 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
|
79 | } |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | G_DEFINE_TYPE_WITH_CODE( |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | TestPurpleProtocolXfer, |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | test_purple_protocol_xfer, |
|
38843
1e1822eeeb54
this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents:
38842
diff
changeset
|
84 | PURPLE_TYPE_PROTOCOL, |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | G_IMPLEMENT_INTERFACE( |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | PURPLE_TYPE_PROTOCOL_XFER, |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | test_purple_protocol_xfer_iface_init |
|
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 | ); |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | static void |
|
38843
1e1822eeeb54
this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents:
38842
diff
changeset
|
92 | 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
|
93 | PurpleProtocol *prpl = PURPLE_PROTOCOL(prplxfer); |
|
1e1822eeeb54
this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents:
38842
diff
changeset
|
94 | |
|
1e1822eeeb54
this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents:
38842
diff
changeset
|
95 | prpl->id = "prpl-xfer"; |
|
38829
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 | static void |
|
38843
1e1822eeeb54
this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents:
38842
diff
changeset
|
99 | 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
|
100 | } |
|
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 | * Tests |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | *****************************************************************************/ |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | 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
|
106 | 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
|
107 | 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
|
108 | PurpleAccount *a = purple_account_new("prpl-xfer-can-receive", "prpl-xfer"); |
| 38830 | 109 | 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
|
110 | gboolean actual = FALSE; |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | |
|
38834
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38832
diff
changeset
|
112 | 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
|
113 | |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | xfer->can_send = FALSE; |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | actual = purple_protocol_xfer_can_receive( |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | PURPLE_PROTOCOL_XFER(xfer), |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | c, |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | "foo" |
|
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 | g_assert_false(actual); |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | xfer->can_send = TRUE; |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | actual = purple_protocol_xfer_can_receive( |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | PURPLE_PROTOCOL_XFER(xfer), |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | c, |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | "foo" |
|
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 | g_assert_true(actual); |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | } |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | |
|
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
|
131 | static void |
|
38845
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
132 | test_purple_protocol_xfer_send_func(void) { |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
133 | 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
|
134 | 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
|
135 | 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
|
136 | |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
137 | purple_protocol_xfer_send(PURPLE_PROTOCOL_XFER(prplxfer), c, "foo", "somefile"); |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
138 | 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
|
139 | } |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
140 | |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
141 | 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
|
142 | 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
|
143 | 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
|
144 | 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
|
145 | 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
|
146 | 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
|
147 | |
|
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 | 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
|
149 | 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
|
150 | g_assert_cmpstr("foo", ==, purple_xfer_get_remote_user(xfer)); |
|
38844
8b77fd20fcea
Another sanity check
Gary Kramlich <grim@reaperworld.com>
parents:
38843
diff
changeset
|
151 | 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
|
152 | } |
|
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
|
153 | |
|
38829
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 | * Main |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | *****************************************************************************/ |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | gint |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | 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
|
159 | 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
|
160 | |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | g_test_init(&argc, &argv, NULL); |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | g_test_set_nonfatal_assertions(); |
|
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | |
|
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 | 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
|
166 | |
|
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 | g_test_add_func( |
| 38830 | 168 | "/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
|
169 | test_purple_protocol_xfer_can_receive_func |
| 38830 | 170 | ); |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | |
|
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 | g_test_add_func( |
|
38845
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
173 | "/protocol-xfer/send", |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
174 | test_purple_protocol_xfer_send_func |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
175 | ); |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
176 | |
|
f451f9216e9d
add a test for the send function being called
Gary Kramlich <grim@reaperworld.com>
parents:
38844
diff
changeset
|
177 | 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
|
178 | "/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
|
179 | 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
|
180 | ); |
|
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 | 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
|
183 | |
|
38843
1e1822eeeb54
this is needs some cleanup but appears to work
Gary Kramlich <grim@reaperworld.com>
parents:
38842
diff
changeset
|
184 | // purple_core_quit(); |
|
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 | |
|
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
|
186 | return res; |
|
38829
2be373489ef1
Start of unit tests for the PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | } |