| Index: ui/events/event_unittest.cc
|
| diff --git a/ui/events/event_unittest.cc b/ui/events/event_unittest.cc
|
| index 38ad283b5a9b6923cea437c51502563f772e6b92..8adf4e2e845f2d62ec785cedb2508926a44d2b63 100644
|
| --- a/ui/events/event_unittest.cc
|
| +++ b/ui/events/event_unittest.cc
|
| @@ -606,4 +606,103 @@ TEST(EventTest, TouchEventRotationAngleFixing) {
|
| }
|
| }
|
|
|
| +TEST(EventTest, PointerEventDetailsTouch) {
|
| + ui::TouchEvent touch_event_plain(ET_TOUCH_PRESSED, gfx::Point(0, 0), 0,
|
| + ui::EventTimeForNow());
|
| +
|
| + EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH,
|
| + touch_event_plain.pointer_details()->pointer_type());
|
| + EXPECT_EQ(0.0f, touch_event_plain.pointer_details()->radius_x());
|
| + EXPECT_EQ(0.0f, touch_event_plain.pointer_details()->radius_y());
|
| + EXPECT_EQ(0.0f, touch_event_plain.pointer_details()->force());
|
| + EXPECT_EQ(0.0f, touch_event_plain.pointer_details()->tilt_x());
|
| + EXPECT_EQ(0.0f, touch_event_plain.pointer_details()->tilt_y());
|
| +
|
| + EXPECT_EQ(0.0f, touch_event_plain.radius_x());
|
| + EXPECT_EQ(0.0f, touch_event_plain.radius_y());
|
| + EXPECT_EQ(0.0f, touch_event_plain.force());
|
| +
|
| + ui::TouchEvent touch_event_with_details(ET_TOUCH_PRESSED, gfx::Point(0, 0), 0,
|
| + 0, ui::EventTimeForNow(), 10.0f, 5.0f,
|
| + 0.0f, 15.0f);
|
| +
|
| + EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH,
|
| + touch_event_with_details.pointer_details()->pointer_type());
|
| + EXPECT_EQ(10.0f, touch_event_with_details.pointer_details()->radius_x());
|
| + EXPECT_EQ(5.0f, touch_event_with_details.pointer_details()->radius_y());
|
| + EXPECT_EQ(15.0f, touch_event_with_details.pointer_details()->force());
|
| + EXPECT_EQ(0.0f, touch_event_with_details.pointer_details()->tilt_x());
|
| + EXPECT_EQ(0.0f, touch_event_with_details.pointer_details()->tilt_y());
|
| +
|
| + EXPECT_EQ(10.0f, touch_event_with_details.radius_x());
|
| + EXPECT_EQ(5.0f, touch_event_with_details.radius_y());
|
| + EXPECT_EQ(15.0f, touch_event_with_details.force());
|
| +
|
| + touch_event_with_details.pointer_details()->set_radius_x(8.0f);
|
| + touch_event_with_details.pointer_details()->set_radius_y(7.0f);
|
| + touch_event_with_details.pointer_details()->set_force(21.0f);
|
| + touch_event_with_details.pointer_details()->set_tilt_x(45.0f);
|
| + touch_event_with_details.pointer_details()->set_tilt_y(-45.0f);
|
| +
|
| + ui::TouchEvent touch_event_copy(touch_event_with_details);
|
| + EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH,
|
| + touch_event_copy.pointer_details()->pointer_type());
|
| + EXPECT_EQ(8.0f, touch_event_copy.pointer_details()->radius_x());
|
| + EXPECT_EQ(7.0f, touch_event_copy.pointer_details()->radius_y());
|
| + EXPECT_EQ(21.0f, touch_event_copy.pointer_details()->force());
|
| + EXPECT_EQ(45.0f, touch_event_copy.pointer_details()->tilt_x());
|
| + EXPECT_EQ(-45.0f, touch_event_copy.pointer_details()->tilt_y());
|
| +}
|
| +
|
| +TEST(EventTest, PointerEventDetailsMouse) {
|
| + ui::MouseEvent mouse_event(ET_MOUSE_PRESSED, gfx::PointF(0, 0),
|
| + gfx::PointF(0, 0), ui::EventTimeForNow(), 0, 0);
|
| +
|
| + EXPECT_EQ(EventPointerType::POINTER_TYPE_MOUSE,
|
| + mouse_event.pointer_details()->pointer_type());
|
| + EXPECT_EQ(0.0f, mouse_event.pointer_details()->radius_x());
|
| + EXPECT_EQ(0.0f, mouse_event.pointer_details()->radius_y());
|
| + EXPECT_EQ(0.0f, mouse_event.pointer_details()->force());
|
| + EXPECT_EQ(0.0f, mouse_event.pointer_details()->tilt_x());
|
| + EXPECT_EQ(0.0f, mouse_event.pointer_details()->tilt_y());
|
| +
|
| + ui::MouseEvent mouse_event_copy(mouse_event);
|
| + EXPECT_EQ(EventPointerType::POINTER_TYPE_MOUSE,
|
| + mouse_event_copy.pointer_details()->pointer_type());
|
| + EXPECT_EQ(0.0f, mouse_event_copy.pointer_details()->radius_x());
|
| + EXPECT_EQ(0.0f, mouse_event_copy.pointer_details()->radius_y());
|
| + EXPECT_EQ(0.0f, mouse_event_copy.pointer_details()->force());
|
| + EXPECT_EQ(0.0f, mouse_event_copy.pointer_details()->tilt_x());
|
| + EXPECT_EQ(0.0f, mouse_event_copy.pointer_details()->tilt_y());
|
| +}
|
| +
|
| +TEST(EventTest, PointerEventDetailsStylus) {
|
| + ui::MouseEvent stylus_event(ET_MOUSE_PRESSED, gfx::PointF(0, 0),
|
| + gfx::PointF(0, 0), ui::EventTimeForNow(), 0, 0);
|
| + stylus_event.pointer_details()->set_pointer_type(
|
| + EventPointerType::POINTER_TYPE_PEN);
|
| + stylus_event.pointer_details()->set_radius_x(8.0f);
|
| + stylus_event.pointer_details()->set_radius_y(7.0f);
|
| + stylus_event.pointer_details()->set_force(21.0f);
|
| + stylus_event.pointer_details()->set_tilt_x(45.0f);
|
| + stylus_event.pointer_details()->set_tilt_y(-45.0f);
|
| +
|
| + EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
| + stylus_event.pointer_details()->pointer_type());
|
| + EXPECT_EQ(8.0f, stylus_event.pointer_details()->radius_x());
|
| + EXPECT_EQ(7.0f, stylus_event.pointer_details()->radius_y());
|
| + EXPECT_EQ(21.0f, stylus_event.pointer_details()->force());
|
| + EXPECT_EQ(45.0f, stylus_event.pointer_details()->tilt_x());
|
| + EXPECT_EQ(-45.0f, stylus_event.pointer_details()->tilt_y());
|
| +
|
| + ui::MouseEvent stylus_event_copy(stylus_event);
|
| + EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
| + stylus_event_copy.pointer_details()->pointer_type());
|
| + EXPECT_EQ(8.0f, stylus_event_copy.pointer_details()->radius_x());
|
| + EXPECT_EQ(7.0f, stylus_event_copy.pointer_details()->radius_y());
|
| + EXPECT_EQ(21.0f, stylus_event_copy.pointer_details()->force());
|
| + EXPECT_EQ(45.0f, stylus_event_copy.pointer_details()->tilt_x());
|
| + EXPECT_EQ(-45.0f, stylus_event_copy.pointer_details()->tilt_y());
|
| +}
|
| +
|
| } // namespace ui
|
|
|