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

Side by Side Diff: ui/events/event_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, 3 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/event.h ('k') | ui/events/ozone/evdev/device_event_dispatcher_evdev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/events/event.h" 7 #include "ui/events/event.h"
8 #include "ui/events/event_utils.h" 8 #include "ui/events/event_utils.h"
9 #include "ui/events/keycodes/dom/dom_code.h" 9 #include "ui/events/keycodes/dom/dom_code.h"
10 #include "ui/events/keycodes/dom/keycode_converter.h" 10 #include "ui/events/keycodes/dom/keycode_converter.h"
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().radius_x()); 662 EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().radius_x());
663 EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().radius_y()); 663 EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().radius_y());
664 EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().force()); 664 EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().force());
665 EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().tilt_x()); 665 EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().tilt_x());
666 EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().tilt_y()); 666 EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().tilt_y());
667 } 667 }
668 668
669 TEST(EventTest, PointerEventDetailsStylus) { 669 TEST(EventTest, PointerEventDetailsStylus) {
670 ui::MouseEvent stylus_event(ET_MOUSE_PRESSED, gfx::PointF(0, 0), 670 ui::MouseEvent stylus_event(ET_MOUSE_PRESSED, gfx::PointF(0, 0),
671 gfx::PointF(0, 0), ui::EventTimeForNow(), 0, 0); 671 gfx::PointF(0, 0), ui::EventTimeForNow(), 0, 0);
672 stylus_event.set_pointer_type(EventPointerType::POINTER_TYPE_PEN); 672 ui::PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN,
673 stylus_event.set_force(21.0f); 673 /* radius_x */ 0.0f,
674 stylus_event.set_tilt_x(45.0f); 674 /* radius_y */ 0.0f,
675 stylus_event.set_tilt_y(-45.0f); 675 /* force */ 21.0f,
676 /* tilt_x */ 45.0f,
677 /* tilt_y */ -45.0f);
676 678
679 stylus_event.set_pointer_details(pointer_details);
677 EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN, 680 EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
678 stylus_event.pointer_details().pointer_type()); 681 stylus_event.pointer_details().pointer_type());
679 EXPECT_EQ(21.0f, stylus_event.pointer_details().force()); 682 EXPECT_EQ(21.0f, stylus_event.pointer_details().force());
680 EXPECT_EQ(45.0f, stylus_event.pointer_details().tilt_x()); 683 EXPECT_EQ(45.0f, stylus_event.pointer_details().tilt_x());
681 EXPECT_EQ(-45.0f, stylus_event.pointer_details().tilt_y()); 684 EXPECT_EQ(-45.0f, stylus_event.pointer_details().tilt_y());
682 EXPECT_EQ(0.0f, stylus_event.pointer_details().radius_x()); 685 EXPECT_EQ(0.0f, stylus_event.pointer_details().radius_x());
683 EXPECT_EQ(0.0f, stylus_event.pointer_details().radius_y()); 686 EXPECT_EQ(0.0f, stylus_event.pointer_details().radius_y());
684 687
685 ui::MouseEvent stylus_event_copy(stylus_event); 688 ui::MouseEvent stylus_event_copy(stylus_event);
686 EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN, 689 EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
687 stylus_event_copy.pointer_details().pointer_type()); 690 stylus_event_copy.pointer_details().pointer_type());
688 EXPECT_EQ(21.0f, stylus_event_copy.pointer_details().force()); 691 EXPECT_EQ(21.0f, stylus_event_copy.pointer_details().force());
689 EXPECT_EQ(45.0f, stylus_event_copy.pointer_details().tilt_x()); 692 EXPECT_EQ(45.0f, stylus_event_copy.pointer_details().tilt_x());
690 EXPECT_EQ(-45.0f, stylus_event_copy.pointer_details().tilt_y()); 693 EXPECT_EQ(-45.0f, stylus_event_copy.pointer_details().tilt_y());
691 EXPECT_EQ(0.0f, stylus_event_copy.pointer_details().radius_x()); 694 EXPECT_EQ(0.0f, stylus_event_copy.pointer_details().radius_x());
692 EXPECT_EQ(0.0f, stylus_event_copy.pointer_details().radius_y()); 695 EXPECT_EQ(0.0f, stylus_event_copy.pointer_details().radius_y());
693 } 696 }
694 697
695 } // namespace ui 698 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/event.h ('k') | ui/events/ozone/evdev/device_event_dispatcher_evdev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698