Chromium Code Reviews| 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 // 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 <stddef.h> | 10 #include <stddef.h> |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 const MotionEvent::ToolType tool_types[] = {MotionEvent::TOOL_TYPE_FINGER, | 34 const MotionEvent::ToolType tool_types[] = {MotionEvent::TOOL_TYPE_FINGER, |
| 35 MotionEvent::TOOL_TYPE_STYLUS, | 35 MotionEvent::TOOL_TYPE_STYLUS, |
| 36 MotionEvent::TOOL_TYPE_MOUSE}; | 36 MotionEvent::TOOL_TYPE_MOUSE}; |
| 37 ui::PointerProperties pointer(5, 10, 40); | 37 ui::PointerProperties pointer(5, 10, 40); |
| 38 pointer.id = 15; | 38 pointer.id = 15; |
| 39 pointer.raw_x = 20; | 39 pointer.raw_x = 20; |
| 40 pointer.raw_y = 25; | 40 pointer.raw_y = 25; |
| 41 pointer.pressure = 30; | 41 pointer.pressure = 30; |
| 42 pointer.touch_minor = 35; | 42 pointer.touch_minor = 35; |
| 43 pointer.orientation = static_cast<float>(-M_PI / 2); | 43 pointer.orientation = static_cast<float>(-M_PI / 2); |
| 44 pointer.tilt = static_cast<float>(M_PI / 3); | 44 pointer.tilt_x = 60; |
| 45 pointer.tilt_y = 0; | |
|
use mustaq_at_chromium.org
2017/05/15 19:46:53
Please use a non-zero value, say 70.
jkwang
2017/05/16 01:13:26
Done.
| |
| 45 for (MotionEvent::ToolType tool_type : tool_types) { | 46 for (MotionEvent::ToolType tool_type : tool_types) { |
| 46 pointer.tool_type = tool_type; | 47 pointer.tool_type = tool_type; |
| 47 MotionEventGeneric event( | 48 MotionEventGeneric event( |
| 48 MotionEvent::ACTION_DOWN, base::TimeTicks::Now(), pointer); | 49 MotionEvent::ACTION_DOWN, base::TimeTicks::Now(), pointer); |
| 49 event.set_flags(ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN); | 50 event.set_flags(ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN); |
| 50 event.set_unique_event_id(123456U); | 51 event.set_unique_event_id(123456U); |
| 51 | 52 |
| 52 WebTouchEvent expected_event( | 53 WebTouchEvent expected_event( |
| 53 WebInputEvent::kTouchStart, | 54 WebInputEvent::kTouchStart, |
| 54 WebInputEvent::kShiftKey | WebInputEvent::kAltKey, | 55 WebInputEvent::kShiftKey | WebInputEvent::kAltKey, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.x()), web_event.global_x); | 121 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.x()), web_event.global_x); |
| 121 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.y()), web_event.global_y); | 122 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.y()), web_event.global_y); |
| 122 EXPECT_EQ(blink::kWebGestureDeviceTouchscreen, web_event.source_device); | 123 EXPECT_EQ(blink::kWebGestureDeviceTouchscreen, web_event.source_device); |
| 123 EXPECT_EQ(delta.x(), web_event.data.scroll_update.delta_x); | 124 EXPECT_EQ(delta.x(), web_event.data.scroll_update.delta_x); |
| 124 EXPECT_EQ(delta.y(), web_event.data.scroll_update.delta_y); | 125 EXPECT_EQ(delta.y(), web_event.data.scroll_update.delta_y); |
| 125 EXPECT_TRUE( | 126 EXPECT_TRUE( |
| 126 web_event.data.scroll_update.previous_update_in_sequence_prevented); | 127 web_event.data.scroll_update.previous_update_in_sequence_prevented); |
| 127 } | 128 } |
| 128 | 129 |
| 129 } // namespace content | 130 } // namespace content |
| OLD | NEW |