OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/events/test/motion_event_test_utils.h" | 5 #include "ui/events/test/motion_event_test_utils.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/events/gesture_detection/bitset_32.h" | 10 #include "ui/events/gesture_detection/bitset_32.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 case ACTION_UP: | 159 case ACTION_UP: |
160 case ACTION_POINTER_UP: | 160 case ACTION_POINTER_UP: |
161 case ACTION_CANCEL: | 161 case ACTION_CANCEL: |
162 PopPointer(); | 162 PopPointer(); |
163 return; | 163 return; |
164 default: | 164 default: |
165 break; | 165 break; |
166 } | 166 } |
167 } | 167 } |
168 | 168 |
169 void MockMotionEvent::SetPrimaryPointerId(int id) { | |
170 DCHECK_GT(GetPointerCount(), 0U); | |
171 pointer(0).id = id; | |
172 } | |
173 | |
169 std::string ToString(const MotionEvent& event) { | 174 std::string ToString(const MotionEvent& event) { |
170 std::stringstream ss; | 175 std::stringstream ss; |
171 ss << "MotionEvent {" | 176 ss << "MotionEvent {" |
172 << "\n ID: " << event.GetId() << "\n Action: " << event.GetAction(); | 177 << "\n ID: " << event.GetPointerId() << "\n Action: " << event.GetAction(); |
jdduke (slow)
2015/04/21 14:56:51
This should probably now be |GetUniquEventId|, and
lanwei
2015/04/21 21:32:45
Done.
| |
173 if (event.GetAction() == MotionEvent::ACTION_POINTER_DOWN || | 178 if (event.GetAction() == MotionEvent::ACTION_POINTER_DOWN || |
174 event.GetAction() == MotionEvent::ACTION_POINTER_UP) | 179 event.GetAction() == MotionEvent::ACTION_POINTER_UP) |
175 ss << "\n ActionIndex: " << event.GetActionIndex(); | 180 ss << "\n ActionIndex: " << event.GetActionIndex(); |
176 ss << "\n Flags: " << event.GetFlags() | 181 ss << "\n Flags: " << event.GetFlags() |
177 << "\n ButtonState: " << event.GetButtonState() << "\n Pointers: ["; | 182 << "\n ButtonState: " << event.GetButtonState() << "\n Pointers: ["; |
178 const size_t pointer_count = event.GetPointerCount(); | 183 const size_t pointer_count = event.GetPointerCount(); |
179 const size_t history_size = event.GetHistorySize(); | 184 const size_t history_size = event.GetHistorySize(); |
180 | 185 |
181 BitSet32 pointer_ids; | 186 BitSet32 pointer_ids; |
182 for (size_t i = 0; i < pointer_count; ++i) { | 187 for (size_t i = 0; i < pointer_count; ++i) { |
(...skipping 29 matching lines...) Expand all Loading... | |
212 ss << ", "; | 217 ss << ", "; |
213 } | 218 } |
214 ss << "]\n}"; | 219 ss << "]\n}"; |
215 } | 220 } |
216 | 221 |
217 return ss.str(); | 222 return ss.str(); |
218 } | 223 } |
219 | 224 |
220 } // namespace test | 225 } // namespace test |
221 } // namespace ui | 226 } // namespace ui |
OLD | NEW |