| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/events/event.h" | 5 #include "ui/events/event.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 TEST(EventTest, PointerDetailsStylus) { | 679 TEST(EventTest, PointerDetailsStylus) { |
| 680 ui::MouseEvent stylus_event(ET_MOUSE_PRESSED, gfx::Point(0, 0), | 680 ui::MouseEvent stylus_event(ET_MOUSE_PRESSED, gfx::Point(0, 0), |
| 681 gfx::Point(0, 0), ui::EventTimeForNow(), 0, 0); | 681 gfx::Point(0, 0), ui::EventTimeForNow(), 0, 0); |
| 682 ui::PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN, | 682 ui::PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN, |
| 683 /* radius_x */ 0.0f, | 683 /* radius_x */ 0.0f, |
| 684 /* radius_y */ 0.0f, | 684 /* radius_y */ 0.0f, |
| 685 /* force */ 21.0f, | 685 /* force */ 21.0f, |
| 686 /* tilt_x */ 45.0f, | 686 /* tilt_x */ 45.0f, |
| 687 /* tilt_y */ -45.0f, | 687 /* tilt_y */ -45.0f, |
| 688 /* tangential_pressure */ 0.7f, | 688 /* tangential_pressure */ 0.7f, |
| 689 /* twist */ 196); | 689 /* twist */ 196, |
| 690 /* pointer_id*/ 0); |
| 690 | 691 |
| 691 stylus_event.set_pointer_details(pointer_details); | 692 stylus_event.set_pointer_details(pointer_details); |
| 692 EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN, | 693 EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN, |
| 693 stylus_event.pointer_details().pointer_type); | 694 stylus_event.pointer_details().pointer_type); |
| 694 EXPECT_EQ(21.0f, stylus_event.pointer_details().force); | 695 EXPECT_EQ(21.0f, stylus_event.pointer_details().force); |
| 695 EXPECT_EQ(45.0f, stylus_event.pointer_details().tilt_x); | 696 EXPECT_EQ(45.0f, stylus_event.pointer_details().tilt_x); |
| 696 EXPECT_EQ(-45.0f, stylus_event.pointer_details().tilt_y); | 697 EXPECT_EQ(-45.0f, stylus_event.pointer_details().tilt_y); |
| 697 EXPECT_EQ(0.0f, stylus_event.pointer_details().radius_x); | 698 EXPECT_EQ(0.0f, stylus_event.pointer_details().radius_x); |
| 698 EXPECT_EQ(0.0f, stylus_event.pointer_details().radius_y); | 699 EXPECT_EQ(0.0f, stylus_event.pointer_details().radius_y); |
| 699 EXPECT_EQ(0.7f, stylus_event.pointer_details().tangential_pressure); | 700 EXPECT_EQ(0.7f, stylus_event.pointer_details().tangential_pressure); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 716 EXPECT_EQ(0.0f, touch_event.pointer_details().tilt_x); | 717 EXPECT_EQ(0.0f, touch_event.pointer_details().tilt_x); |
| 717 EXPECT_EQ(0.0f, touch_event.pointer_details().tilt_y); | 718 EXPECT_EQ(0.0f, touch_event.pointer_details().tilt_y); |
| 718 | 719 |
| 719 ui::PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN, | 720 ui::PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN, |
| 720 /* radius_x */ 5.0f, | 721 /* radius_x */ 5.0f, |
| 721 /* radius_y */ 6.0f, | 722 /* radius_y */ 6.0f, |
| 722 /* force */ 21.0f, | 723 /* force */ 21.0f, |
| 723 /* tilt_x */ 45.0f, | 724 /* tilt_x */ 45.0f, |
| 724 /* tilt_y */ -45.0f, | 725 /* tilt_y */ -45.0f, |
| 725 /* tangential_pressure */ 0.7f, | 726 /* tangential_pressure */ 0.7f, |
| 726 /* twist */ 196); | 727 /* twist */ 196, |
| 728 /* pointer_id*/ 0); |
| 727 touch_event.set_pointer_details(pointer_details); | 729 touch_event.set_pointer_details(pointer_details); |
| 728 | 730 |
| 729 EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN, | 731 EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN, |
| 730 touch_event.pointer_details().pointer_type); | 732 touch_event.pointer_details().pointer_type); |
| 731 EXPECT_EQ(21.0f, touch_event.pointer_details().force); | 733 EXPECT_EQ(21.0f, touch_event.pointer_details().force); |
| 732 EXPECT_EQ(45.0f, touch_event.pointer_details().tilt_x); | 734 EXPECT_EQ(45.0f, touch_event.pointer_details().tilt_x); |
| 733 EXPECT_EQ(-45.0f, touch_event.pointer_details().tilt_y); | 735 EXPECT_EQ(-45.0f, touch_event.pointer_details().tilt_y); |
| 734 EXPECT_EQ(5.0f, touch_event.pointer_details().radius_x); | 736 EXPECT_EQ(5.0f, touch_event.pointer_details().radius_x); |
| 735 EXPECT_EQ(6.0f, touch_event.pointer_details().radius_y); | 737 EXPECT_EQ(6.0f, touch_event.pointer_details().radius_y); |
| 736 EXPECT_EQ(0.7f, touch_event.pointer_details().tangential_pressure); | 738 EXPECT_EQ(0.7f, touch_event.pointer_details().tangential_pressure); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 XButtonEvent* button_event = &(native_event.xbutton); | 1043 XButtonEvent* button_event = &(native_event.xbutton); |
| 1042 button_event->type = ButtonPress; | 1044 button_event->type = ButtonPress; |
| 1043 button_event->button = 4; // A valid wheel button number between min and max. | 1045 button_event->button = 4; // A valid wheel button number between min and max. |
| 1044 MouseWheelEvent mouse_ev(&native_event); | 1046 MouseWheelEvent mouse_ev(&native_event); |
| 1045 | 1047 |
| 1046 histogram_tester.ExpectTotalCount("Event.Latency.OS.MOUSE_WHEEL", 1); | 1048 histogram_tester.ExpectTotalCount("Event.Latency.OS.MOUSE_WHEEL", 1); |
| 1047 #endif | 1049 #endif |
| 1048 } | 1050 } |
| 1049 | 1051 |
| 1050 } // namespace ui | 1052 } // namespace ui |
| OLD | NEW |