| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <linux/input.h> | 5 #include <linux/input.h> |
| 6 #include <wayland-server.h> | 6 #include <wayland-server.h> |
| 7 | 7 |
| 8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event)); | 83 EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event)); |
| 84 | 84 |
| 85 Sync(); | 85 Sync(); |
| 86 | 86 |
| 87 ASSERT_TRUE(event); | 87 ASSERT_TRUE(event); |
| 88 ASSERT_TRUE(event->IsMouseEvent()); | 88 ASSERT_TRUE(event->IsMouseEvent()); |
| 89 auto mouse_event = event->AsMouseEvent(); | 89 auto mouse_event = event->AsMouseEvent(); |
| 90 EXPECT_EQ(ET_MOUSE_MOVED, mouse_event->type()); | 90 EXPECT_EQ(ET_MOUSE_MOVED, mouse_event->type()); |
| 91 EXPECT_EQ(0, mouse_event->button_flags()); | 91 EXPECT_EQ(0, mouse_event->button_flags()); |
| 92 EXPECT_EQ(0, mouse_event->changed_button_flags()); | 92 EXPECT_EQ(0, mouse_event->changed_button_flags()); |
| 93 // TODO(forney): Once crbug.com/337827 is solved, compare with the fractional | 93 EXPECT_EQ(gfx::PointF(10.75, 20.375), mouse_event->location_f()); |
| 94 // coordinates sent above. | 94 EXPECT_EQ(gfx::PointF(10.75, 20.375), mouse_event->root_location_f()); |
| 95 EXPECT_EQ(gfx::PointF(10, 20), mouse_event->location_f()); | |
| 96 EXPECT_EQ(gfx::PointF(10, 20), mouse_event->root_location_f()); | |
| 97 } | 95 } |
| 98 | 96 |
| 99 TEST_F(WaylandPointerTest, MotionDragged) { | 97 TEST_F(WaylandPointerTest, MotionDragged) { |
| 100 wl_pointer_send_enter(pointer->resource(), 1, surface->resource(), 0, 0); | 98 wl_pointer_send_enter(pointer->resource(), 1, surface->resource(), 0, 0); |
| 101 wl_pointer_send_button(pointer->resource(), 2, 1002, BTN_MIDDLE, | 99 wl_pointer_send_button(pointer->resource(), 2, 1002, BTN_MIDDLE, |
| 102 WL_POINTER_BUTTON_STATE_PRESSED); | 100 WL_POINTER_BUTTON_STATE_PRESSED); |
| 103 | 101 |
| 104 Sync(); | 102 Sync(); |
| 105 | 103 |
| 106 std::unique_ptr<Event> event; | 104 std::unique_ptr<Event> event; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 auto mouse_wheel_event = event->AsMouseWheelEvent(); | 221 auto mouse_wheel_event = event->AsMouseWheelEvent(); |
| 224 EXPECT_EQ(gfx::Vector2d(MouseWheelEvent::kWheelDelta, 0), | 222 EXPECT_EQ(gfx::Vector2d(MouseWheelEvent::kWheelDelta, 0), |
| 225 mouse_wheel_event->offset()); | 223 mouse_wheel_event->offset()); |
| 226 EXPECT_EQ(EF_LEFT_MOUSE_BUTTON, mouse_wheel_event->button_flags()); | 224 EXPECT_EQ(EF_LEFT_MOUSE_BUTTON, mouse_wheel_event->button_flags()); |
| 227 EXPECT_EQ(0, mouse_wheel_event->changed_button_flags()); | 225 EXPECT_EQ(0, mouse_wheel_event->changed_button_flags()); |
| 228 EXPECT_EQ(gfx::PointF(50, 75), mouse_wheel_event->location_f()); | 226 EXPECT_EQ(gfx::PointF(50, 75), mouse_wheel_event->location_f()); |
| 229 EXPECT_EQ(gfx::PointF(50, 75), mouse_wheel_event->root_location_f()); | 227 EXPECT_EQ(gfx::PointF(50, 75), mouse_wheel_event->root_location_f()); |
| 230 } | 228 } |
| 231 | 229 |
| 232 } // namespace ui | 230 } // namespace ui |
| OLD | NEW |