Merge lp:~brandontschaefer/mir/deprecate-input-device-api into lp:mir
- deprecate-input-device-api
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Cemil Azizoglu |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3756 |
Proposed branch: | lp:~brandontschaefer/mir/deprecate-input-device-api |
Merge into: | lp:mir |
Diff against target: |
274 lines (+63/-37) 11 files modified
include/client/mir_toolkit/events/input_device_state_event.h (+9/-8) include/test/mir/test/event_matchers.h (+8/-2) src/client/event.cpp (+4/-2) src/client/event_printer.cpp (+4/-4) src/client/symbols.map (+3/-1) src/common/events/input_device_state_event.cpp (+2/-2) src/common/symbols.map (+1/-0) src/include/common/mir/events/input_device_state_event.h (+2/-1) src/server/graphics/nested/input_platform.cpp (+6/-2) tests/unit-tests/input/android/test_android_input_sender.cpp (+8/-6) tests/unit-tests/input/test_event_builders.cpp (+16/-9) |
To merge this branch: | bzr merge lp:~brandontschaefer/mir/deprecate-input-device-api |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Approve | |
Cemil Azizoglu (community) | Approve | ||
Andreas Pokorny (community) | Approve | ||
Alexandros Frantzis (community) | Approve | ||
Daniel van Vugt | Needs Fixing | ||
Alan Griffiths | Approve | ||
Review via email: mp+307210@code.launchpad.net |
This proposal supersedes a proposal from 2016-09-23.
Commit message
Deprecate mir_input_
Description of the change
Deprecate
uint32_t const* mir_input_
to
uint32_t mir_input_
We keep the behaviour of the original function, moving to an easier function to use with capnproto.
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:3715
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal | # |
ok..
the old api is not used yet - other than internally.
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal | # |
ok this is breaking the mircommon ABI.. so you would have to have the mircommon7 MP as a prereq.
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:3716
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:3716
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal | # |
lgtm
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
Deprecated functions are still, in principle, supported and working.
If the function is unusable then we shouldn't be deprecating it, we should be *removing* it. (The description claims we can get away with this.)
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Note the prerequisite branch to this is still contentious, so a blocker.
Alexandros Frantzis (afrantzis) wrote : Posted in a previous version of this proposal | # |
> Deprecated functions are still, in principle, supported and working.
>
> If the function is unusable then we shouldn't be deprecating it, we should be *removing* it. (The description claims we can get away with this.)
+1
Changing the function to return a nullptr is still an ABI break, and an insidious one at that. If we are going to silently break ABI anyway, we should go all the way and remove the function completely.
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
Talking with anpok this function is used (somewhere?). Ill have to talk to him again about it, but just returning a nullptr shouldnt be an ABI break? All the sizes are the same... though unexpected behaviour changes (bad).
Im fine with removing this function but wouldnt this be something we've not broken in a long time?
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3715
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3718
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Alan Griffiths (alan-griffiths) wrote : | # |
A deprecated function like mir_input_
Unless one function is trivially implemented in terms of the other we need tests of both.
Brandon Schaefer (brandontschaefer) wrote : | # |
Its seemingly trivial, one access the pointer by an index given and the other just returns a pointer to the array.
Brandon Schaefer (brandontschaefer) wrote : | # |
Also since its deprecated ... it'll warn then error. Should we not forcefully deprecate it?
Alan Griffiths (alan-griffiths) wrote : | # |
> Also since its deprecated ... it'll warn then error.
It will only warn or error if the downstream so chooses.
> Should we not forcefully deprecate it?
In the previous iteration it sounded as though we thought we could control the damage if we just removed the function. I thought that was what going to be proposed next.
Brandon Schaefer (brandontschaefer) wrote : | # |
Alright, agreed. Removing.
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3720
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Alan Griffiths (alan-griffiths) wrote : | # |
mir_
needs removing from symbols. Probably with a comment like
# We're being naughty deleting this function without bumping soname, but we won't get caught.
# mir_input_
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3721
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3721
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Alan Griffiths (alan-griffiths) wrote : | # |
Now you have trivial merge conflicts.
I trust you to fix them.
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3722
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3722
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
Ok by me.
Nits:
100 + # We're being naughty deleting this function without bumping soname, but we won't get caught.
101 + # mir_input_
Why comment it out? Why not just delete it?
-------
150 + // Client API usage is deprecated, remove this when we can
151 uint32_t const* device_
Why not now? you seem to have done away with the only instance of it. Is it so we do not break the common ABI?
Brandon Schaefer (brandontschaefer) wrote : | # |
> Ok by me.
>
> Nits:
>
> 100 + # We're being naughty deleting this function without bumping
> soname, but we won't get caught.
> 101 + # mir_input_
>
> Why comment it out? Why not just delete it?
> -------
Since we are doing something quite bad, it seemed like a good idea to comment that out and leave a comment to why it was delete for now.
> -
>
> 150 + // Client API usage is deprecated, remove this when we can
> 151 uint32_t const* device_
>
> Why not now? you seem to have done away with the only instance of it. Is it so
> we do not break the common ABI?
For right now yes, avoiding the common ABI break until we figure out... though its in a src/include/common does this break ABI?
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3723
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Daniel van Vugt (vanvugt) wrote : | # |
Sorry for being slow to notice, but I think we should be more disciplined than this:
99 - mir_input_
100 + # We're being naughty deleting this function without bumping soname, but we won't get caught.
101 + # mir_input_
We know we're doing the wrong thing. And Mir is meant to be more stable than it is by now.
For the sake of doing the right mature-
Daniel van Vugt (vanvugt) wrote : | # |
"Needs Fixing" rather than disapproved just in the hope that we can add the new function without removing the old one.
Alexandros Frantzis (afrantzis) wrote : | # |
> but just returning a nullptr shouldnt be an ABI break?
> All the sizes are the same... though unexpected behaviour changes (bad).
The behavior of a function is considered to be part of the API/ABI, although it doesn't explicitly change the signature or involved binary sizes.
Alexandros Frantzis (afrantzis) wrote : | # |
Looks good.
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
After discussion, we all agree with the "mature-
That said, this kind of action is not to be repeated frequently. We definitely don't want to make a habit of it. Especially, post Version 1.
TA'ing.
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
None: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3724
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) : | # |
Preview Diff
1 | === modified file 'include/client/mir_toolkit/events/input_device_state_event.h' |
2 | --- include/client/mir_toolkit/events/input_device_state_event.h 2016-06-02 15:07:12 +0000 |
3 | +++ include/client/mir_toolkit/events/input_device_state_event.h 2016-10-11 18:15:36 +0000 |
4 | @@ -96,16 +96,17 @@ |
5 | MirInputDeviceId mir_input_device_state_event_device_id( |
6 | MirInputDeviceStateEvent const* ev, uint32_t index); |
7 | |
8 | -/** |
9 | - * Retrieve an array of pressed keys on the device identified by the \a index. |
10 | - * The keys are encoded as scan codes. |
11 | +/* |
12 | + * Retrieve a pressed key on the device identified by the \a index. |
13 | + * The key is encoded as a scan code. |
14 | * |
15 | - * \param[in] ev The input device state event |
16 | - * \param[in] index The index of the input device |
17 | - * \return An array of pressed keys |
18 | + * \param[in] ev The input device state event |
19 | + * \param[in] index The index of the input device |
20 | + * \param[in] pressed_index The index of the pressed key |
21 | + * \return The pressed key at index pressed_index |
22 | */ |
23 | -uint32_t const* mir_input_device_state_event_device_pressed_keys( |
24 | - MirInputDeviceStateEvent const* ev, uint32_t index); |
25 | +uint32_t mir_input_device_state_event_device_pressed_keys_for_index( |
26 | + MirInputDeviceStateEvent const* ev, uint32_t index, uint32_t pressed_index); |
27 | |
28 | /** |
29 | * Retrieve the size of scan code array of the device identified by the \a index. |
30 | |
31 | === modified file 'include/test/mir/test/event_matchers.h' |
32 | --- include/test/mir/test/event_matchers.h 2016-07-18 07:38:38 +0000 |
33 | +++ include/test/mir/test/event_matchers.h 2016-10-11 18:15:36 +0000 |
34 | @@ -527,8 +527,14 @@ |
35 | if (num_required_keys != key_count) |
36 | continue; |
37 | |
38 | - auto pressed_keys = mir_input_device_state_event_device_pressed_keys(device_state, index); |
39 | - if (!std::equal(it_keys, end_keys, pressed_keys)) |
40 | + std::vector<uint32_t> pressed_keys; |
41 | + for (uint32_t i = 0; i < key_count; i++) |
42 | + { |
43 | + pressed_keys.push_back( |
44 | + mir_input_device_state_event_device_pressed_keys_for_index(device_state, index, i)); |
45 | + } |
46 | + |
47 | + if (!std::equal(it_keys, end_keys, std::begin(pressed_keys))) |
48 | continue; |
49 | return true; |
50 | } |
51 | |
52 | === modified file 'src/client/event.cpp' |
53 | --- src/client/event.cpp 2016-10-05 08:42:26 +0000 |
54 | +++ src/client/event.cpp 2016-10-11 18:15:36 +0000 |
55 | @@ -327,11 +327,13 @@ |
56 | return ev->device_id(index); |
57 | } |
58 | |
59 | -uint32_t const* mir_input_device_state_event_device_pressed_keys(MirInputDeviceStateEvent const* ev, uint32_t index) |
60 | +uint32_t mir_input_device_state_event_device_pressed_keys_for_index(MirInputDeviceStateEvent const* ev, |
61 | + uint32_t index, |
62 | + uint32_t pressed_index) |
63 | { |
64 | expect_event_type(ev, mir_event_type_input_device_state); |
65 | expect_index_in_range(ev->device_count(), index); |
66 | - return ev->device_pressed_keys(index); |
67 | + return ev->device_pressed_keys_for_index(index, pressed_index); |
68 | } |
69 | |
70 | uint32_t mir_input_device_state_event_device_pressed_keys_count(MirInputDeviceStateEvent const* ev, uint32_t index) |
71 | |
72 | === modified file 'src/client/event_printer.cpp' |
73 | --- src/client/event_printer.cpp 2016-09-19 04:16:15 +0000 |
74 | +++ src/client/event_printer.cpp 2016-10-11 18:15:36 +0000 |
75 | @@ -348,11 +348,11 @@ |
76 | out << mir_input_device_state_event_device_id(&event, index) |
77 | << " btns=" << mir_input_device_state_event_device_pointer_buttons(&event, index) |
78 | << " pressed=("; |
79 | - auto keys = mir_input_device_state_event_device_pressed_keys(&event, index); |
80 | - for (size_t count_keys = mir_input_device_state_event_device_pressed_keys_count(&event, index), i = 0; i != count_keys; ++i) |
81 | + auto key_count = mir_input_device_state_event_device_pressed_keys_count(&event, index); |
82 | + for (uint32_t i = 0; i < key_count; i++) |
83 | { |
84 | - out << static_cast<uint32_t>(keys[i]); |
85 | - if (i + 1 < count_keys) |
86 | + out << mir_input_device_state_event_device_pressed_keys_for_index(&event, index, i); |
87 | + if (i + 1 < key_count) |
88 | out << ", "; |
89 | } |
90 | out << ")"; |
91 | |
92 | === modified file 'src/client/symbols.map' |
93 | --- src/client/symbols.map 2016-10-11 11:16:22 +0000 |
94 | +++ src/client/symbols.map 2016-10-11 18:15:36 +0000 |
95 | @@ -409,7 +409,8 @@ |
96 | mir_input_device_state_event_device_pointer_buttons; |
97 | mir_input_device_state_event_device_pointer_buttons; |
98 | mir_input_device_state_event_device_pressed_keys_count; |
99 | - mir_input_device_state_event_device_pressed_keys; |
100 | + # We're being naughty deleting this function without bumping soname, but we won't get caught. |
101 | + # mir_input_device_state_event_device_pressed_keys; |
102 | mir_input_device_state_event_modifiers; |
103 | mir_input_device_state_event_pointer_axis; |
104 | mir_input_device_state_event_pointer_buttons; |
105 | @@ -434,6 +435,7 @@ |
106 | mir_display_output_type_name; |
107 | mir_output_type_name; |
108 | mir_surface_output_event_get_refresh_rate; |
109 | + mir_input_device_state_event_device_pressed_keys_for_index; |
110 | mir_buffer_stream_set_swapinterval; |
111 | mir_buffer_stream_get_swapinterval; |
112 | } MIR_CLIENT_0.24; |
113 | |
114 | === modified file 'src/common/events/input_device_state_event.cpp' |
115 | --- src/common/events/input_device_state_event.cpp 2016-05-26 20:59:38 +0000 |
116 | +++ src/common/events/input_device_state_event.cpp 2016-10-11 18:15:36 +0000 |
117 | @@ -98,9 +98,9 @@ |
118 | return devices[index].id; |
119 | } |
120 | |
121 | -uint32_t const* MirInputDeviceStateEvent::device_pressed_keys(size_t index) const |
122 | +uint32_t MirInputDeviceStateEvent::device_pressed_keys_for_index(size_t index, size_t pressed_index) const |
123 | { |
124 | - return devices[index].pressed_keys.data(); |
125 | + return devices[index].pressed_keys[pressed_index]; |
126 | } |
127 | |
128 | uint32_t MirInputDeviceStateEvent::device_pressed_keys_count(size_t index) const |
129 | |
130 | === modified file 'src/common/symbols.map' |
131 | --- src/common/symbols.map 2016-10-05 08:42:26 +0000 |
132 | +++ src/common/symbols.map 2016-10-11 18:15:36 +0000 |
133 | @@ -401,6 +401,7 @@ |
134 | MirSurfacePlacementEvent::set_id*; |
135 | MirSurfacePlacementEvent::placement*; |
136 | MirSurfacePlacementEvent::set_placement*; |
137 | + MirInputDeviceStateEvent::device_pressed_keys_for_index*; |
138 | mir::output_type_name*; |
139 | MirSurfaceOutputEvent::refresh_rate*; |
140 | MirSurfaceOutputEvent::set_refresh_rate*; |
141 | |
142 | === modified file 'src/include/common/mir/events/input_device_state_event.h' |
143 | --- src/include/common/mir/events/input_device_state_event.h 2016-05-26 20:59:38 +0000 |
144 | +++ src/include/common/mir/events/input_device_state_event.h 2016-10-11 18:15:36 +0000 |
145 | @@ -43,7 +43,8 @@ |
146 | uint32_t device_count() const; |
147 | MirInputDeviceId device_id(size_t index) const; |
148 | MirPointerButtons device_pointer_buttons(size_t index) const; |
149 | - uint32_t const* device_pressed_keys(size_t index) const; |
150 | + |
151 | + uint32_t device_pressed_keys_for_index(size_t index, size_t pressed_index) const; |
152 | uint32_t device_pressed_keys_count(size_t index) const; |
153 | |
154 | static mir::EventUPtr deserialize(std::string const& bytes); |
155 | |
156 | === modified file 'src/server/graphics/nested/input_platform.cpp' |
157 | --- src/server/graphics/nested/input_platform.cpp 2016-10-06 09:06:07 +0000 |
158 | +++ src/server/graphics/nested/input_platform.cpp 2016-10-11 18:15:36 +0000 |
159 | @@ -245,9 +245,13 @@ |
160 | { |
161 | auto dest = it->second->destination; |
162 | auto key_count = mir_input_device_state_event_device_pressed_keys_count(device_state, index); |
163 | - auto const* scan_codes = mir_input_device_state_event_device_pressed_keys(device_state, index); |
164 | + std::vector<uint32_t> scan_codes; |
165 | + for (uint32_t i = 0; i < key_count; i++) |
166 | + { |
167 | + scan_codes.push_back(mir_input_device_state_event_device_pressed_keys_for_index(device_state, index, i)); |
168 | + } |
169 | |
170 | - dest->key_state({scan_codes, scan_codes + key_count}); |
171 | + dest->key_state(scan_codes); |
172 | dest->pointer_state( |
173 | mir_input_device_state_event_device_pointer_buttons(device_state, index)); |
174 | } |
175 | |
176 | === modified file 'tests/unit-tests/input/android/test_android_input_sender.cpp' |
177 | --- tests/unit-tests/input/android/test_android_input_sender.cpp 2016-10-11 12:04:23 +0000 |
178 | +++ tests/unit-tests/input/android/test_android_input_sender.cpp 2016-10-11 18:15:36 +0000 |
179 | @@ -506,7 +506,8 @@ |
180 | const auto timestamp = std::chrono::nanoseconds(10); |
181 | register_surface(); |
182 | std::vector<mir::events::InputDeviceState> states; |
183 | - states.push_back({MirInputDeviceId{23}, {50, 60, 80}, 0}); |
184 | + std::vector<uint32_t> const pressed_keys = {50, 60, 80}; |
185 | + states.push_back({MirInputDeviceId{23}, pressed_keys, 0}); |
186 | states.push_back({MirInputDeviceId{21}, {}, mir_pointer_button_primary}); |
187 | |
188 | auto device_state = mir::events::make_event(timestamp, mir_pointer_button_primary, mir_input_event_modifier_caps_lock, |
189 | @@ -523,12 +524,13 @@ |
190 | EXPECT_THAT(mir_input_device_state_event_time(input_device_state), Eq(timestamp.count())); |
191 | EXPECT_THAT(mir_input_device_state_event_modifiers(input_device_state), Eq(mir_input_event_modifier_caps_lock)); |
192 | EXPECT_THAT(mir_input_device_state_event_device_count(input_device_state), Eq(2)); |
193 | - |
194 | EXPECT_THAT(mir_input_device_state_event_device_id(input_device_state, 0), Eq(MirInputDeviceId{23})); |
195 | - EXPECT_THAT(mir_input_device_state_event_device_pressed_keys_count(input_device_state, 0), Eq(3)); |
196 | - EXPECT_THAT(mir_input_device_state_event_device_pressed_keys(input_device_state, 0)[0], Eq(50)); |
197 | - EXPECT_THAT(mir_input_device_state_event_device_pressed_keys(input_device_state, 0)[1], Eq(60)); |
198 | - EXPECT_THAT(mir_input_device_state_event_device_pressed_keys(input_device_state, 0)[2], Eq(80)); |
199 | + auto keys_count = mir_input_device_state_event_device_pressed_keys_count(input_device_state, 0); |
200 | + EXPECT_THAT(keys_count, Eq(3)); |
201 | + for (uint32_t i = 0; i < keys_count; i++) |
202 | + { |
203 | + EXPECT_THAT(mir_input_device_state_event_device_pressed_keys_for_index(input_device_state, 0, i), Eq(pressed_keys[i])); |
204 | + } |
205 | EXPECT_THAT(mir_input_device_state_event_device_pointer_buttons(input_device_state, 0), 0); |
206 | |
207 | EXPECT_THAT(mir_input_device_state_event_device_id(input_device_state, 1), Eq(MirInputDeviceId{21})); |
208 | |
209 | === modified file 'tests/unit-tests/input/test_event_builders.cpp' |
210 | --- tests/unit-tests/input/test_event_builders.cpp 2016-07-18 07:38:38 +0000 |
211 | +++ tests/unit-tests/input/test_event_builders.cpp 2016-10-11 18:15:36 +0000 |
212 | @@ -189,12 +189,13 @@ |
213 | auto const pos_y = 53.2f; |
214 | auto const button_state = mir_pointer_button_primary|mir_pointer_button_secondary; |
215 | auto const modifiers = mir_input_event_modifier_ctrl_right | mir_input_event_modifier_ctrl; |
216 | + std::vector<uint32_t> const pressed_keys = {KEY_LEFTALT, KEY_M}; |
217 | auto ev = mev::make_event(timestamp, |
218 | button_state, |
219 | modifiers, |
220 | pos_x, |
221 | pos_y, |
222 | - {mev::InputDeviceState{MirInputDeviceId{3}, {KEY_LEFTALT, KEY_M}, 0}, |
223 | + {mev::InputDeviceState{MirInputDeviceId{3}, pressed_keys, 0}, |
224 | mev::InputDeviceState{MirInputDeviceId{2}, {}, button_state}}); |
225 | |
226 | EXPECT_THAT(mir_event_get_type(ev.get()), Eq(mir_event_type_input_device_state)); |
227 | @@ -208,9 +209,12 @@ |
228 | EXPECT_THAT(mir_input_device_state_event_device_count(ids_event), Eq(2)); |
229 | |
230 | EXPECT_THAT(mir_input_device_state_event_device_id(ids_event, 0), Eq(MirInputDeviceId{3})); |
231 | - EXPECT_THAT(mir_input_device_state_event_device_pressed_keys_count(ids_event, 0), Eq(2)); |
232 | - EXPECT_THAT(mir_input_device_state_event_device_pressed_keys(ids_event, 0)[0], Eq(KEY_LEFTALT)); |
233 | - EXPECT_THAT(mir_input_device_state_event_device_pressed_keys(ids_event, 0)[1], Eq(KEY_M)); |
234 | + auto const pressed_keys_count = mir_input_device_state_event_device_pressed_keys_count(ids_event, 0); |
235 | + EXPECT_THAT(pressed_keys_count, Eq(2)); |
236 | + for (uint32_t i = 0; i < pressed_keys_count; i++) |
237 | + { |
238 | + EXPECT_THAT(mir_input_device_state_event_device_pressed_keys_for_index(ids_event, 0, i), Eq(pressed_keys[i])); |
239 | + } |
240 | EXPECT_THAT(mir_input_device_state_event_device_pointer_buttons(ids_event, 0), Eq(0)); |
241 | |
242 | EXPECT_THAT(mir_input_device_state_event_device_id(ids_event, 1), Eq(MirInputDeviceId{2})); |
243 | @@ -252,6 +256,7 @@ |
244 | auto const pos_y = 0.0f; |
245 | auto const button_state = mir_pointer_button_primary | mir_pointer_button_secondary; |
246 | auto const modifiers = mir_input_event_modifier_none; |
247 | + std::vector<uint32_t> const pressed_keys = {KEY_RIGHTALT, KEY_LEFTSHIFT, KEY_Q}; |
248 | auto ev = mev::make_event(timestamp, |
249 | button_state, |
250 | modifiers, |
251 | @@ -259,7 +264,7 @@ |
252 | pos_y, |
253 | {mev::InputDeviceState{MirInputDeviceId{0}, {}, mir_pointer_button_primary}, |
254 | mev::InputDeviceState{MirInputDeviceId{2}, {}, mir_pointer_button_secondary}, |
255 | - mev::InputDeviceState{MirInputDeviceId{3}, {KEY_RIGHTALT, KEY_LEFTSHIFT, KEY_Q}, 0}}); |
256 | + mev::InputDeviceState{MirInputDeviceId{3}, pressed_keys, 0}}); |
257 | |
258 | auto encoded = MirEvent::serialize(ev.get()); |
259 | |
260 | @@ -269,8 +274,10 @@ |
261 | auto ids_event = mir_event_get_input_device_state_event(deserialzed_event.get()); |
262 | |
263 | EXPECT_THAT(mir_input_device_state_event_device_count(ids_event), Eq(3)); |
264 | - EXPECT_THAT(mir_input_device_state_event_device_pressed_keys_count(ids_event, 2), Eq(3)); |
265 | - EXPECT_THAT(mir_input_device_state_event_device_pressed_keys(ids_event, 2)[0], Eq(KEY_RIGHTALT)); |
266 | - EXPECT_THAT(mir_input_device_state_event_device_pressed_keys(ids_event, 2)[1], Eq(KEY_LEFTSHIFT)); |
267 | - EXPECT_THAT(mir_input_device_state_event_device_pressed_keys(ids_event, 2)[2], Eq(KEY_Q)); |
268 | + auto pressed_keys_count = mir_input_device_state_event_device_pressed_keys_count(ids_event, 2); |
269 | + EXPECT_THAT(pressed_keys_count, Eq(3)); |
270 | + for (uint32_t i = 0; i < pressed_keys_count; i++) |
271 | + { |
272 | + EXPECT_THAT(mir_input_device_state_event_device_pressed_keys_for_index(ids_event, 2, i), Eq(pressed_keys[i])); |
273 | + } |
274 | } |
FAILED: Continuous integration, rev:3713 /mir-jenkins. ubuntu. com/job/ mir-ci/ 1790/ /mir-jenkins. ubuntu. com/job/ build-mir/ 2240/console /mir-jenkins. ubuntu. com/job/ build-0- fetch/2303 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 2294 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 2294 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= yakkety/ 2294 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= yakkety/ 2268/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 2268 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 2268/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= yakkety/ 2268 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= yakkety/ 2268/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 2268 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 2268/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 2268 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 2268/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 1790/rebuild
https:/