Merge lp:~brandontschaefer/unity/lp.1223630-fix into lp:unity
- lp.1223630-fix
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Christopher Townsend |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3522 |
Proposed branch: | lp:~brandontschaefer/unity/lp.1223630-fix |
Merge into: | lp:unity |
Diff against target: |
413 lines (+265/-14) 7 files modified
launcher/CMakeLists.txt (+1/-0) launcher/DeltaTracker.cpp (+80/-0) launcher/DeltaTracker.h (+53/-0) launcher/SwitcherView.cpp (+42/-11) launcher/SwitcherView.h (+4/-3) tests/CMakeLists.txt (+2/-0) tests/test_delta_tracker.cpp (+83/-0) |
To merge this branch: | bzr merge lp:~brandontschaefer/unity/lp.1223630-fix |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Christopher Townsend | Approve | ||
Review via email: mp+186417@code.launchpad.net |
Commit message
Only accept focus if the mouse moves in 3 directions on switcher start up if the mouse starts over the switcher window. This is an attempt to tell the difference between a bump and intentional movement.
Description of the change
Only accept focus if the mouse moves in 3 directions on switcher start up if the mouse starts over the switcher window. This is an attempt to tell the difference between a bump and intentional movement.
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3497
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3499
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3500
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3501
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Christopher Townsend (townsend) wrote : | # |
This looks good! Hopefully, the bugs will be slow to come in;)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3504
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'launcher/CMakeLists.txt' | |||
2 | --- launcher/CMakeLists.txt 2013-03-21 16:22:34 +0000 | |||
3 | +++ launcher/CMakeLists.txt 2013-09-19 20:08:39 +0000 | |||
4 | @@ -81,6 +81,7 @@ | |||
5 | 81 | add_pch(pch/launcher_pch.hh launcher-lib) | 81 | add_pch(pch/launcher_pch.hh launcher-lib) |
6 | 82 | 82 | ||
7 | 83 | set (SWITCHER_SOURCES | 83 | set (SWITCHER_SOURCES |
8 | 84 | DeltaTracker.cpp | ||
9 | 84 | SwitcherController.cpp | 85 | SwitcherController.cpp |
10 | 85 | SwitcherModel.cpp | 86 | SwitcherModel.cpp |
11 | 86 | SwitcherView.cpp | 87 | SwitcherView.cpp |
12 | 87 | 88 | ||
13 | === added file 'launcher/DeltaTracker.cpp' | |||
14 | --- launcher/DeltaTracker.cpp 1970-01-01 00:00:00 +0000 | |||
15 | +++ launcher/DeltaTracker.cpp 2013-09-19 20:08:39 +0000 | |||
16 | @@ -0,0 +1,80 @@ | |||
17 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | ||
18 | 2 | /* | ||
19 | 3 | * Copyright (C) 2011 Canonical Ltd | ||
20 | 4 | * | ||
21 | 5 | * This program is free software: you can redistribute it and/or modify | ||
22 | 6 | * it under the terms of the GNU General Public License version 3 as | ||
23 | 7 | * published by the Free Software Foundation. | ||
24 | 8 | * | ||
25 | 9 | * This program is distributed in the hope that it will be useful, | ||
26 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
27 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
28 | 12 | * GNU General Public License for more details. | ||
29 | 13 | * | ||
30 | 14 | * You should have received a copy of the GNU General Public License | ||
31 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
32 | 16 | * | ||
33 | 17 | * Authored by: Brandon Schaefer <brandon.schaefer@canonical.com> | ||
34 | 18 | */ | ||
35 | 19 | |||
36 | 20 | #include "DeltaTracker.h" | ||
37 | 21 | |||
38 | 22 | namespace unity | ||
39 | 23 | { | ||
40 | 24 | |||
41 | 25 | DeltaTracker::DeltaTracker() | ||
42 | 26 | : delta_state_(DeltaState::NONE) | ||
43 | 27 | { | ||
44 | 28 | } | ||
45 | 29 | |||
46 | 30 | void DeltaTracker::HandleNewMouseDelta(int dx, int dy) | ||
47 | 31 | { | ||
48 | 32 | if (dx > 0) | ||
49 | 33 | { | ||
50 | 34 | delta_state_ |= DeltaState::RIGHT; | ||
51 | 35 | } | ||
52 | 36 | else if (dx < 0) | ||
53 | 37 | { | ||
54 | 38 | delta_state_ |= DeltaState::LEFT; | ||
55 | 39 | } | ||
56 | 40 | |||
57 | 41 | if (dy > 0) | ||
58 | 42 | { | ||
59 | 43 | delta_state_ |= DeltaState::DOWN; | ||
60 | 44 | } | ||
61 | 45 | else if (dy < 0) | ||
62 | 46 | { | ||
63 | 47 | delta_state_ |= DeltaState::UP; | ||
64 | 48 | } | ||
65 | 49 | } | ||
66 | 50 | |||
67 | 51 | void DeltaTracker::ResetState() | ||
68 | 52 | { | ||
69 | 53 | delta_state_ = DeltaState::NONE; | ||
70 | 54 | } | ||
71 | 55 | |||
72 | 56 | unsigned int DeltaTracker::AmountOfDirectionsChanged() const | ||
73 | 57 | { | ||
74 | 58 | unsigned int directions_changed = 0; | ||
75 | 59 | |||
76 | 60 | if (HasState(DeltaState::RIGHT)) | ||
77 | 61 | directions_changed++; | ||
78 | 62 | |||
79 | 63 | if (HasState(DeltaState::LEFT)) | ||
80 | 64 | directions_changed++; | ||
81 | 65 | |||
82 | 66 | if (HasState(DeltaState::UP)) | ||
83 | 67 | directions_changed++; | ||
84 | 68 | |||
85 | 69 | if (HasState(DeltaState::DOWN)) | ||
86 | 70 | directions_changed++; | ||
87 | 71 | |||
88 | 72 | return directions_changed; | ||
89 | 73 | } | ||
90 | 74 | |||
91 | 75 | bool DeltaTracker::HasState(DeltaState const& state) const | ||
92 | 76 | { | ||
93 | 77 | return (delta_state_ & state); | ||
94 | 78 | } | ||
95 | 79 | |||
96 | 80 | } | ||
97 | 0 | 81 | ||
98 | === added file 'launcher/DeltaTracker.h' | |||
99 | --- launcher/DeltaTracker.h 1970-01-01 00:00:00 +0000 | |||
100 | +++ launcher/DeltaTracker.h 2013-09-19 20:08:39 +0000 | |||
101 | @@ -0,0 +1,53 @@ | |||
102 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | ||
103 | 2 | /* | ||
104 | 3 | * Copyright (C) 2011 Canonical Ltd | ||
105 | 4 | * | ||
106 | 5 | * This program is free software: you can redistribute it and/or modify | ||
107 | 6 | * it under the terms of the GNU General Public License version 3 as | ||
108 | 7 | * published by the Free Software Foundation. | ||
109 | 8 | * | ||
110 | 9 | * This program is distributed in the hope that it will be useful, | ||
111 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
112 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
113 | 12 | * GNU General Public License for more details. | ||
114 | 13 | * | ||
115 | 14 | * You should have received a copy of the GNU General Public License | ||
116 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
117 | 16 | * | ||
118 | 17 | * Authored by: Brandon Schaefer <brandon.schaefer@canonical.com> | ||
119 | 18 | */ | ||
120 | 19 | |||
121 | 20 | #ifndef DELTA_TRACKER_H | ||
122 | 21 | #define DELTA_TRACKER_H | ||
123 | 22 | |||
124 | 23 | namespace unity | ||
125 | 24 | { | ||
126 | 25 | |||
127 | 26 | class DeltaTracker | ||
128 | 27 | { | ||
129 | 28 | public: | ||
130 | 29 | DeltaTracker(); | ||
131 | 30 | |||
132 | 31 | void HandleNewMouseDelta(int dx, int dy); | ||
133 | 32 | void ResetState(); | ||
134 | 33 | |||
135 | 34 | unsigned int AmountOfDirectionsChanged() const; | ||
136 | 35 | |||
137 | 36 | private: | ||
138 | 37 | enum DeltaState | ||
139 | 38 | { | ||
140 | 39 | NONE = 1 << 0, | ||
141 | 40 | RIGHT = 1 << 1, | ||
142 | 41 | DOWN = 1 << 2, | ||
143 | 42 | LEFT = 1 << 3, | ||
144 | 43 | UP = 1 << 4 | ||
145 | 44 | }; | ||
146 | 45 | |||
147 | 46 | bool HasState(DeltaState const& state) const; | ||
148 | 47 | |||
149 | 48 | unsigned int delta_state_; | ||
150 | 49 | }; | ||
151 | 50 | |||
152 | 51 | } | ||
153 | 52 | |||
154 | 53 | #endif // DELTA_TRACKER_H | ||
155 | 0 | 54 | ||
156 | === modified file 'launcher/SwitcherView.cpp' | |||
157 | --- launcher/SwitcherView.cpp 2013-09-09 23:19:45 +0000 | |||
158 | +++ launcher/SwitcherView.cpp 2013-09-19 20:08:39 +0000 | |||
159 | @@ -39,6 +39,7 @@ | |||
160 | 39 | unsigned int const VERTICAL_PADDING = 45; | 39 | unsigned int const VERTICAL_PADDING = 45; |
161 | 40 | unsigned int const SPREAD_OFFSET = 100; | 40 | unsigned int const SPREAD_OFFSET = 100; |
162 | 41 | unsigned int const EXTRA_ICON_SPACE = 10; | 41 | unsigned int const EXTRA_ICON_SPACE = 10; |
163 | 42 | unsigned int const MAX_DIRECTIONS_CHANGED = 3; | ||
164 | 42 | } | 43 | } |
165 | 43 | 44 | ||
166 | 44 | NUX_IMPLEMENT_OBJECT_TYPE(SwitcherView); | 45 | NUX_IMPLEMENT_OBJECT_TYPE(SwitcherView); |
167 | @@ -206,6 +207,7 @@ | |||
168 | 206 | text_view_->SetVisible(!detail); | 207 | text_view_->SetVisible(!detail); |
169 | 207 | 208 | ||
170 | 208 | last_detail_icon_selected_ = -1; | 209 | last_detail_icon_selected_ = -1; |
171 | 210 | check_mouse_first_time_ = true; | ||
172 | 209 | 211 | ||
173 | 210 | if (!detail) | 212 | if (!detail) |
174 | 211 | { | 213 | { |
175 | @@ -222,6 +224,8 @@ | |||
176 | 222 | if (selection) | 224 | if (selection) |
177 | 223 | text_view_->SetText(selection->tooltip_text()); | 225 | text_view_->SetText(selection->tooltip_text()); |
178 | 224 | 226 | ||
179 | 227 | delta_tracker_.ResetState(); | ||
180 | 228 | |||
181 | 225 | SaveLast(); | 229 | SaveLast(); |
182 | 226 | QueueDraw(); | 230 | QueueDraw(); |
183 | 227 | } | 231 | } |
184 | @@ -234,8 +238,33 @@ | |||
185 | 234 | return {geo.x + x, geo.y + y}; | 238 | return {geo.x + x, geo.y + y}; |
186 | 235 | } | 239 | } |
187 | 236 | 240 | ||
190 | 237 | void SwitcherView::RecvMouseMove(int x, int y, int /*dx*/, int /*dy*/, unsigned long /*button_flags*/, unsigned long /*key_flags*/) | 241 | void SwitcherView::MouseHandlingBackToNormal() |
191 | 238 | { | 242 | { |
192 | 243 | check_mouse_first_time_ = false; | ||
193 | 244 | last_icon_selected_ = -1; | ||
194 | 245 | last_detail_icon_selected_ = -1; | ||
195 | 246 | } | ||
196 | 247 | |||
197 | 248 | void SwitcherView::RecvMouseMove(int x, int y, int dx, int dy, unsigned long /*button_flags*/, unsigned long /*key_flags*/) | ||
198 | 249 | { | ||
199 | 250 | // We just started, and want to check if we are a bump or not. | ||
200 | 251 | // Once we are no longer a bump, skip!! | ||
201 | 252 | if (check_mouse_first_time_) | ||
202 | 253 | { | ||
203 | 254 | if (CheckMouseInsideBackground(x,y)) | ||
204 | 255 | { | ||
205 | 256 | delta_tracker_.HandleNewMouseDelta(dx, dy); | ||
206 | 257 | if (delta_tracker_.AmountOfDirectionsChanged() >= MAX_DIRECTIONS_CHANGED) | ||
207 | 258 | { | ||
208 | 259 | MouseHandlingBackToNormal(); | ||
209 | 260 | } | ||
210 | 261 | } | ||
211 | 262 | else | ||
212 | 263 | { | ||
213 | 264 | MouseHandlingBackToNormal(); | ||
214 | 265 | } | ||
215 | 266 | } | ||
216 | 267 | |||
217 | 239 | if (model_->detail_selection) | 268 | if (model_->detail_selection) |
218 | 240 | { | 269 | { |
219 | 241 | HandleDetailMouseMove(x, y); | 270 | HandleDetailMouseMove(x, y); |
220 | @@ -254,7 +283,6 @@ | |||
221 | 254 | if (check_mouse_first_time_) | 283 | if (check_mouse_first_time_) |
222 | 255 | { | 284 | { |
223 | 256 | last_detail_icon_selected_ = detail_icon_index; | 285 | last_detail_icon_selected_ = detail_icon_index; |
224 | 257 | check_mouse_first_time_ = false; | ||
225 | 258 | return; | 286 | return; |
226 | 259 | } | 287 | } |
227 | 260 | 288 | ||
228 | @@ -276,7 +304,6 @@ | |||
229 | 276 | if (check_mouse_first_time_) | 304 | if (check_mouse_first_time_) |
230 | 277 | { | 305 | { |
231 | 278 | last_icon_selected_ = icon_index; | 306 | last_icon_selected_ = icon_index; |
232 | 279 | check_mouse_first_time_ = false; | ||
233 | 280 | return; | 307 | return; |
234 | 281 | } | 308 | } |
235 | 282 | 309 | ||
236 | @@ -364,6 +391,10 @@ | |||
237 | 364 | model_->detail_selection_index = detail_icon_index; | 391 | model_->detail_selection_index = detail_icon_index; |
238 | 365 | hide_request.emit(true); | 392 | hide_request.emit(true); |
239 | 366 | } | 393 | } |
240 | 394 | else if (detail_icon_index < 0) | ||
241 | 395 | { | ||
242 | 396 | model_->detail_selection = false; | ||
243 | 397 | } | ||
244 | 367 | } | 398 | } |
245 | 368 | else if (button == 3) | 399 | else if (button == 3) |
246 | 369 | { | 400 | { |
247 | @@ -558,13 +589,13 @@ | |||
248 | 558 | return result; | 589 | return result; |
249 | 559 | } | 590 | } |
250 | 560 | 591 | ||
258 | 561 | void SwitcherView::GetFlatIconPositions (int n_flat_icons, | 592 | void GetFlatIconPositions (int n_flat_icons, |
259 | 562 | int size, | 593 | int size, |
260 | 563 | int selection, | 594 | int selection, |
261 | 564 | int &first_flat, | 595 | int &first_flat, |
262 | 565 | int &last_flat, | 596 | int &last_flat, |
263 | 566 | int &half_fold_left, | 597 | int &half_fold_left, |
264 | 567 | int &half_fold_right) | 598 | int &half_fold_right) |
265 | 568 | { | 599 | { |
266 | 569 | half_fold_left = -1; | 600 | half_fold_left = -1; |
267 | 570 | half_fold_right = -1; | 601 | half_fold_right = -1; |
268 | 571 | 602 | ||
269 | === modified file 'launcher/SwitcherView.h' | |||
270 | --- launcher/SwitcherView.h 2013-09-05 18:12:25 +0000 | |||
271 | +++ launcher/SwitcherView.h 2013-09-19 20:08:39 +0000 | |||
272 | @@ -20,6 +20,7 @@ | |||
273 | 20 | #ifndef SWITCHERVIEW_H | 20 | #ifndef SWITCHERVIEW_H |
274 | 21 | #define SWITCHERVIEW_H | 21 | #define SWITCHERVIEW_H |
275 | 22 | 22 | ||
276 | 23 | #include "DeltaTracker.h" | ||
277 | 23 | #include "SwitcherModel.h" | 24 | #include "SwitcherModel.h" |
278 | 24 | #include "unity-shared/AbstractIconRenderer.h" | 25 | #include "unity-shared/AbstractIconRenderer.h" |
279 | 25 | #include "unity-shared/StaticCairoText.h" | 26 | #include "unity-shared/StaticCairoText.h" |
280 | @@ -132,15 +133,13 @@ | |||
281 | 132 | nux::Size SpreadSize(); | 133 | nux::Size SpreadSize(); |
282 | 133 | 134 | ||
283 | 134 | double GetCurrentProgress(); | 135 | double GetCurrentProgress(); |
284 | 135 | void GetFlatIconPositions(int n_flat_icons, int size, int selection, | ||
285 | 136 | int &first_flat, int &last_flat, | ||
286 | 137 | int &half_fold_left, int &half_fold_right); | ||
287 | 138 | 136 | ||
288 | 139 | void SaveTime(); | 137 | void SaveTime(); |
289 | 140 | void ResetTimer(); | 138 | void ResetTimer(); |
290 | 141 | void SaveLast(); | 139 | void SaveLast(); |
291 | 142 | 140 | ||
292 | 143 | bool CheckMouseInsideBackground(int x, int y) const; | 141 | bool CheckMouseInsideBackground(int x, int y) const; |
293 | 142 | void MouseHandlingBackToNormal(); | ||
294 | 144 | 143 | ||
295 | 145 | SwitcherModel::Ptr model_; | 144 | SwitcherModel::Ptr model_; |
296 | 146 | ui::LayoutSystem layout_system_; | 145 | ui::LayoutSystem layout_system_; |
297 | @@ -152,6 +151,8 @@ | |||
298 | 152 | bool target_sizes_set_; | 151 | bool target_sizes_set_; |
299 | 153 | bool check_mouse_first_time_; | 152 | bool check_mouse_first_time_; |
300 | 154 | 153 | ||
301 | 154 | DeltaTracker delta_tracker_; | ||
302 | 155 | |||
303 | 155 | std::list<ui::RenderArg> last_args_; | 156 | std::list<ui::RenderArg> last_args_; |
304 | 156 | std::list<ui::RenderArg> saved_args_; | 157 | std::list<ui::RenderArg> saved_args_; |
305 | 157 | 158 | ||
306 | 158 | 159 | ||
307 | === modified file 'tests/CMakeLists.txt' | |||
308 | --- tests/CMakeLists.txt 2013-09-13 00:40:45 +0000 | |||
309 | +++ tests/CMakeLists.txt 2013-09-19 20:08:39 +0000 | |||
310 | @@ -134,6 +134,7 @@ | |||
311 | 134 | test_abstract_interface_generator.cpp | 134 | test_abstract_interface_generator.cpp |
312 | 135 | test_animation_utils.cpp | 135 | test_animation_utils.cpp |
313 | 136 | test_connection_manager.cpp | 136 | test_connection_manager.cpp |
314 | 137 | test_delta_tracker.cpp | ||
315 | 137 | test_glib_dbus_object.cpp | 138 | test_glib_dbus_object.cpp |
316 | 138 | test_glib_cancellable.cpp | 139 | test_glib_cancellable.cpp |
317 | 139 | test_glib_object.cpp | 140 | test_glib_object.cpp |
318 | @@ -178,6 +179,7 @@ | |||
319 | 178 | unity-shared | 179 | unity-shared |
320 | 179 | unity-shared-standalone | 180 | unity-shared-standalone |
321 | 180 | launcher-lib | 181 | launcher-lib |
322 | 182 | switcher-lib | ||
323 | 181 | ${GMOCK_LIB} | 183 | ${GMOCK_LIB} |
324 | 182 | ${GMOCK_MAIN_LIB} | 184 | ${GMOCK_MAIN_LIB} |
325 | 183 | ${LIBS} | 185 | ${LIBS} |
326 | 184 | 186 | ||
327 | === added file 'tests/test_delta_tracker.cpp' | |||
328 | --- tests/test_delta_tracker.cpp 1970-01-01 00:00:00 +0000 | |||
329 | +++ tests/test_delta_tracker.cpp 2013-09-19 20:08:39 +0000 | |||
330 | @@ -0,0 +1,83 @@ | |||
331 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | ||
332 | 2 | /* | ||
333 | 3 | * Copyright (C) 2012 Canonical Ltd | ||
334 | 4 | * | ||
335 | 5 | * This program is free software: you can redistribute it and/or modify | ||
336 | 6 | * it under the terms of the GNU General Public License version 3 as | ||
337 | 7 | * published by the Free Software Foundation. | ||
338 | 8 | * | ||
339 | 9 | * This program is distributed in the hope that it will be useful, | ||
340 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
341 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
342 | 12 | * GNU General Public License for more details. | ||
343 | 13 | * | ||
344 | 14 | * You should have received a copy of the GNU General Public License | ||
345 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
346 | 16 | * | ||
347 | 17 | * Authored by: Brandon Schaefer <brandon.schaefer@canonical.com> | ||
348 | 18 | */ | ||
349 | 19 | |||
350 | 20 | #include <gmock/gmock.h> | ||
351 | 21 | using namespace testing; | ||
352 | 22 | |||
353 | 23 | #include "launcher/DeltaTracker.h" | ||
354 | 24 | |||
355 | 25 | namespace unity | ||
356 | 26 | { | ||
357 | 27 | |||
358 | 28 | class TestDeltaTracker : public Test | ||
359 | 29 | { | ||
360 | 30 | public: | ||
361 | 31 | TestDeltaTracker() | ||
362 | 32 | { | ||
363 | 33 | } | ||
364 | 34 | |||
365 | 35 | DeltaTracker delta_tracker_; | ||
366 | 36 | }; | ||
367 | 37 | |||
368 | 38 | |||
369 | 39 | TEST_F(TestDeltaTracker, TestDirectionEmptyOnStart) | ||
370 | 40 | { | ||
371 | 41 | ASSERT_EQ(delta_tracker_.AmountOfDirectionsChanged(), 0); | ||
372 | 42 | } | ||
373 | 43 | |||
374 | 44 | TEST_F(TestDeltaTracker, TestCorrectDirections) | ||
375 | 45 | { | ||
376 | 46 | delta_tracker_.HandleNewMouseDelta(0, -1); | ||
377 | 47 | delta_tracker_.HandleNewMouseDelta(1, 0); | ||
378 | 48 | |||
379 | 49 | ASSERT_EQ(delta_tracker_.AmountOfDirectionsChanged(), 2); | ||
380 | 50 | } | ||
381 | 51 | |||
382 | 52 | TEST_F(TestDeltaTracker, TestNoDuplicates) | ||
383 | 53 | { | ||
384 | 54 | delta_tracker_.HandleNewMouseDelta(0, -1); | ||
385 | 55 | delta_tracker_.HandleNewMouseDelta(0, -1); | ||
386 | 56 | |||
387 | 57 | ASSERT_EQ(delta_tracker_.AmountOfDirectionsChanged(), 1); | ||
388 | 58 | } | ||
389 | 59 | |||
390 | 60 | TEST_F(TestDeltaTracker, TestAllDirections) | ||
391 | 61 | { | ||
392 | 62 | delta_tracker_.HandleNewMouseDelta(0, -1); | ||
393 | 63 | delta_tracker_.HandleNewMouseDelta(0, 1); | ||
394 | 64 | delta_tracker_.HandleNewMouseDelta(-1, 0); | ||
395 | 65 | delta_tracker_.HandleNewMouseDelta(1, 0); | ||
396 | 66 | |||
397 | 67 | ASSERT_EQ(delta_tracker_.AmountOfDirectionsChanged(), 4); | ||
398 | 68 | } | ||
399 | 69 | |||
400 | 70 | TEST_F(TestDeltaTracker, TestResetStates) | ||
401 | 71 | { | ||
402 | 72 | delta_tracker_.HandleNewMouseDelta(0, -1); | ||
403 | 73 | delta_tracker_.HandleNewMouseDelta(0, 1); | ||
404 | 74 | delta_tracker_.HandleNewMouseDelta(-1, 0); | ||
405 | 75 | delta_tracker_.HandleNewMouseDelta(1, 0); | ||
406 | 76 | |||
407 | 77 | ASSERT_EQ(delta_tracker_.AmountOfDirectionsChanged(), 4); | ||
408 | 78 | |||
409 | 79 | delta_tracker_.ResetState(); | ||
410 | 80 | ASSERT_EQ(delta_tracker_.AmountOfDirectionsChanged(), 0); | ||
411 | 81 | } | ||
412 | 82 | |||
413 | 83 | } |
FAILED: Continuous integration, rev:3496 /code.launchpad .net/~brandonts chaefer/ unity/lp. 1223630- fix/+merge/ 186417/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http:// jenkins. qa.ubuntu. com/job/ unity-ci/ 370/ jenkins. qa.ubuntu. com/job/ unity-saucy- amd64-ci/ 259 jenkins. qa.ubuntu. com/job/ unity-saucy- armhf-ci/ 257 jenkins. qa.ubuntu. com/job/ unity-saucy- i386-ci/ 258
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ unity-ci/ 370/rebuild
http://