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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 MotionEventAura event; | 483 MotionEventAura event; |
484 EXPECT_TRUE(event.OnTouch(TouchWithType(ET_TOUCH_PRESSED, id))); | 484 EXPECT_TRUE(event.OnTouch(TouchWithType(ET_TOUCH_PRESSED, id))); |
485 TouchEvent move0 = TouchWithPosition(ET_TOUCH_PRESSED, id, 10, 20, 10, 20); | 485 TouchEvent move0 = TouchWithPosition(ET_TOUCH_PRESSED, id, 10, 20, 10, 20); |
486 EXPECT_TRUE(event.OnTouch(move0)); | 486 EXPECT_TRUE(event.OnTouch(move0)); |
487 | 487 |
488 TouchEvent move1 = TouchWithPosition(ET_TOUCH_MOVED, id, 11, 21, 11, 21); | 488 TouchEvent move1 = TouchWithPosition(ET_TOUCH_MOVED, id, 11, 21, 11, 21); |
489 EXPECT_TRUE(event.OnTouch(move1)); | 489 EXPECT_TRUE(event.OnTouch(move1)); |
490 EXPECT_FALSE(event.OnTouch(move1)); | 490 EXPECT_FALSE(event.OnTouch(move1)); |
491 } | 491 } |
492 | 492 |
| 493 // Test after converting touch events into motion events, motion events should |
| 494 // have the same unique_event_id as touch events. |
| 495 TEST(MotionEventAuraTest, UniqueEventID) { |
| 496 MotionEventAura event; |
| 497 |
| 498 TouchEvent press0 = TouchWithType(ET_TOUCH_PRESSED, 3); |
| 499 EXPECT_TRUE(event.OnTouch(press0)); |
| 500 EXPECT_EQ(MotionEvent::ACTION_DOWN, event.GetAction()); |
| 501 ASSERT_EQ(1U, event.GetPointerCount()); |
| 502 EXPECT_EQ(event.GetUniqueEventId(), press0.unique_event_id()); |
| 503 |
| 504 TouchEvent press1 = TouchWithType(ET_TOUCH_PRESSED, 6); |
| 505 EXPECT_TRUE(event.OnTouch(press1)); |
| 506 EXPECT_EQ(MotionEvent::ACTION_POINTER_DOWN, event.GetAction()); |
| 507 EXPECT_EQ(2U, event.GetPointerCount()); |
| 508 EXPECT_EQ(event.GetUniqueEventId(), press1.unique_event_id()); |
| 509 } |
| 510 |
493 } // namespace ui | 511 } // namespace ui |
OLD | NEW |