| 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 #include <errno.h> | 5 #include <errno.h> |
| 6 #include <fcntl.h> | 6 #include <fcntl.h> |
| 7 #include <linux/input.h> | 7 #include <linux/input.h> |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 {{0, 0}, EV_SYN, SYN_REPORT, 0}, | 416 {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
| 417 }; | 417 }; |
| 418 | 418 |
| 419 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); | 419 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); |
| 420 EXPECT_EQ(3u, size()); | 420 EXPECT_EQ(3u, size()); |
| 421 | 421 |
| 422 ui::MouseEvent* event = dispatched_event(0); | 422 ui::MouseEvent* event = dispatched_event(0); |
| 423 EXPECT_EQ(ui::ET_MOUSE_MOVED, event->type()); | 423 EXPECT_EQ(ui::ET_MOUSE_MOVED, event->type()); |
| 424 EXPECT_EQ(ui::EventPointerType::POINTER_TYPE_PEN, | 424 EXPECT_EQ(ui::EventPointerType::POINTER_TYPE_PEN, |
| 425 event->pointer_details().pointer_type()); | 425 event->pointer_details().pointer_type()); |
| 426 EXPECT_FLOAT_EQ((90.0f * 68) / 127, event->pointer_details().tilt_x()); | 426 EXPECT_FLOAT_EQ(5.625f, event->pointer_details().tilt_x()); |
| 427 EXPECT_FLOAT_EQ((90.0f * 64) / 127, event->pointer_details().tilt_y()); | 427 EXPECT_FLOAT_EQ(0.f, event->pointer_details().tilt_y()); |
| 428 event = dispatched_event(1); | 428 event = dispatched_event(1); |
| 429 EXPECT_EQ(ui::ET_MOUSE_PRESSED, event->type()); | 429 EXPECT_EQ(ui::ET_MOUSE_PRESSED, event->type()); |
| 430 EXPECT_EQ(ui::EventPointerType::POINTER_TYPE_PEN, | 430 EXPECT_EQ(ui::EventPointerType::POINTER_TYPE_PEN, |
| 431 event->pointer_details().pointer_type()); | 431 event->pointer_details().pointer_type()); |
| 432 EXPECT_FLOAT_EQ((float)992 / 2047, event->pointer_details().force()); | 432 EXPECT_FLOAT_EQ((float)992 / 2047, event->pointer_details().force()); |
| 433 EXPECT_EQ(true, event->IsLeftMouseButton()); | 433 EXPECT_EQ(true, event->IsLeftMouseButton()); |
| 434 event = dispatched_event(2); | 434 event = dispatched_event(2); |
| 435 EXPECT_EQ(ui::EventPointerType::POINTER_TYPE_PEN, | 435 EXPECT_EQ(ui::EventPointerType::POINTER_TYPE_PEN, |
| 436 event->pointer_details().pointer_type()); | 436 event->pointer_details().pointer_type()); |
| 437 EXPECT_EQ(ui::ET_MOUSE_RELEASED, event->type()); | 437 EXPECT_EQ(ui::ET_MOUSE_RELEASED, event->type()); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 | 498 |
| 499 struct input_event mock_kernel_queue[] = { | 499 struct input_event mock_kernel_queue[] = { |
| 500 {{0, 0}, EV_ABS, ABS_X, 0}, | 500 {{0, 0}, EV_ABS, ABS_X, 0}, |
| 501 {{0, 0}, EV_ABS, ABS_Y, 0}, | 501 {{0, 0}, EV_ABS, ABS_Y, 0}, |
| 502 {{0, 0}, EV_SYN, SYN_REPORT, 0}, | 502 {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
| 503 }; | 503 }; |
| 504 | 504 |
| 505 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); | 505 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); |
| 506 EXPECT_EQ(0u, size()); | 506 EXPECT_EQ(0u, size()); |
| 507 } | 507 } |
| OLD | NEW |