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/base_event_utils.h" | 10 #include "ui/events/base_event_utils.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 BitSet32 pointer_ids; | 189 BitSet32 pointer_ids; |
190 for (size_t i = 0; i < pointer_count; ++i) { | 190 for (size_t i = 0; i < pointer_count; ++i) { |
191 pointer_ids.mark_bit(event.GetPointerId(i)); | 191 pointer_ids.mark_bit(event.GetPointerId(i)); |
192 | 192 |
193 // Print the pointers sorted by id. | 193 // Print the pointers sorted by id. |
194 while (!pointer_ids.is_empty()) { | 194 while (!pointer_ids.is_empty()) { |
195 int pi = event.FindPointerIndexOfId(pointer_ids.first_marked_bit()); | 195 int pi = event.FindPointerIndexOfId(pointer_ids.first_marked_bit()); |
196 DCHECK_GE(pi, 0); | 196 DCHECK_GE(pi, 0); |
197 pointer_ids.clear_first_marked_bit(); | 197 pointer_ids.clear_first_marked_bit(); |
198 ss << "{" | 198 ss << "{" |
199 << "\n PointerId: (" << event.GetPointerId(pi) << ")" | 199 << "\n PointerId: (" << event.GetPointerId(pi) << ")" |
200 << "\n Pos: (" << event.GetX(pi) << ", " << event.GetY(pi) << ")" | 200 << "\n Pos: (" << event.GetX(pi) << ", " << event.GetY(pi) << ")" |
201 << "\n RawPos: (" << event.GetX(pi) << ", " << event.GetY(pi) << ")" | 201 << "\n RawPos: (" << event.GetX(pi) << ", " << event.GetY(pi) << ")" |
202 << "\n Size: (" << event.GetTouchMajor(pi) << ", " | 202 << "\n Size: (" << event.GetTouchMajor(pi) << ", " |
203 << event.GetTouchMinor(pi) << ")" | 203 << event.GetTouchMinor(pi) << ")" |
204 << "\n Orientation: " << event.GetOrientation(pi) | 204 << "\n Orientation: " << event.GetOrientation(pi) |
205 << "\n Pressure: " << event.GetOrientation(pi) | 205 << "\n Pressure: " << event.GetPressure(pi) |
206 << "\n Tool: " << event.GetToolType(pi); | 206 << "\n Tool: " << event.GetToolType(pi); |
207 if (history_size) { | 207 if (history_size) { |
208 ss << "\n History: ["; | 208 ss << "\n History: ["; |
209 for (size_t h = 0; h < history_size; ++h) { | 209 for (size_t h = 0; h < history_size; ++h) { |
210 ss << "\n { " << event.GetHistoricalX(pi, h) << ", " | 210 ss << "\n { " << event.GetHistoricalX(pi, h) << ", " |
211 << event.GetHistoricalY(pi, h) << ", " | 211 << event.GetHistoricalY(pi, h) << ", " |
212 << event.GetHistoricalTouchMajor(pi, h) << ", " | 212 << event.GetHistoricalTouchMajor(pi, h) << ", " |
213 << event.GetHistoricalEventTime(pi).ToInternalValue() << " }"; | 213 << event.GetHistoricalEventTime(pi).ToInternalValue() << " }"; |
214 if (h + 1 < history_size) | 214 if (h + 1 < history_size) |
215 ss << ","; | 215 ss << ","; |
216 } | 216 } |
217 ss << "\n ]"; | 217 ss << "\n ]"; |
218 } | 218 } |
219 ss << "\n }"; | 219 ss << "\n }"; |
220 if (i + 1 < pointer_count) | 220 if (i + 1 < pointer_count) |
221 ss << ", "; | 221 ss << ", "; |
222 } | 222 } |
223 ss << "]\n}"; | 223 ss << "]\n}"; |
224 } | 224 } |
225 | 225 |
226 return ss.str(); | 226 return ss.str(); |
227 } | 227 } |
228 | 228 |
229 } // namespace test | 229 } // namespace test |
230 } // namespace ui | 230 } // namespace ui |
OLD | NEW |