Merge lp:~bregma/geis/lp-1252447 into lp:geis
- lp-1252447
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Brandon Schaefer | ||||
Approved revision: | 330 | ||||
Merged at revision: | 325 | ||||
Proposed branch: | lp:~bregma/geis/lp-1252447 | ||||
Merge into: | lp:geis | ||||
Diff against target: |
457 lines (+201/-20) 9 files modified
include/geis/geis.h (+8/-1) libgeis/backend/dbus/geis_dbus_backend.c (+3/-1) libgeis/backend/grail/geis_grail_backend.c (+40/-7) libgeis/backend/test_fixture/geis_backend_test_fixture.c (+3/-1) libgeis/geis.c (+3/-1) libgeis/geis_backend.c (+21/-1) libgeis/geis_backend.h (+29/-1) libgeis/geis_backend_protected.h (+3/-1) testsuite/geis2/gtest_devices.cpp (+91/-6) |
||||
To merge this branch: | bzr merge lp:~bregma/geis/lp-1252447 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brandon Schaefer (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+196458@code.launchpad.net |
Commit message
fix a synch problem when a subscription is activated in a callback on receipt of INIT_COMPLETE (lp: #1252447)
Description of the change
Fix a synchronization problem when a subscription is activated in a callback on receipt of the INIT_COMPLETE message before preexisting devices are recognized (lp: #1252447).
- 329. By Stephen M. Webb
-
fixed return status of new grail back end functions
- 330. By Stephen M. Webb
-
updated some copyright dates
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:330
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Brandon Schaefer (brandontschaefer) wrote : | # |
Testing are passing, and LGTM
Preview Diff
1 | === modified file 'include/geis/geis.h' | |||
2 | --- include/geis/geis.h 2012-12-04 12:39:16 +0000 | |||
3 | +++ include/geis/geis.h 2013-11-25 02:22:49 +0000 | |||
4 | @@ -2,7 +2,7 @@ | |||
5 | 2 | * @file geis/geis.h | 2 | * @file geis/geis.h |
6 | 3 | * This is the public interface for the GEIS gesture API. | 3 | * This is the public interface for the GEIS gesture API. |
7 | 4 | * | 4 | * |
9 | 5 | * Copyright 2010, 2011 Canonical Ltd. | 5 | * Copyright 2010-2013 Canonical Ltd. |
10 | 6 | * | 6 | * |
11 | 7 | * This library is free software; you can redistribute it and/or modify it under | 7 | * This library is free software; you can redistribute it and/or modify it under |
12 | 8 | * the terms of version 3 of the GNU Lesser General Public License as published | 8 | * the terms of version 3 of the GNU Lesser General Public License as published |
13 | @@ -803,6 +803,13 @@ | |||
14 | 803 | */ | 803 | */ |
15 | 804 | #define GEIS_CONFIG_TAP_TIMEOUT "com.canonical.oif.tap.timeout" | 804 | #define GEIS_CONFIG_TAP_TIMEOUT "com.canonical.oif.tap.timeout" |
16 | 805 | 805 | ||
17 | 806 | /** | ||
18 | 807 | * @def GEIS_CONFIG_NUM_ACTIVE_SUBSCRIPTIONS | ||
19 | 808 | * The number of subscriptions currently active in the back end. | ||
20 | 809 | * This config is query-only and intended for unit test validations. | ||
21 | 810 | */ | ||
22 | 811 | #define GEIS_CONFIG_NUM_ACTIVE_SUBSCRIPTIONS "com.canonical.oif.debug.active_subs" | ||
23 | 812 | |||
24 | 806 | /* @} */ | 813 | /* @} */ |
25 | 807 | 814 | ||
26 | 808 | /** | 815 | /** |
27 | 809 | 816 | ||
28 | === modified file 'libgeis/backend/dbus/geis_dbus_backend.c' | |||
29 | --- libgeis/backend/dbus/geis_dbus_backend.c 2012-12-04 12:39:16 +0000 | |||
30 | +++ libgeis/backend/dbus/geis_dbus_backend.c 2013-11-25 02:22:49 +0000 | |||
31 | @@ -4,7 +4,7 @@ | |||
32 | 4 | */ | 4 | */ |
33 | 5 | 5 | ||
34 | 6 | /* | 6 | /* |
36 | 7 | * Copyright 2011 Canonical Ltd. | 7 | * Copyright 2011-2013 Canonical Ltd. |
37 | 8 | * | 8 | * |
38 | 9 | * This library is free software; you can redistribute it and/or modify it under | 9 | * This library is free software; you can redistribute it and/or modify it under |
39 | 10 | * the terms of version 3 of the GNU Lesser General Public License as published | 10 | * the terms of version 3 of the GNU Lesser General Public License as published |
40 | @@ -274,6 +274,8 @@ | |||
41 | 274 | _geis_dbus_backend_create_token, | 274 | _geis_dbus_backend_create_token, |
42 | 275 | _geis_dbus_accept_gesture, | 275 | _geis_dbus_accept_gesture, |
43 | 276 | _geis_dbus_reject_gesture, | 276 | _geis_dbus_reject_gesture, |
44 | 277 | NULL, | ||
45 | 278 | NULL, | ||
46 | 277 | _geis_dbus_get_configuration, | 279 | _geis_dbus_get_configuration, |
47 | 278 | _geis_dbus_set_configuration, | 280 | _geis_dbus_set_configuration, |
48 | 279 | }; | 281 | }; |
49 | 280 | 282 | ||
50 | === modified file 'libgeis/backend/grail/geis_grail_backend.c' | |||
51 | --- libgeis/backend/grail/geis_grail_backend.c 2013-11-20 15:45:43 +0000 | |||
52 | +++ libgeis/backend/grail/geis_grail_backend.c 2013-11-25 02:22:49 +0000 | |||
53 | @@ -4,7 +4,7 @@ | |||
54 | 4 | */ | 4 | */ |
55 | 5 | 5 | ||
56 | 6 | /* | 6 | /* |
58 | 7 | * Copyright 2011, 2012 Canonical Ltd. | 7 | * Copyright 2011-2013 Canonical Ltd. |
59 | 8 | * | 8 | * |
60 | 9 | * This library is free software: you can redistribute it and/or modify it | 9 | * This library is free software: you can redistribute it and/or modify it |
61 | 10 | * under the terms of the GNU Lesser General Public License version 3 | 10 | * under the terms of the GNU Lesser General Public License version 3 |
62 | @@ -812,11 +812,14 @@ | |||
63 | 812 | GeisBoolean device_applies = GEIS_TRUE; | 812 | GeisBoolean device_applies = GEIS_TRUE; |
64 | 813 | for (GeisSize tindex = 0; tindex < geis_filter_term_count(*fit); ++tindex) | 813 | for (GeisSize tindex = 0; tindex < geis_filter_term_count(*fit); ++tindex) |
65 | 814 | { | 814 | { |
68 | 815 | if (!geis_filter_term_match_device(geis_filter_term(*fit, tindex), | 815 | GeisFilterTerm term = geis_filter_term(*fit, tindex); |
69 | 816 | device)) | 816 | if (geis_filter_term_facility(term) == GEIS_FILTER_DEVICE) |
70 | 817 | { | 817 | { |
73 | 818 | device_applies = GEIS_FALSE; | 818 | if (!geis_filter_term_match_device(term, device)) |
74 | 819 | break; | 819 | { |
75 | 820 | device_applies = GEIS_FALSE; | ||
76 | 821 | break; | ||
77 | 822 | } | ||
78 | 820 | } | 823 | } |
79 | 821 | } | 824 | } |
80 | 822 | 825 | ||
81 | @@ -1013,7 +1016,6 @@ | |||
82 | 1013 | / sizeof(struct GeisFilterableAttribute); | 1016 | / sizeof(struct GeisFilterableAttribute); |
83 | 1014 | 1017 | ||
84 | 1015 | geis_register_device(gbe->geis, geis_device, attr_count, attrs); | 1018 | geis_register_device(gbe->geis, geis_device, attr_count, attrs); |
85 | 1016 | _grail_be_subscribe_new_device(gbe, geis_device); | ||
86 | 1017 | 1019 | ||
87 | 1018 | /* We are not going to hold a pointer to this geis_device ourselves */ | 1020 | /* We are not going to hold a pointer to this geis_device ourselves */ |
88 | 1019 | geis_device_unref(geis_device); | 1021 | geis_device_unref(geis_device); |
89 | @@ -1812,6 +1814,13 @@ | |||
90 | 1812 | return retval; | 1814 | return retval; |
91 | 1813 | } | 1815 | } |
92 | 1814 | 1816 | ||
93 | 1817 | if (0 == strcmp(item_name, GEIS_CONFIG_NUM_ACTIVE_SUBSCRIPTIONS)) | ||
94 | 1818 | { | ||
95 | 1819 | struct GeisGrailSubscriptionData *sub_data = geis_subscription_pdata(subscription); | ||
96 | 1820 | *((GeisSize*)item_value) = geis_ugsubscription_count(sub_data->ugstore); | ||
97 | 1821 | retval = GEIS_STATUS_SUCCESS; | ||
98 | 1822 | } | ||
99 | 1823 | |||
100 | 1815 | #define GEIS_GRAIL_CHECK_GESTURE_CONFIG(gesture, Gesture, GESTURE) \ | 1824 | #define GEIS_GRAIL_CHECK_GESTURE_CONFIG(gesture, Gesture, GESTURE) \ |
101 | 1816 | if (strcmp(item_name, GEIS_CONFIG_##GESTURE##_TIMEOUT) == 0) \ | 1825 | if (strcmp(item_name, GEIS_CONFIG_##GESTURE##_TIMEOUT) == 0) \ |
102 | 1817 | { \ | 1826 | { \ |
103 | @@ -1830,7 +1839,7 @@ | |||
104 | 1830 | item_value); \ | 1839 | item_value); \ |
105 | 1831 | } | 1840 | } |
106 | 1832 | 1841 | ||
108 | 1833 | GEIS_GRAIL_CHECK_GESTURE_CONFIG(drag, Drag, DRAG) | 1842 | else GEIS_GRAIL_CHECK_GESTURE_CONFIG(drag, Drag, DRAG) |
109 | 1834 | else GEIS_GRAIL_CHECK_GESTURE_CONFIG(pinch, Pinch, PINCH) | 1843 | else GEIS_GRAIL_CHECK_GESTURE_CONFIG(pinch, Pinch, PINCH) |
110 | 1835 | else GEIS_GRAIL_CHECK_GESTURE_CONFIG(rotate, Rotate, ROTATE) | 1844 | else GEIS_GRAIL_CHECK_GESTURE_CONFIG(rotate, Rotate, ROTATE) |
111 | 1836 | else GEIS_GRAIL_CHECK_GESTURE_CONFIG(tap, Tap, TAP) | 1845 | else GEIS_GRAIL_CHECK_GESTURE_CONFIG(tap, Tap, TAP) |
112 | @@ -1921,12 +1930,36 @@ | |||
113 | 1921 | return retval; | 1930 | return retval; |
114 | 1922 | } | 1931 | } |
115 | 1923 | 1932 | ||
116 | 1933 | static GeisStatus | ||
117 | 1934 | _grail_be_activate_device(GeisBackend be, GeisDevice device) | ||
118 | 1935 | { | ||
119 | 1936 | GeisStatus status = GEIS_STATUS_SUCCESS; | ||
120 | 1937 | GeisGrailBackend gbe = (GeisGrailBackend)be; | ||
121 | 1938 | _grail_be_subscribe_new_device(gbe, device); | ||
122 | 1939 | return status; | ||
123 | 1940 | } | ||
124 | 1941 | |||
125 | 1942 | |||
126 | 1943 | static GeisStatus | ||
127 | 1944 | _grail_be_deactivate_device(GeisBackend be, GeisDevice device) | ||
128 | 1945 | { | ||
129 | 1946 | GeisStatus status = GEIS_STATUS_SUCCESS; | ||
130 | 1947 | GeisGrailBackend gbe = (GeisGrailBackend)be; | ||
131 | 1948 | UFDevice ufdevice = _grail_be_ufdevice_from_device_id(gbe, | ||
132 | 1949 | geis_device_id(device)); | ||
133 | 1950 | _grail_be_unsubscribe_removed_device(gbe, ufdevice); | ||
134 | 1951 | return status; | ||
135 | 1952 | } | ||
136 | 1953 | |||
137 | 1954 | |||
138 | 1924 | static struct GeisBackendVtable gbe_vtbl = { | 1955 | static struct GeisBackendVtable gbe_vtbl = { |
139 | 1925 | _geis_grail_backend_construct, | 1956 | _geis_grail_backend_construct, |
140 | 1926 | _geis_grail_backend_finalize, | 1957 | _geis_grail_backend_finalize, |
141 | 1927 | geis_grail_token_new, | 1958 | geis_grail_token_new, |
142 | 1928 | _grail_be_accept_gesture, | 1959 | _grail_be_accept_gesture, |
143 | 1929 | _grail_be_reject_gesture, | 1960 | _grail_be_reject_gesture, |
144 | 1961 | _grail_be_activate_device, | ||
145 | 1962 | _grail_be_deactivate_device, | ||
146 | 1930 | _grail_be_get_configuration, | 1963 | _grail_be_get_configuration, |
147 | 1931 | _grail_be_set_configuration | 1964 | _grail_be_set_configuration |
148 | 1932 | }; | 1965 | }; |
149 | 1933 | 1966 | ||
150 | === modified file 'libgeis/backend/test_fixture/geis_backend_test_fixture.c' | |||
151 | --- libgeis/backend/test_fixture/geis_backend_test_fixture.c 2012-12-04 12:39:16 +0000 | |||
152 | +++ libgeis/backend/test_fixture/geis_backend_test_fixture.c 2013-11-25 02:22:49 +0000 | |||
153 | @@ -2,7 +2,7 @@ | |||
154 | 2 | * @file geis_backend_test_fixture.c | 2 | * @file geis_backend_test_fixture.c |
155 | 3 | * @brief GEIS mock back end test fixture implementation | 3 | * @brief GEIS mock back end test fixture implementation |
156 | 4 | * | 4 | * |
158 | 5 | * Copyright 2010 Canonical Ltd. | 5 | * Copyright 2010-2013 Canonical Ltd. |
159 | 6 | * | 6 | * |
160 | 7 | * This library is free software; you can redistribute it and/or modify it under | 7 | * This library is free software; you can redistribute it and/or modify it under |
161 | 8 | * the terms of version 3 of the GNU Lesser General Public License as published | 8 | * the terms of version 3 of the GNU Lesser General Public License as published |
162 | @@ -274,6 +274,8 @@ | |||
163 | 274 | _create_token, | 274 | _create_token, |
164 | 275 | _gmock_accept_gesture, | 275 | _gmock_accept_gesture, |
165 | 276 | _gmock_reject_gesture, | 276 | _gmock_reject_gesture, |
166 | 277 | NULL, | ||
167 | 278 | NULL, | ||
168 | 277 | _gmock_get_configuration, | 279 | _gmock_get_configuration, |
169 | 278 | _gmock_set_configuration | 280 | _gmock_set_configuration |
170 | 279 | }; | 281 | }; |
171 | 280 | 282 | ||
172 | === modified file 'libgeis/geis.c' | |||
173 | --- libgeis/geis.c 2012-12-04 12:39:16 +0000 | |||
174 | +++ libgeis/geis.c 2013-11-25 02:22:49 +0000 | |||
175 | @@ -9,7 +9,7 @@ | |||
176 | 9 | */ | 9 | */ |
177 | 10 | 10 | ||
178 | 11 | /* | 11 | /* |
180 | 12 | * Copyright 2010, 2011 Canonical Ltd. | 12 | * Copyright 2010-2013 Canonical Ltd. |
181 | 13 | * | 13 | * |
182 | 14 | * This library is free software; you can redistribute it and/or modify it under | 14 | * This library is free software; you can redistribute it and/or modify it under |
183 | 15 | * the terms of version 3 of the GNU Lesser General Public License as published | 15 | * the terms of version 3 of the GNU Lesser General Public License as published |
184 | @@ -156,6 +156,7 @@ | |||
185 | 156 | if (event_type == GEIS_EVENT_DEVICE_AVAILABLE) | 156 | if (event_type == GEIS_EVENT_DEVICE_AVAILABLE) |
186 | 157 | { | 157 | { |
187 | 158 | geis_device_bag_insert(geis->devices, device); | 158 | geis_device_bag_insert(geis->devices, device); |
188 | 159 | geis_backend_activate_device(geis->backend, device); | ||
189 | 159 | } | 160 | } |
190 | 160 | 161 | ||
191 | 161 | if (geis->device_event_callback != GEIS_DEFAULT_EVENT_CALLBACK) | 162 | if (geis->device_event_callback != GEIS_DEFAULT_EVENT_CALLBACK) |
192 | @@ -166,6 +167,7 @@ | |||
193 | 166 | 167 | ||
194 | 167 | if (event_type == GEIS_EVENT_DEVICE_UNAVAILABLE) | 168 | if (event_type == GEIS_EVENT_DEVICE_UNAVAILABLE) |
195 | 168 | { | 169 | { |
196 | 170 | geis_backend_deactivate_device(geis->backend, device); | ||
197 | 169 | geis_device_bag_remove(geis->devices, device); | 171 | geis_device_bag_remove(geis->devices, device); |
198 | 170 | } | 172 | } |
199 | 171 | 173 | ||
200 | 172 | 174 | ||
201 | === modified file 'libgeis/geis_backend.c' | |||
202 | --- libgeis/geis_backend.c 2012-12-04 12:39:16 +0000 | |||
203 | +++ libgeis/geis_backend.c 2013-11-25 02:22:49 +0000 | |||
204 | @@ -2,7 +2,7 @@ | |||
205 | 2 | * @file geis_backend.c | 2 | * @file geis_backend.c |
206 | 3 | * @brief internal GEIS back end base class implementation | 3 | * @brief internal GEIS back end base class implementation |
207 | 4 | * | 4 | * |
209 | 5 | * Copyright 2010 Canonical Ltd. | 5 | * Copyright 2010-2013 Canonical Ltd. |
210 | 6 | * | 6 | * |
211 | 7 | * This library is free software; you can redistribute it and/or modify it under | 7 | * This library is free software; you can redistribute it and/or modify it under |
212 | 8 | * the terms of version 3 of the GNU Lesser General Public License as published | 8 | * the terms of version 3 of the GNU Lesser General Public License as published |
213 | @@ -199,6 +199,26 @@ | |||
214 | 199 | } | 199 | } |
215 | 200 | 200 | ||
216 | 201 | 201 | ||
217 | 202 | GeisStatus | ||
218 | 203 | geis_backend_activate_device(GeisBackend be, | ||
219 | 204 | GeisDevice device) | ||
220 | 205 | { | ||
221 | 206 | if (be->be_class->vtbl->activate_device) | ||
222 | 207 | return be->be_class->vtbl->activate_device(_data_from_be(be), device); | ||
223 | 208 | return GEIS_STATUS_SUCCESS; | ||
224 | 209 | } | ||
225 | 210 | |||
226 | 211 | |||
227 | 212 | GeisStatus | ||
228 | 213 | geis_backend_deactivate_device(GeisBackend be, | ||
229 | 214 | GeisDevice device) | ||
230 | 215 | { | ||
231 | 216 | if (be->be_class->vtbl->deactivate_device) | ||
232 | 217 | return be->be_class->vtbl->deactivate_device(_data_from_be(be), device); | ||
233 | 218 | return GEIS_STATUS_SUCCESS; | ||
234 | 219 | } | ||
235 | 220 | |||
236 | 221 | |||
237 | 202 | /* | 222 | /* |
238 | 203 | * Gets a back end configuration value. | 223 | * Gets a back end configuration value. |
239 | 204 | */ | 224 | */ |
240 | 205 | 225 | ||
241 | === modified file 'libgeis/geis_backend.h' | |||
242 | --- libgeis/geis_backend.h 2012-12-04 12:39:16 +0000 | |||
243 | +++ libgeis/geis_backend.h 2013-11-25 02:22:49 +0000 | |||
244 | @@ -2,7 +2,7 @@ | |||
245 | 2 | * @file geis_backend.h | 2 | * @file geis_backend.h |
246 | 3 | * @brief internal GEIS back end base class public interface | 3 | * @brief internal GEIS back end base class public interface |
247 | 4 | * | 4 | * |
249 | 5 | * Copyright 2010, 2012 Canonical Ltd. | 5 | * Copyright 2010-2013 Canonical Ltd. |
250 | 6 | * | 6 | * |
251 | 7 | * This library is free software; you can redistribute it and/or modify it under | 7 | * This library is free software; you can redistribute it and/or modify it under |
252 | 8 | * the terms of version 3 of the GNU Lesser General Public License as published | 8 | * the terms of version 3 of the GNU Lesser General Public License as published |
253 | @@ -90,6 +90,34 @@ | |||
254 | 90 | GeisGestureId gesture_id); | 90 | GeisGestureId gesture_id); |
255 | 91 | 91 | ||
256 | 92 | /** | 92 | /** |
257 | 93 | * Tells the back end to activate a device after it's been set up. | ||
258 | 94 | * | ||
259 | 95 | * @param[in] be The GEIS back end. | ||
260 | 96 | * @param[in] device The GEIS device for which subscription wll activate. | ||
261 | 97 | * | ||
262 | 98 | * The back end sends and event to the middle end when a new device has been | ||
263 | 99 | * detected. The middle end sets up some structures etc., then tells the back | ||
264 | 100 | * end to activate the device (which may actually cause some subscriptions to be | ||
265 | 101 | * activated), then forwards the new-device event to the front end where the | ||
266 | 102 | * application can be made aware of it. | ||
267 | 103 | */ | ||
268 | 104 | GeisStatus | ||
269 | 105 | geis_backend_activate_device(GeisBackend be, | ||
270 | 106 | GeisDevice device); | ||
271 | 107 | |||
272 | 108 | /** | ||
273 | 109 | * Tells the back end to activate a device after it's been set up. | ||
274 | 110 | * | ||
275 | 111 | * @param[in] be The GEIS back end. | ||
276 | 112 | * @param[in] device The GEIS device for which subscription wll deactivate. | ||
277 | 113 | * | ||
278 | 114 | * See geis_backend_activate_device for more information. | ||
279 | 115 | */ | ||
280 | 116 | GeisStatus | ||
281 | 117 | geis_backend_deactivate_device(GeisBackend be, | ||
282 | 118 | GeisDevice device); | ||
283 | 119 | |||
284 | 120 | /** | ||
285 | 93 | * Gets a back end configuration value. | 121 | * Gets a back end configuration value. |
286 | 94 | * | 122 | * |
287 | 95 | * @param[in] be The back end. | 123 | * @param[in] be The back end. |
288 | 96 | 124 | ||
289 | === modified file 'libgeis/geis_backend_protected.h' | |||
290 | --- libgeis/geis_backend_protected.h 2012-12-04 12:39:16 +0000 | |||
291 | +++ libgeis/geis_backend_protected.h 2013-11-25 02:22:49 +0000 | |||
292 | @@ -7,7 +7,7 @@ | |||
293 | 7 | */ | 7 | */ |
294 | 8 | 8 | ||
295 | 9 | /* | 9 | /* |
297 | 10 | * Copyright 2010, 2012 Canonical Ltd. | 10 | * Copyright 2010-2013 Canonical Ltd. |
298 | 11 | * | 11 | * |
299 | 12 | * This library is free software; you can redistribute it and/or modify it under | 12 | * This library is free software; you can redistribute it and/or modify it under |
300 | 13 | * the terms of version 3 of the GNU Lesser General Public License as published | 13 | * the terms of version 3 of the GNU Lesser General Public License as published |
301 | @@ -39,6 +39,8 @@ | |||
302 | 39 | GeisBackendToken (* create_token)(GeisBackend, GeisBackendTokenInitState); | 39 | GeisBackendToken (* create_token)(GeisBackend, GeisBackendTokenInitState); |
303 | 40 | GeisStatus (* accept_gesture)(GeisBackend, GeisGroup, GeisGestureId); | 40 | GeisStatus (* accept_gesture)(GeisBackend, GeisGroup, GeisGestureId); |
304 | 41 | GeisStatus (* reject_gesture)(GeisBackend, GeisGroup, GeisGestureId); | 41 | GeisStatus (* reject_gesture)(GeisBackend, GeisGroup, GeisGestureId); |
305 | 42 | GeisStatus (* activate_device)(GeisBackend, GeisDevice); | ||
306 | 43 | GeisStatus (* deactivate_device)(GeisBackend, GeisDevice); | ||
307 | 42 | GeisStatus (* get_configuration)(GeisBackend, GeisSubscription, GeisString, GeisPointer); | 44 | GeisStatus (* get_configuration)(GeisBackend, GeisSubscription, GeisString, GeisPointer); |
308 | 43 | GeisStatus (* set_configuration)(GeisBackend, GeisSubscription, GeisString, GeisPointer); | 45 | GeisStatus (* set_configuration)(GeisBackend, GeisSubscription, GeisString, GeisPointer); |
309 | 44 | } *GeisBackendVtable; | 46 | } *GeisBackendVtable; |
310 | 45 | 47 | ||
311 | === modified file 'testsuite/geis2/gtest_devices.cpp' | |||
312 | --- testsuite/geis2/gtest_devices.cpp 2013-11-20 19:38:11 +0000 | |||
313 | +++ testsuite/geis2/gtest_devices.cpp 2013-11-25 02:22:49 +0000 | |||
314 | @@ -1,7 +1,7 @@ | |||
315 | 1 | /** | 1 | /** |
316 | 2 | * GTEst test suite for GEIS v2 device handling. | 2 | * GTEst test suite for GEIS v2 device handling. |
317 | 3 | * | 3 | * |
319 | 4 | * Copyright 2012 Canonical Ltd. | 4 | * Copyright 2012-2013 Canonical Ltd. |
320 | 5 | */ | 5 | */ |
321 | 6 | #include "geis/geis.h" | 6 | #include "geis/geis.h" |
322 | 7 | #include "gtest_evemu_device.h" | 7 | #include "gtest_evemu_device.h" |
323 | @@ -22,7 +22,7 @@ | |||
324 | 22 | * Fixture for testing device handling. | 22 | * Fixture for testing device handling. |
325 | 23 | * This is a separate class because gtest uses Java reflection. | 23 | * This is a separate class because gtest uses Java reflection. |
326 | 24 | */ | 24 | */ |
328 | 25 | class GeisDeviceTests | 25 | class GeisBasicDeviceTests |
329 | 26 | : public GTestGeisFixture | 26 | : public GTestGeisFixture |
330 | 27 | { | 27 | { |
331 | 28 | void | 28 | void |
332 | @@ -36,7 +36,33 @@ | |||
333 | 36 | }; | 36 | }; |
334 | 37 | 37 | ||
335 | 38 | 38 | ||
337 | 39 | TEST_F(GeisDeviceTests, filterWithNoDevices) | 39 | /** |
338 | 40 | * Fixture for testing device handling. | ||
339 | 41 | * This is a separate class because gtest uses Java reflection. | ||
340 | 42 | */ | ||
341 | 43 | class GeisAdvancedDeviceTests | ||
342 | 44 | : public GTestGeisFixture | ||
343 | 45 | { | ||
344 | 46 | |||
345 | 47 | void | ||
346 | 48 | setup_geis() | ||
347 | 49 | { | ||
348 | 50 | new_device_.reset(new Testsuite::EvemuDevice(TEST_DEVICE_PROP_FILE)); | ||
349 | 51 | geis_ = geis_new(GEIS_INIT_TRACK_DEVICES, | ||
350 | 52 | NULL); | ||
351 | 53 | geis_initialized_in_callback_ = false; | ||
352 | 54 | device_count_ = 0; | ||
353 | 55 | } | ||
354 | 56 | |||
355 | 57 | public: | ||
356 | 58 | std::unique_ptr<Testsuite::EvemuDevice> new_device_; | ||
357 | 59 | bool geis_initialized_in_callback_; | ||
358 | 60 | int device_count_; | ||
359 | 61 | GeisSubscription subscription_; | ||
360 | 62 | }; | ||
361 | 63 | |||
362 | 64 | |||
363 | 65 | TEST_F(GeisBasicDeviceTests, filterWithNoDevices) | ||
364 | 40 | { | 66 | { |
365 | 41 | GeisSubscription sub = geis_subscription_new(geis_, | 67 | GeisSubscription sub = geis_subscription_new(geis_, |
366 | 42 | "no devices", | 68 | "no devices", |
367 | @@ -65,7 +91,7 @@ | |||
368 | 65 | * device-added event is received, a recording is run through the device. | 91 | * device-added event is received, a recording is run through the device. |
369 | 66 | * Gesture events should be detected. | 92 | * Gesture events should be detected. |
370 | 67 | */ | 93 | */ |
372 | 68 | TEST_F(GeisDeviceTests, addDeviceSubscription) | 94 | TEST_F(GeisBasicDeviceTests, addDeviceSubscription) |
373 | 69 | { | 95 | { |
374 | 70 | std::unique_ptr<Testsuite::EvemuDevice> new_device; | 96 | std::unique_ptr<Testsuite::EvemuDevice> new_device; |
375 | 71 | GeisBoolean device_has_been_created = GEIS_FALSE; | 97 | GeisBoolean device_has_been_created = GEIS_FALSE; |
376 | @@ -132,7 +158,7 @@ | |||
377 | 132 | * | 158 | * |
378 | 133 | * This test really just makes sure nothing segfaults on device removal. | 159 | * This test really just makes sure nothing segfaults on device removal. |
379 | 134 | */ | 160 | */ |
381 | 135 | TEST_F(GeisDeviceTests, removeDeviceSubscription) | 161 | TEST_F(GeisBasicDeviceTests, removeDeviceSubscription) |
382 | 136 | { | 162 | { |
383 | 137 | std::unique_ptr<Testsuite::EvemuDevice> new_device; | 163 | std::unique_ptr<Testsuite::EvemuDevice> new_device; |
384 | 138 | 164 | ||
385 | @@ -183,7 +209,7 @@ | |||
386 | 183 | * This test creates a devicve with known X and Y extents and verifies the | 209 | * This test creates a devicve with known X and Y extents and verifies the |
387 | 184 | * extent attributes are reported with the expected values. | 210 | * extent attributes are reported with the expected values. |
388 | 185 | */ | 211 | */ |
390 | 186 | TEST_F(GeisDeviceTests, deviceAttrs) | 212 | TEST_F(GeisBasicDeviceTests, deviceAttrs) |
391 | 187 | { | 213 | { |
392 | 188 | GeisBoolean off = GEIS_FALSE; | 214 | GeisBoolean off = GEIS_FALSE; |
393 | 189 | geis_set_configuration(geis_, GEIS_CONFIG_DISCARD_DEVICE_MESSAGES, &off); | 215 | geis_set_configuration(geis_, GEIS_CONFIG_DISCARD_DEVICE_MESSAGES, &off); |
394 | @@ -222,4 +248,63 @@ | |||
395 | 222 | } | 248 | } |
396 | 223 | 249 | ||
397 | 224 | 250 | ||
398 | 251 | /** | ||
399 | 252 | * GEIS event callback to verify lp:1252447. | ||
400 | 253 | * | ||
401 | 254 | * This bug reveals that subscriptions created in an event callback when the | ||
402 | 255 | * INIT_COMPLETE event is received never get activated for devices that are | ||
403 | 256 | * present at GEIS start time. | ||
404 | 257 | */ | ||
405 | 258 | static void | ||
406 | 259 | lp_1252447_event_callback(::Geis geis, GeisEvent event, void* context) | ||
407 | 260 | { | ||
408 | 261 | GeisAdvancedDeviceTests* fixture = (GeisAdvancedDeviceTests*)context; | ||
409 | 262 | switch (geis_event_type(event)) | ||
410 | 263 | { | ||
411 | 264 | case GEIS_EVENT_INIT_COMPLETE: | ||
412 | 265 | { | ||
413 | 266 | fixture->geis_initialized_in_callback_ = true; | ||
414 | 267 | fixture->subscription_ = geis_subscription_new(geis, | ||
415 | 268 | "any device", | ||
416 | 269 | GEIS_SUBSCRIPTION_NONE); | ||
417 | 270 | GeisFilter filter = geis_filter_new(geis, "filter"); | ||
418 | 271 | geis_filter_add_term(filter, | ||
419 | 272 | GEIS_FILTER_CLASS, | ||
420 | 273 | GEIS_GESTURE_ATTRIBUTE_TOUCHES, GEIS_FILTER_OP_EQ, 2, | ||
421 | 274 | NULL); | ||
422 | 275 | EXPECT_EQ(geis_subscription_add_filter(fixture->subscription_, filter), | ||
423 | 276 | GEIS_STATUS_SUCCESS); | ||
424 | 277 | EXPECT_EQ(geis_subscription_activate(fixture->subscription_), | ||
425 | 278 | GEIS_STATUS_SUCCESS); | ||
426 | 279 | break; | ||
427 | 280 | } | ||
428 | 281 | |||
429 | 282 | case GEIS_EVENT_DEVICE_AVAILABLE: | ||
430 | 283 | { | ||
431 | 284 | ++fixture->device_count_; | ||
432 | 285 | GeisSize active_sub_count = 0; | ||
433 | 286 | geis_subscription_get_configuration(fixture->subscription_, | ||
434 | 287 | GEIS_CONFIG_NUM_ACTIVE_SUBSCRIPTIONS, | ||
435 | 288 | &active_sub_count); | ||
436 | 289 | EXPECT_GT(active_sub_count, 0); | ||
437 | 290 | break; | ||
438 | 291 | } | ||
439 | 292 | |||
440 | 293 | default: | ||
441 | 294 | break; | ||
442 | 295 | } | ||
443 | 296 | } | ||
444 | 297 | |||
445 | 298 | TEST_F(GeisAdvancedDeviceTests, initialDeviceRegistrationWithCallbacks) | ||
446 | 299 | { | ||
447 | 300 | geis_register_event_callback(geis_, lp_1252447_event_callback, this); | ||
448 | 301 | geis_register_device_callback(geis_, lp_1252447_event_callback, this); | ||
449 | 302 | |||
450 | 303 | set_geis_event_handler([&](Geis, GeisEvent event) { }); | ||
451 | 304 | geis_dispatch_loop(); | ||
452 | 305 | ASSERT_TRUE(geis_initialized_in_callback_); | ||
453 | 306 | ASSERT_GT(device_count_, 0); | ||
454 | 307 | } | ||
455 | 308 | |||
456 | 309 | |||
457 | 225 | } // anonymous namespace | 310 | } // anonymous namespace |
PASSED: Continuous integration, rev:328 jenkins. qa.ubuntu. com/job/ geis-ci/ 13/ jenkins. qa.ubuntu. com/job/ geis-trusty- amd64-ci/ 8 jenkins. qa.ubuntu. com/job/ geis-trusty- armhf-ci/ 8 jenkins. qa.ubuntu. com/job/ geis-trusty- i386-ci/ 8
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/geis- ci/13/rebuild
http://