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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 | 472 |
473 struct input_event mock_kernel_queue_move1[] = { | 473 struct input_event mock_kernel_queue_move1[] = { |
474 {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 40}, {{0, 0}, EV_SYN, SYN_REPORT, 0} | 474 {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 40}, {{0, 0}, EV_SYN, SYN_REPORT, 0} |
475 }; | 475 }; |
476 | 476 |
477 // Verify that it re-syncs after a SYN_REPORT. | 477 // Verify that it re-syncs after a SYN_REPORT. |
478 dev->ConfigureReadMock(mock_kernel_queue_move1, 2, 0); | 478 dev->ConfigureReadMock(mock_kernel_queue_move1, 2, 0); |
479 dev->ReadNow(); | 479 dev->ReadNow(); |
480 EXPECT_EQ(2u, dev->size()); | 480 EXPECT_EQ(2u, dev->size()); |
481 } | 481 } |
| 482 |
| 483 // crbug.com/407386 |
| 484 TEST_F(TouchEventConverterEvdevTest, |
| 485 DontChangeMultitouchPositionFromLegacyAxes) { |
| 486 ui::MockTouchEventConverterEvdev* dev = device(); |
| 487 |
| 488 struct input_event mock_kernel_queue[] = { |
| 489 {{0, 0}, EV_ABS, ABS_MT_SLOT, 0}, |
| 490 {{0, 0}, EV_ABS, ABS_MT_TRACKING_ID, 100}, |
| 491 {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 999}, |
| 492 {{0, 0}, EV_ABS, ABS_MT_POSITION_Y, 888}, |
| 493 {{0, 0}, EV_ABS, ABS_MT_PRESSURE, 55}, |
| 494 {{0, 0}, EV_ABS, ABS_MT_SLOT, 1}, |
| 495 {{0, 0}, EV_ABS, ABS_MT_TRACKING_ID, 200}, |
| 496 {{0, 0}, EV_ABS, ABS_MT_PRESSURE, 44}, |
| 497 {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 777}, |
| 498 {{0, 0}, EV_ABS, ABS_MT_POSITION_Y, 666}, |
| 499 {{0, 0}, EV_ABS, ABS_X, 999}, |
| 500 {{0, 0}, EV_ABS, ABS_Y, 888}, |
| 501 {{0, 0}, EV_ABS, ABS_PRESSURE, 55}, |
| 502 {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
| 503 }; |
| 504 |
| 505 // Check that two events are generated. |
| 506 dev->ConfigureReadMock(mock_kernel_queue, arraysize(mock_kernel_queue), 0); |
| 507 dev->ReadNow(); |
| 508 |
| 509 const unsigned int kExpectedEventCount = 2; |
| 510 EXPECT_EQ(kExpectedEventCount, dev->size()); |
| 511 if (kExpectedEventCount != dev->size()) |
| 512 return; |
| 513 |
| 514 ui::TouchEvent* ev0 = dev->event(0); |
| 515 ui::TouchEvent* ev1 = dev->event(1); |
| 516 |
| 517 EXPECT_EQ(0, ev0->touch_id()); |
| 518 EXPECT_EQ(999, ev0->x()); |
| 519 EXPECT_EQ(888, ev0->y()); |
| 520 EXPECT_FLOAT_EQ(0.8333333f, ev0->force()); |
| 521 |
| 522 EXPECT_EQ(1, ev1->touch_id()); |
| 523 EXPECT_EQ(777, ev1->x()); |
| 524 EXPECT_EQ(666, ev1->y()); |
| 525 EXPECT_FLOAT_EQ(0.4666666f, ev1->force()); |
| 526 } |
OLD | NEW |