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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 423 |
424 TEST(MotionEventAuraTest, ToolType) { | 424 TEST(MotionEventAuraTest, ToolType) { |
425 MotionEventAura event; | 425 MotionEventAura event; |
426 TouchEvent touch_event = TouchWithType(ET_TOUCH_PRESSED, 7); | 426 TouchEvent touch_event = TouchWithType(ET_TOUCH_PRESSED, 7); |
427 EXPECT_TRUE(event.OnTouch(touch_event)); | 427 EXPECT_TRUE(event.OnTouch(touch_event)); |
428 ASSERT_EQ(1U, event.GetPointerCount()); | 428 ASSERT_EQ(1U, event.GetPointerCount()); |
429 EXPECT_EQ(MotionEvent::TOOL_TYPE_FINGER, event.GetToolType(0)); | 429 EXPECT_EQ(MotionEvent::TOOL_TYPE_FINGER, event.GetToolType(0)); |
430 | 430 |
431 touch_event = TouchWithType(ET_TOUCH_RELEASED, 7); | 431 touch_event = TouchWithType(ET_TOUCH_RELEASED, 7); |
432 PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN, 5.0f, 5.0f, | 432 PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN, 5.0f, 5.0f, |
433 1.0f, 0.0f, 0.0f); | 433 1.0f, 0.0f, 0.0f, 0.0f, 0, 7); |
434 touch_event.set_pointer_details(pointer_details); | 434 touch_event.set_pointer_details(pointer_details); |
435 EXPECT_TRUE(event.OnTouch(touch_event)); | 435 EXPECT_TRUE(event.OnTouch(touch_event)); |
436 EXPECT_EQ(MotionEvent::TOOL_TYPE_STYLUS, event.GetToolType(0)); | 436 EXPECT_EQ(MotionEvent::TOOL_TYPE_STYLUS, event.GetToolType(0)); |
437 } | 437 } |
438 | 438 |
439 TEST(MotionEventAuraTest, Flags) { | 439 TEST(MotionEventAuraTest, Flags) { |
440 int ids[] = {7, 11}; | 440 int ids[] = {7, 11}; |
441 MotionEventAura event; | 441 MotionEventAura event; |
442 | 442 |
443 TouchEvent press0 = TouchWithType(ET_TOUCH_PRESSED, ids[0]); | 443 TouchEvent press0 = TouchWithType(ET_TOUCH_PRESSED, ids[0]); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 int id = i + kIdOffset; | 523 int id = i + kIdOffset; |
524 TouchEvent release = TouchWithType(ET_TOUCH_RELEASED, id); | 524 TouchEvent release = TouchWithType(ET_TOUCH_RELEASED, id); |
525 if (i < MotionEvent::MAX_TOUCH_POINT_COUNT) | 525 if (i < MotionEvent::MAX_TOUCH_POINT_COUNT) |
526 EXPECT_TRUE(event.OnTouch(release)); | 526 EXPECT_TRUE(event.OnTouch(release)); |
527 else | 527 else |
528 EXPECT_FALSE(event.OnTouch(release)); | 528 EXPECT_FALSE(event.OnTouch(release)); |
529 } | 529 } |
530 } | 530 } |
531 | 531 |
532 } // namespace ui | 532 } // namespace ui |
OLD | NEW |