Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: ui/events/ozone/evdev/tablet_event_converter_evdev_unittest.cc

Issue 1294523004: ozone: Handle pressure and tilt for stylus devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new-pe-details
Patch Set: Drop now unused mutators. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/events/ozone/evdev/tablet_event_converter_evdev.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 {{0, 0}, EV_ABS, ABS_MISC, 0}, 414 {{0, 0}, EV_ABS, ABS_MISC, 0},
415 {{0, 0}, EV_MSC, MSC_SERIAL, 897618290}, 415 {{0, 0}, EV_MSC, MSC_SERIAL, 897618290},
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,
425 event->pointer_details().pointer_type());
426 EXPECT_FLOAT_EQ((90.0f * 68) / 127, event->pointer_details().tilt_x());
427 EXPECT_FLOAT_EQ((90.0f * 64) / 127, event->pointer_details().tilt_y());
424 event = dispatched_event(1); 428 event = dispatched_event(1);
425 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,
431 event->pointer_details().pointer_type());
432 EXPECT_FLOAT_EQ((float)992 / 2047, event->pointer_details().force());
426 EXPECT_EQ(true, event->IsLeftMouseButton()); 433 EXPECT_EQ(true, event->IsLeftMouseButton());
427 event = dispatched_event(2); 434 event = dispatched_event(2);
435 EXPECT_EQ(ui::EventPointerType::POINTER_TYPE_PEN,
436 event->pointer_details().pointer_type());
428 EXPECT_EQ(ui::ET_MOUSE_RELEASED, event->type()); 437 EXPECT_EQ(ui::ET_MOUSE_RELEASED, event->type());
438 EXPECT_FLOAT_EQ(0.0f, event->pointer_details().force());
429 EXPECT_EQ(true, event->IsLeftMouseButton()); 439 EXPECT_EQ(true, event->IsLeftMouseButton());
430 } 440 }
431 441
432 TEST_F(TabletEventConverterEvdevTest, StylusButtonPress) { 442 TEST_F(TabletEventConverterEvdevTest, StylusButtonPress) {
433 scoped_ptr<ui::MockTabletEventConverterEvdev> dev = 443 scoped_ptr<ui::MockTabletEventConverterEvdev> dev =
434 make_scoped_ptr(CreateDevice(kWacomIntuos5SPen)); 444 make_scoped_ptr(CreateDevice(kWacomIntuos5SPen));
435 445
436 struct input_event mock_kernel_queue[] = { 446 struct input_event mock_kernel_queue[] = {
437 {{0, 0}, EV_ABS, ABS_DISTANCE, 63}, 447 {{0, 0}, EV_ABS, ABS_DISTANCE, 63},
438 {{0, 0}, EV_ABS, ABS_X, 18372}, 448 {{0, 0}, EV_ABS, ABS_X, 18372},
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 498
489 struct input_event mock_kernel_queue[] = { 499 struct input_event mock_kernel_queue[] = {
490 {{0, 0}, EV_ABS, ABS_X, 0}, 500 {{0, 0}, EV_ABS, ABS_X, 0},
491 {{0, 0}, EV_ABS, ABS_Y, 0}, 501 {{0, 0}, EV_ABS, ABS_Y, 0},
492 {{0, 0}, EV_SYN, SYN_REPORT, 0}, 502 {{0, 0}, EV_SYN, SYN_REPORT, 0},
493 }; 503 };
494 504
495 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); 505 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue));
496 EXPECT_EQ(0u, size()); 506 EXPECT_EQ(0u, size());
497 } 507 }
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/tablet_event_converter_evdev.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698