Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: ui/events/test/motion_event_test_utils.cc

Issue 1168483002: Fix motion event pressure checking in unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698