Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / events / gestures / motion_event_aura_unittest.cc
blob03a8dd7fff12e6c33e151fd09ea5d2d136a0a902
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
3 // found in the LICENSE file.
5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES
8 #include <cmath>
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/events/event.h"
12 #include "ui/events/gestures/motion_event_aura.h"
13 #include "ui/events/test/motion_event_test_utils.h"
15 namespace {
17 ui::TouchEvent TouchWithType(ui::EventType type, int id) {
18 return ui::TouchEvent(
19 type, gfx::PointF(0, 0), id, base::TimeDelta::FromMilliseconds(0));
22 ui::TouchEvent TouchWithPosition(ui::EventType type,
23 int id,
24 float x,
25 float y,
26 float raw_x,
27 float raw_y) {
28 ui::TouchEvent event(type,
29 gfx::PointF(x, y),
31 id,
32 base::TimeDelta::FromMilliseconds(0),
36 0);
37 event.set_root_location(gfx::PointF(raw_x, raw_y));
38 return event;
41 ui::TouchEvent TouchWithTapParams(ui::EventType type,
42 int id,
43 float radius_x,
44 float radius_y,
45 float rotation_angle,
46 float pressure) {
47 ui::TouchEvent event(type,
48 gfx::PointF(1, 1),
50 id,
51 base::TimeDelta::FromMilliseconds(0),
52 radius_x,
53 radius_y,
54 rotation_angle,
55 pressure);
56 event.set_root_location(gfx::PointF(1, 1));
57 return event;
60 ui::TouchEvent TouchWithTime(ui::EventType type, int id, int ms) {
61 return ui::TouchEvent(
62 type, gfx::PointF(0, 0), id, base::TimeDelta::FromMilliseconds(ms));
65 base::TimeTicks MsToTicks(int ms) {
66 return base::TimeTicks() + base::TimeDelta::FromMilliseconds(ms);
69 } // namespace
71 namespace ui {
73 TEST(MotionEventAuraTest, PointerCountAndIds) {
74 // Test that |PointerCount()| returns the correct number of pointers, and ids
75 // are assigned correctly.
76 int ids[] = {4, 6, 1};
78 MotionEventAura event;
79 EXPECT_EQ(0U, event.GetPointerCount());
81 TouchEvent press0 = TouchWithType(ET_TOUCH_PRESSED, ids[0]);
82 EXPECT_TRUE(event.OnTouch(press0));
83 EXPECT_EQ(1U, event.GetPointerCount());
85 EXPECT_EQ(ids[0], event.GetPointerId(0));
87 TouchEvent press1 = TouchWithType(ET_TOUCH_PRESSED, ids[1]);
88 EXPECT_TRUE(event.OnTouch(press1));
89 EXPECT_EQ(2U, event.GetPointerCount());
91 EXPECT_EQ(ids[0], event.GetPointerId(0));
92 EXPECT_EQ(ids[1], event.GetPointerId(1));
94 TouchEvent press2 = TouchWithType(ET_TOUCH_PRESSED, ids[2]);
95 EXPECT_TRUE(event.OnTouch(press2));
96 EXPECT_EQ(3U, event.GetPointerCount());
98 EXPECT_EQ(ids[0], event.GetPointerId(0));
99 EXPECT_EQ(ids[1], event.GetPointerId(1));
100 EXPECT_EQ(ids[2], event.GetPointerId(2));
102 TouchEvent release1 = TouchWithType(ET_TOUCH_RELEASED, ids[1]);
103 EXPECT_TRUE(event.OnTouch(release1));
104 event.CleanupRemovedTouchPoints(release1);
105 EXPECT_EQ(2U, event.GetPointerCount());
107 EXPECT_EQ(ids[0], event.GetPointerId(0));
108 EXPECT_EQ(ids[2], event.GetPointerId(1));
110 // Test cloning of pointer count and id information.
111 // TODO(mustaq): Make a separate clone test, crbug.com/450655
112 scoped_ptr<MotionEvent> clone = event.Clone();
113 EXPECT_EQ(2U, clone->GetPointerCount());
114 EXPECT_EQ(ids[0], clone->GetPointerId(0));
115 EXPECT_EQ(ids[2], clone->GetPointerId(1));
116 EXPECT_EQ(event.GetUniqueEventId(), clone->GetUniqueEventId());
117 EXPECT_EQ(test::ToString(event), test::ToString(*clone));
119 TouchEvent release0 = TouchWithType(ET_TOUCH_RELEASED, ids[0]);
120 EXPECT_TRUE(event.OnTouch(release0));
121 event.CleanupRemovedTouchPoints(release0);
122 EXPECT_EQ(1U, event.GetPointerCount());
124 EXPECT_EQ(ids[2], event.GetPointerId(0));
126 TouchEvent release2 = TouchWithType(ET_TOUCH_RELEASED, ids[2]);
127 EXPECT_TRUE(event.OnTouch(release2));
128 event.CleanupRemovedTouchPoints(release2);
129 EXPECT_EQ(0U, event.GetPointerCount());
132 TEST(MotionEventAuraTest, GetActionIndexAfterRemoval) {
133 // Test that |GetActionIndex()| returns the correct index when points have
134 // been removed.
135 int ids[] = {4, 6, 9};
137 MotionEventAura event;
138 EXPECT_EQ(0U, event.GetPointerCount());
140 TouchEvent press0 = TouchWithType(ET_TOUCH_PRESSED, ids[0]);
141 EXPECT_TRUE(event.OnTouch(press0));
142 TouchEvent press1 = TouchWithType(ET_TOUCH_PRESSED, ids[1]);
143 EXPECT_TRUE(event.OnTouch(press1));
144 EXPECT_EQ(1, event.GetActionIndex());
145 TouchEvent press2 = TouchWithType(ET_TOUCH_PRESSED, ids[2]);
146 EXPECT_TRUE(event.OnTouch(press2));
147 EXPECT_EQ(2, event.GetActionIndex());
148 EXPECT_EQ(3U, event.GetPointerCount());
150 TouchEvent release1 = TouchWithType(ET_TOUCH_RELEASED, ids[1]);
151 EXPECT_TRUE(event.OnTouch(release1));
152 EXPECT_EQ(1, event.GetActionIndex());
153 event.CleanupRemovedTouchPoints(release1);
154 EXPECT_EQ(2U, event.GetPointerCount());
156 TouchEvent release2 = TouchWithType(ET_TOUCH_RELEASED, ids[0]);
157 EXPECT_TRUE(event.OnTouch(release2));
158 EXPECT_EQ(0, event.GetActionIndex());
159 event.CleanupRemovedTouchPoints(release2);
160 EXPECT_EQ(1U, event.GetPointerCount());
162 TouchEvent release0 = TouchWithType(ET_TOUCH_RELEASED, ids[2]);
163 EXPECT_TRUE(event.OnTouch(release0));
164 event.CleanupRemovedTouchPoints(release0);
165 EXPECT_EQ(0U, event.GetPointerCount());
168 TEST(MotionEventAuraTest, PointerLocations) {
169 // Test that location information is stored correctly.
170 MotionEventAura event;
172 const float kRawOffsetX = 11.1f;
173 const float kRawOffsetY = 13.3f;
175 int ids[] = {15, 13};
176 float x;
177 float y;
178 float raw_x;
179 float raw_y;
181 x = 14.4f;
182 y = 17.3f;
183 raw_x = x + kRawOffsetX;
184 raw_y = y + kRawOffsetY;
185 TouchEvent press0 =
186 TouchWithPosition(ET_TOUCH_PRESSED, ids[0], x, y, raw_x, raw_y);
187 EXPECT_TRUE(event.OnTouch(press0));
189 EXPECT_EQ(1U, event.GetPointerCount());
190 EXPECT_FLOAT_EQ(x, event.GetX(0));
191 EXPECT_FLOAT_EQ(y, event.GetY(0));
192 EXPECT_FLOAT_EQ(raw_x, event.GetRawX(0));
193 EXPECT_FLOAT_EQ(raw_y, event.GetRawY(0));
195 x = 17.8f;
196 y = 12.1f;
197 raw_x = x + kRawOffsetX;
198 raw_y = y + kRawOffsetY;
199 TouchEvent press1 =
200 TouchWithPosition(ET_TOUCH_PRESSED, ids[1], x, y, raw_x, raw_y);
201 EXPECT_TRUE(event.OnTouch(press1));
203 EXPECT_EQ(2U, event.GetPointerCount());
204 EXPECT_FLOAT_EQ(x, event.GetX(1));
205 EXPECT_FLOAT_EQ(y, event.GetY(1));
206 EXPECT_FLOAT_EQ(raw_x, event.GetRawX(1));
207 EXPECT_FLOAT_EQ(raw_y, event.GetRawY(1));
209 // Test cloning of pointer location information.
210 scoped_ptr<MotionEvent> clone = event.Clone();
211 EXPECT_EQ(event.GetUniqueEventId(), clone->GetUniqueEventId());
212 EXPECT_EQ(test::ToString(event), test::ToString(*clone));
213 EXPECT_EQ(2U, clone->GetPointerCount());
214 EXPECT_FLOAT_EQ(x, clone->GetX(1));
215 EXPECT_FLOAT_EQ(y, clone->GetY(1));
216 EXPECT_FLOAT_EQ(raw_x, clone->GetRawX(1));
217 EXPECT_FLOAT_EQ(raw_y, clone->GetRawY(1));
219 x = 27.9f;
220 y = 22.3f;
221 raw_x = x + kRawOffsetX;
222 raw_y = y + kRawOffsetY;
223 TouchEvent move1 =
224 TouchWithPosition(ET_TOUCH_MOVED, ids[1], x, y, raw_x, raw_y);
225 EXPECT_TRUE(event.OnTouch(move1));
227 EXPECT_FLOAT_EQ(x, event.GetX(1));
228 EXPECT_FLOAT_EQ(y, event.GetY(1));
229 EXPECT_FLOAT_EQ(raw_x, event.GetRawX(1));
230 EXPECT_FLOAT_EQ(raw_y, event.GetRawY(1));
232 x = 34.6f;
233 y = 23.8f;
234 raw_x = x + kRawOffsetX;
235 raw_y = y + kRawOffsetY;
236 TouchEvent move0 =
237 TouchWithPosition(ET_TOUCH_MOVED, ids[0], x, y, raw_x, raw_y);
238 EXPECT_TRUE(event.OnTouch(move0));
240 EXPECT_FLOAT_EQ(x, event.GetX(0));
241 EXPECT_FLOAT_EQ(y, event.GetY(0));
242 EXPECT_FLOAT_EQ(raw_x, event.GetRawX(0));
243 EXPECT_FLOAT_EQ(raw_y, event.GetRawY(0));
246 TEST(MotionEventAuraTest, TapParams) {
247 // Test that touch params are stored correctly.
248 MotionEventAura event;
250 int ids[] = {15, 13, 25, 23};
252 float radius_x;
253 float radius_y;
254 float rotation_angle;
255 float pressure;
257 // Test case: radius_x > radius_y, rotation_angle < 90
258 radius_x = 123.45f;
259 radius_y = 67.89f;
260 rotation_angle = 23.f;
261 pressure = 0.123f;
262 TouchEvent press0 = TouchWithTapParams(
263 ET_TOUCH_PRESSED, ids[0], radius_x, radius_y, rotation_angle, pressure);
264 EXPECT_TRUE(event.OnTouch(press0));
266 EXPECT_EQ(1U, event.GetPointerCount());
267 EXPECT_FLOAT_EQ(radius_x, event.GetTouchMajor(0) / 2);
268 EXPECT_FLOAT_EQ(radius_y, event.GetTouchMinor(0) / 2);
269 EXPECT_FLOAT_EQ(rotation_angle, event.GetOrientation(0) * 180 / M_PI + 90);
270 EXPECT_FLOAT_EQ(pressure, event.GetPressure(0));
272 // Test case: radius_x < radius_y, rotation_angle < 90
273 radius_x = 67.89f;
274 radius_y = 123.45f;
275 rotation_angle = 46.f;
276 pressure = 0.456f;
277 TouchEvent press1 = TouchWithTapParams(
278 ET_TOUCH_PRESSED, ids[1], radius_x, radius_y, rotation_angle, pressure);
279 EXPECT_TRUE(event.OnTouch(press1));
281 EXPECT_EQ(2U, event.GetPointerCount());
282 EXPECT_FLOAT_EQ(radius_y, event.GetTouchMajor(1) / 2);
283 EXPECT_FLOAT_EQ(radius_x, event.GetTouchMinor(1) / 2);
284 EXPECT_FLOAT_EQ(rotation_angle, event.GetOrientation(1) * 180 / M_PI);
285 EXPECT_FLOAT_EQ(pressure, event.GetPressure(1));
287 // Test cloning of tap params
288 // TODO(mustaq): Make a separate clone test, crbug.com/450655
289 scoped_ptr<MotionEvent> clone = event.Clone();
290 EXPECT_EQ(event.GetUniqueEventId(), clone->GetUniqueEventId());
291 EXPECT_EQ(test::ToString(event), test::ToString(*clone));
292 EXPECT_EQ(2U, clone->GetPointerCount());
293 EXPECT_FLOAT_EQ(radius_y, clone->GetTouchMajor(1) / 2);
294 EXPECT_FLOAT_EQ(radius_x, clone->GetTouchMinor(1) / 2);
295 EXPECT_FLOAT_EQ(rotation_angle, clone->GetOrientation(1) * 180 / M_PI);
296 EXPECT_FLOAT_EQ(pressure, clone->GetPressure(1));
298 // TODO(mustaq): The move test seems out-of-scope here, crbug.com/450655
299 radius_x = 76.98f;
300 radius_y = 321.54f;
301 rotation_angle = 64.f;
302 pressure = 0.654f;
303 TouchEvent move1 = TouchWithTapParams(
304 ET_TOUCH_MOVED, ids[1], radius_x, radius_y, rotation_angle, pressure);
305 move1.set_location(gfx::Point(20, 21));
306 EXPECT_TRUE(event.OnTouch(move1));
308 EXPECT_EQ(2U, event.GetPointerCount());
309 EXPECT_FLOAT_EQ(radius_y, event.GetTouchMajor(1) / 2);
310 EXPECT_FLOAT_EQ(radius_x, event.GetTouchMinor(1) / 2);
311 EXPECT_FLOAT_EQ(rotation_angle, event.GetOrientation(1) * 180 / M_PI);
312 EXPECT_FLOAT_EQ(pressure, event.GetPressure(1));
314 // Test case: radius_x > radius_y, rotation_angle > 90
315 radius_x = 123.45f;
316 radius_y = 67.89f;
317 rotation_angle = 92.f;
318 pressure = 0.789f;
319 TouchEvent press2 = TouchWithTapParams(
320 ET_TOUCH_PRESSED, ids[2], radius_x, radius_y, rotation_angle, pressure);
321 EXPECT_TRUE(event.OnTouch(press2));
323 EXPECT_EQ(3U, event.GetPointerCount());
324 EXPECT_FLOAT_EQ(radius_x, event.GetTouchMajor(2) / 2);
325 EXPECT_FLOAT_EQ(radius_y, event.GetTouchMinor(2) / 2);
326 EXPECT_FLOAT_EQ(rotation_angle, event.GetOrientation(2) * 180 / M_PI + 90);
327 EXPECT_FLOAT_EQ(pressure, event.GetPressure(2));
329 // Test case: radius_x < radius_y, rotation_angle > 90
330 radius_x = 67.89f;
331 radius_y = 123.45f;
332 rotation_angle = 135.f;
333 pressure = 0.012f;
334 TouchEvent press3 = TouchWithTapParams(
335 ET_TOUCH_PRESSED, ids[3], radius_x, radius_y, rotation_angle, pressure);
336 EXPECT_TRUE(event.OnTouch(press3));
338 EXPECT_EQ(4U, event.GetPointerCount());
339 EXPECT_FLOAT_EQ(radius_y, event.GetTouchMajor(3) / 2);
340 EXPECT_FLOAT_EQ(radius_x, event.GetTouchMinor(3) / 2);
341 EXPECT_FLOAT_EQ(rotation_angle, event.GetOrientation(3) * 180 / M_PI + 180);
342 EXPECT_FLOAT_EQ(pressure, event.GetPressure(3));
345 TEST(MotionEventAuraTest, Timestamps) {
346 // Test that timestamp information is stored and converted correctly.
347 MotionEventAura event;
348 int ids[] = {7, 13};
349 int times_in_ms[] = {59436, 60263, 82175};
351 TouchEvent press0 = TouchWithTime(
352 ui::ET_TOUCH_PRESSED, ids[0], times_in_ms[0]);
353 EXPECT_TRUE(event.OnTouch(press0));
354 EXPECT_EQ(MsToTicks(times_in_ms[0]), event.GetEventTime());
356 TouchEvent press1 = TouchWithTime(
357 ui::ET_TOUCH_PRESSED, ids[1], times_in_ms[1]);
358 EXPECT_TRUE(event.OnTouch(press1));
359 EXPECT_EQ(MsToTicks(times_in_ms[1]), event.GetEventTime());
361 TouchEvent move0 = TouchWithTime(
362 ui::ET_TOUCH_MOVED, ids[0], times_in_ms[2]);
363 move0.set_location(gfx::PointF(12, 21));
364 EXPECT_TRUE(event.OnTouch(move0));
365 EXPECT_EQ(MsToTicks(times_in_ms[2]), event.GetEventTime());
367 // Test cloning of timestamp information.
368 scoped_ptr<MotionEvent> clone = event.Clone();
369 EXPECT_EQ(MsToTicks(times_in_ms[2]), clone->GetEventTime());
372 TEST(MotionEventAuraTest, CachedAction) {
373 // Test that the cached action and cached action index are correct.
374 int ids[] = {4, 6};
375 MotionEventAura event;
377 TouchEvent press0 = TouchWithType(ET_TOUCH_PRESSED, ids[0]);
378 EXPECT_TRUE(event.OnTouch(press0));
379 EXPECT_EQ(MotionEvent::ACTION_DOWN, event.GetAction());
380 EXPECT_EQ(1U, event.GetPointerCount());
382 TouchEvent press1 = TouchWithType(ET_TOUCH_PRESSED, ids[1]);
383 EXPECT_TRUE(event.OnTouch(press1));
384 EXPECT_EQ(MotionEvent::ACTION_POINTER_DOWN, event.GetAction());
385 EXPECT_EQ(1, event.GetActionIndex());
386 EXPECT_EQ(2U, event.GetPointerCount());
388 // Test cloning of CachedAction information.
389 scoped_ptr<MotionEvent> clone = event.Clone();
390 EXPECT_EQ(MotionEvent::ACTION_POINTER_DOWN, clone->GetAction());
391 EXPECT_EQ(1, clone->GetActionIndex());
393 TouchEvent move0 = TouchWithType(ET_TOUCH_MOVED, ids[0]);
394 move0.set_location(gfx::PointF(10, 12));
395 EXPECT_TRUE(event.OnTouch(move0));
396 EXPECT_EQ(MotionEvent::ACTION_MOVE, event.GetAction());
397 EXPECT_EQ(2U, event.GetPointerCount());
399 TouchEvent release0 = TouchWithType(ET_TOUCH_RELEASED, ids[0]);
400 EXPECT_TRUE(event.OnTouch(release0));
401 EXPECT_EQ(MotionEvent::ACTION_POINTER_UP, event.GetAction());
402 EXPECT_EQ(2U, event.GetPointerCount());
403 event.CleanupRemovedTouchPoints(release0);
404 EXPECT_EQ(1U, event.GetPointerCount());
406 TouchEvent release1 = TouchWithType(ET_TOUCH_RELEASED, ids[1]);
407 EXPECT_TRUE(event.OnTouch(release1));
408 EXPECT_EQ(MotionEvent::ACTION_UP, event.GetAction());
409 EXPECT_EQ(1U, event.GetPointerCount());
410 event.CleanupRemovedTouchPoints(release1);
411 EXPECT_EQ(0U, event.GetPointerCount());
414 TEST(MotionEventAuraTest, Cancel) {
415 int ids[] = {4, 6};
416 MotionEventAura event;
418 TouchEvent press0 = TouchWithType(ET_TOUCH_PRESSED, ids[0]);
419 EXPECT_TRUE(event.OnTouch(press0));
420 EXPECT_EQ(MotionEvent::ACTION_DOWN, event.GetAction());
421 EXPECT_EQ(1U, event.GetPointerCount());
423 TouchEvent press1 = TouchWithType(ET_TOUCH_PRESSED, ids[1]);
424 EXPECT_TRUE(event.OnTouch(press1));
425 EXPECT_EQ(MotionEvent::ACTION_POINTER_DOWN, event.GetAction());
426 EXPECT_EQ(1, event.GetActionIndex());
427 EXPECT_EQ(2U, event.GetPointerCount());
429 scoped_ptr<MotionEvent> cancel = event.Cancel();
430 EXPECT_EQ(MotionEvent::ACTION_CANCEL, cancel->GetAction());
431 EXPECT_EQ(2U, cancel->GetPointerCount());
434 TEST(MotionEventAuraTest, ToolType) {
435 MotionEventAura event;
437 // For now, all pointers have an unknown tool type.
438 // TODO(jdduke): Expand this test when ui::TouchEvent identifies the source
439 // touch type, crbug.com/404128.
440 EXPECT_TRUE(event.OnTouch(TouchWithType(ET_TOUCH_PRESSED, 7)));
441 ASSERT_EQ(1U, event.GetPointerCount());
442 EXPECT_EQ(MotionEvent::TOOL_TYPE_UNKNOWN, event.GetToolType(0));
445 TEST(MotionEventAuraTest, Flags) {
446 int ids[] = {7, 11};
447 MotionEventAura event;
449 TouchEvent press0 = TouchWithType(ET_TOUCH_PRESSED, ids[0]);
450 press0.set_flags(EF_CONTROL_DOWN);
451 EXPECT_TRUE(event.OnTouch(press0));
452 EXPECT_EQ(EF_CONTROL_DOWN, event.GetFlags());
454 TouchEvent press1 = TouchWithType(ET_TOUCH_PRESSED, ids[1]);
455 press1.set_flags(EF_CONTROL_DOWN | EF_CAPS_LOCK_DOWN);
456 EXPECT_TRUE(event.OnTouch(press1));
457 EXPECT_EQ(EF_CONTROL_DOWN | EF_CAPS_LOCK_DOWN, event.GetFlags());
460 // Once crbug.com/446852 is fixed, we should ignore redundant presses.
461 TEST(MotionEventAuraTest, DoesntIgnoreRedundantPresses) {
462 const int id = 7;
463 const int position_1 = 10;
464 const int position_2 = 23;
466 MotionEventAura event;
467 TouchEvent press1 = TouchWithPosition(ET_TOUCH_PRESSED, id, position_1,
468 position_1, position_1, position_1);
469 EXPECT_TRUE(event.OnTouch(press1));
470 TouchEvent press2 = TouchWithPosition(ET_TOUCH_PRESSED, id, position_2,
471 position_2, position_2, position_2);
472 EXPECT_TRUE(event.OnTouch(press2));
474 EXPECT_EQ(1U, event.GetPointerCount());
475 EXPECT_FLOAT_EQ(position_2, event.GetX(0));
478 TEST(MotionEventAuraTest, IgnoresEventsWithoutPress) {
479 int id = 7;
480 MotionEventAura event;
481 EXPECT_FALSE(event.OnTouch(TouchWithType(ET_TOUCH_MOVED, id)));
484 TEST(MotionEventAuraTest, IgnoresStationaryMoves) {
485 int id = 7;
486 MotionEventAura event;
487 EXPECT_TRUE(event.OnTouch(TouchWithType(ET_TOUCH_PRESSED, id)));
488 TouchEvent move0 = TouchWithPosition(ET_TOUCH_PRESSED, id, 10, 20, 10, 20);
489 EXPECT_TRUE(event.OnTouch(move0));
491 TouchEvent move1 = TouchWithPosition(ET_TOUCH_MOVED, id, 11, 21, 11, 21);
492 EXPECT_TRUE(event.OnTouch(move1));
493 EXPECT_FALSE(event.OnTouch(move1));
496 // Test after converting touch events into motion events, motion events should
497 // have the same unique_event_id as touch events.
498 TEST(MotionEventAuraTest, UniqueEventID) {
499 MotionEventAura event;
501 TouchEvent press0 = TouchWithType(ET_TOUCH_PRESSED, 3);
502 EXPECT_TRUE(event.OnTouch(press0));
503 EXPECT_EQ(MotionEvent::ACTION_DOWN, event.GetAction());
504 ASSERT_EQ(1U, event.GetPointerCount());
505 EXPECT_EQ(event.GetUniqueEventId(), press0.unique_event_id());
507 TouchEvent press1 = TouchWithType(ET_TOUCH_PRESSED, 6);
508 EXPECT_TRUE(event.OnTouch(press1));
509 EXPECT_EQ(MotionEvent::ACTION_POINTER_DOWN, event.GetAction());
510 EXPECT_EQ(2U, event.GetPointerCount());
511 EXPECT_EQ(event.GetUniqueEventId(), press1.unique_event_id());
514 } // namespace ui