Chromium Code Reviews| Index: content/browser/renderer_host/input/motion_event_web_unittest.cc |
| diff --git a/content/browser/renderer_host/input/motion_event_web_unittest.cc b/content/browser/renderer_host/input/motion_event_web_unittest.cc |
| index df2f2305f510c8e0e034d504f7f355b0521b0188..6a1e8862cc55f27a9912041cfdd6794bfcf92f9c 100644 |
| --- a/content/browser/renderer_host/input/motion_event_web_unittest.cc |
| +++ b/content/browser/renderer_host/input/motion_event_web_unittest.cc |
| @@ -25,7 +25,8 @@ TEST(MotionEventWebTest, Constructor) { |
| const float pi = static_cast<float>(M_PI); |
| const float orientations[] = { |
| -pi, -2.f * pi / 3, -pi / 2, -pi / 3, 0.f, pi / 3, pi / 2, 2.f * pi / 3}; |
| - const float tilts[] = {0.f, pi / 4, pi / 3}; |
| + const float tilts_x[] = {0.f, -180 / 4, -180 / 3}; |
| + const float tilts_y[] = {0.5f, 180 / 2, 180 / 3}; |
| const MotionEvent::ToolType tool_types[] = {MotionEvent::TOOL_TYPE_FINGER, |
| MotionEvent::TOOL_TYPE_STYLUS, |
| MotionEvent::TOOL_TYPE_MOUSE}; |
| @@ -36,10 +37,13 @@ TEST(MotionEventWebTest, Constructor) { |
| for (MotionEvent::ToolType tool_type : tool_types) { |
| for (float orientation : orientations) { |
|
use mustaq_at_chromium.org
2017/05/15 19:46:53
We don't need nested testing anymore since event c
jkwang
2017/05/16 01:13:26
Done.
|
| - for (float tilt : tilts) { |
| + for (size_t i = 0; i < arraysize(tilts_x); ++i) { |
| + const float tilt_x = tilts_x[i]; |
| + const float tilt_y = tilts_y[i]; |
| PointerProperties pp2; |
| pp2.orientation = orientation; |
| - pp2.tilt = tilt; |
| + pp2.tilt_x = tilt_x; |
| + pp2.tilt_y = tilt_y; |
| pp2.tool_type = tool_type; |
| size_t pointer_index = generic_event.PushPointer(pp2); |
| EXPECT_GT(pointer_index, 0u); |
| @@ -53,17 +57,20 @@ TEST(MotionEventWebTest, Constructor) { |
| // Web touch event touch point tilt plane angles are stored as ints, |
| // thus the tilt precision is 1 degree and the error should not be |
| // greater than 0.5 degrees. |
| - EXPECT_NEAR(tilt, event.GetTilt(pointer_index), 0.5f * M_PI / 180.f) |
| + EXPECT_NEAR(tilt_x, event.GetTiltX(pointer_index), 0.5) |
| + << " orientation=" << orientation; |
| + EXPECT_NEAR(tilt_y, event.GetTiltY(pointer_index), 0.5) |
| << " orientation=" << orientation; |
| } else { |
| - EXPECT_EQ(0.f, event.GetTilt(pointer_index)); |
| + EXPECT_EQ(0.f, event.GetTiltX(pointer_index)); |
| + EXPECT_EQ(0.f, event.GetTiltY(pointer_index)); |
| } |
| - if (tool_type == MotionEvent::TOOL_TYPE_STYLUS && tilt > 0.f) { |
| + if (tool_type == MotionEvent::TOOL_TYPE_STYLUS && tilt_x > 0.f) { |
| // Full stylus tilt orientation information survives above event |
| // conversions only if there is a non-zero stylus tilt angle. |
| // See: http://crbug.com/251330 |
| EXPECT_NEAR(orientation, event.GetOrientation(pointer_index), 1e-4) |
| - << " tilt=" << tilt; |
| + << " tilt_x=" << tilt_x << " tilt_y=" << tilt_y; |
| } else { |
| // For non-stylus pointers and for styluses with a zero tilt angle, |
| // orientation quadrant information is lost. |