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

Side by Side Diff: content/browser/renderer_host/input/web_input_event_util_unittest.cc

Issue 1147083005: Separate motion event touch geometry orientation from stylus orientation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Aura Created 5 years, 6 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
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 // Needed on Windows to get |M_PI| from <cmath>. 5 // Needed on Windows to get |M_PI| from <cmath>.
6 #ifdef _WIN32 6 #ifdef _WIN32
7 #define _USE_MATH_DEFINES 7 #define _USE_MATH_DEFINES
8 #endif 8 #endif
9 9
10 #include <cmath> 10 #include <cmath>
(...skipping 16 matching lines...) Expand all
27 27
28 namespace content { 28 namespace content {
29 29
30 TEST(WebInputEventUtilTest, MotionEventConversion) { 30 TEST(WebInputEventUtilTest, MotionEventConversion) {
31 ui::PointerProperties pointer(5, 10, 40); 31 ui::PointerProperties pointer(5, 10, 40);
32 pointer.id = 15; 32 pointer.id = 15;
33 pointer.raw_x = 20; 33 pointer.raw_x = 20;
34 pointer.raw_y = 25; 34 pointer.raw_y = 25;
35 pointer.pressure = 30; 35 pointer.pressure = 30;
36 pointer.touch_minor = 35; 36 pointer.touch_minor = 35;
37 pointer.orientation = static_cast<float>(-M_PI / 2); 37 pointer.touch_orientation = static_cast<float>(-M_PI / 2);
38 MotionEventGeneric event( 38 MotionEventGeneric event(
39 MotionEvent::ACTION_DOWN, base::TimeTicks::Now(), pointer); 39 MotionEvent::ACTION_DOWN, base::TimeTicks::Now(), pointer);
40 event.set_flags(ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN); 40 event.set_flags(ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN);
41 event.set_unique_event_id(123456U); 41 event.set_unique_event_id(123456U);
42 42
43 WebTouchEvent expected_event; 43 WebTouchEvent expected_event;
44 expected_event.type = WebInputEvent::TouchStart; 44 expected_event.type = WebInputEvent::TouchStart;
45 expected_event.touchesLength = 1; 45 expected_event.touchesLength = 1;
46 expected_event.timeStampSeconds = 46 expected_event.timeStampSeconds =
47 (event.GetEventTime() - base::TimeTicks()).InSecondsF(); 47 (event.GetEventTime() - base::TimeTicks()).InSecondsF();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 EXPECT_EQ(gfx::ToFlooredInt(pos.y()), web_event.y); 101 EXPECT_EQ(gfx::ToFlooredInt(pos.y()), web_event.y);
102 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.x()), web_event.globalX); 102 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.x()), web_event.globalX);
103 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.y()), web_event.globalY); 103 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.y()), web_event.globalY);
104 EXPECT_EQ(blink::WebGestureDeviceTouchscreen, web_event.sourceDevice); 104 EXPECT_EQ(blink::WebGestureDeviceTouchscreen, web_event.sourceDevice);
105 EXPECT_EQ(delta.x(), web_event.data.scrollUpdate.deltaX); 105 EXPECT_EQ(delta.x(), web_event.data.scrollUpdate.deltaX);
106 EXPECT_EQ(delta.y(), web_event.data.scrollUpdate.deltaY); 106 EXPECT_EQ(delta.y(), web_event.data.scrollUpdate.deltaY);
107 EXPECT_TRUE(web_event.data.scrollUpdate.previousUpdateInSequencePrevented); 107 EXPECT_TRUE(web_event.data.scrollUpdate.previousUpdateInSequencePrevented);
108 } 108 }
109 109
110 } // namespace content 110 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/motion_event_web.cc ('k') | ui/events/blink/blink_event_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698