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

Side by Side Diff: ui/events/gesture_detection/motion_event_generic_unittest.cc

Issue 1147083005: Separate motion event touch geometry orientation from stylus orientation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Aura 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
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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "ui/events/event_constants.h" 6 #include "ui/events/event_constants.h"
7 #include "ui/events/gesture_detection/motion_event_generic.h" 7 #include "ui/events/gesture_detection/motion_event_generic.h"
8 #include "ui/events/test/motion_event_test_utils.h" 8 #include "ui/events/test/motion_event_test_utils.h"
9 9
10 namespace ui { 10 namespace ui {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 base::TimeTicks historical_event_time0 = 182 base::TimeTicks historical_event_time0 =
183 event_time - base::TimeDelta::FromMilliseconds(10); 183 event_time - base::TimeDelta::FromMilliseconds(10);
184 base::TimeTicks historical_event_time1 = 184 base::TimeTicks historical_event_time1 =
185 event_time - base::TimeDelta::FromMilliseconds(5); 185 event_time - base::TimeDelta::FromMilliseconds(5);
186 186
187 PointerProperties pointer0(1, 2, 3); 187 PointerProperties pointer0(1, 2, 3);
188 pointer0.id = 7; 188 pointer0.id = 7;
189 pointer0.pressure = 10; 189 pointer0.pressure = 10;
190 pointer0.touch_minor = 15; 190 pointer0.touch_minor = 15;
191 pointer0.touch_major = 20; 191 pointer0.touch_major = 20;
192 pointer0.orientation = 1; 192 pointer0.touch_orientation = 1;
193 193
194 PointerProperties pointer1(4, 5, 6); 194 PointerProperties pointer1(4, 5, 6);
195 pointer1.id = 3; 195 pointer1.id = 3;
196 pointer0.pressure = 25; 196 pointer0.pressure = 25;
197 pointer0.touch_minor = 30; 197 pointer0.touch_minor = 30;
198 pointer0.touch_major = 35; 198 pointer0.touch_major = 35;
199 pointer0.orientation = -1; 199 pointer0.touch_orientation = -1;
200 200
201 MotionEventGeneric event(MotionEvent::ACTION_MOVE, event_time, pointer0); 201 MotionEventGeneric event(MotionEvent::ACTION_MOVE, event_time, pointer0);
202 event.PushPointer(pointer1); 202 event.PushPointer(pointer1);
203 203
204 pointer0.x += 50; 204 pointer0.x += 50;
205 pointer1.x -= 50; 205 pointer1.x -= 50;
206 scoped_ptr<MotionEventGeneric> historical_event0(new MotionEventGeneric( 206 scoped_ptr<MotionEventGeneric> historical_event0(new MotionEventGeneric(
207 MotionEvent::ACTION_MOVE, historical_event_time0, pointer0)); 207 MotionEvent::ACTION_MOVE, historical_event_time0, pointer0));
208 historical_event0->PushPointer(pointer1); 208 historical_event0->PushPointer(pointer1);
209 209
210 pointer0.x += 100; 210 pointer0.x += 100;
211 pointer1.x -= 100; 211 pointer1.x -= 100;
212 scoped_ptr<MotionEventGeneric> historical_event1(new MotionEventGeneric( 212 scoped_ptr<MotionEventGeneric> historical_event1(new MotionEventGeneric(
213 MotionEvent::ACTION_MOVE, historical_event_time1, pointer0)); 213 MotionEvent::ACTION_MOVE, historical_event_time1, pointer0));
214 historical_event1->PushPointer(pointer1); 214 historical_event1->PushPointer(pointer1);
215 215
216 event.PushHistoricalEvent(historical_event0.Pass()); 216 event.PushHistoricalEvent(historical_event0.Pass());
217 event.PushHistoricalEvent(historical_event1.Pass()); 217 event.PushHistoricalEvent(historical_event1.Pass());
218 ASSERT_EQ(2U, event.GetHistorySize()); 218 ASSERT_EQ(2U, event.GetHistorySize());
219 ASSERT_EQ(2U, event.GetPointerCount()); 219 ASSERT_EQ(2U, event.GetPointerCount());
220 220
221 // Do a basic smoke exercise of event stringification to ensure things don't 221 // Do a basic smoke exercise of event stringification to ensure things don't
222 // explode in the process. 222 // explode in the process.
223 std::string event_string = test::ToString(event); 223 std::string event_string = test::ToString(event);
224 EXPECT_FALSE(event_string.empty()); 224 EXPECT_FALSE(event_string.empty());
225 } 225 }
226 226
227 } // namespace ui 227 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/motion_event_generic.cc ('k') | ui/events/gestures/motion_event_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698