| 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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
| 6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
| 7 | 7 |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 EXPECT_FLOAT_EQ(rotation_angle, clone->GetOrientation(1) * 180 / M_PI); | 295 EXPECT_FLOAT_EQ(rotation_angle, clone->GetOrientation(1) * 180 / M_PI); |
| 296 EXPECT_FLOAT_EQ(pressure, clone->GetPressure(1)); | 296 EXPECT_FLOAT_EQ(pressure, clone->GetPressure(1)); |
| 297 | 297 |
| 298 // TODO(mustaq): The move test seems out-of-scope here, crbug.com/450655 | 298 // TODO(mustaq): The move test seems out-of-scope here, crbug.com/450655 |
| 299 radius_x = 76.98f; | 299 radius_x = 76.98f; |
| 300 radius_y = 321.54f; | 300 radius_y = 321.54f; |
| 301 rotation_angle = 64.f; | 301 rotation_angle = 64.f; |
| 302 pressure = 0.654f; | 302 pressure = 0.654f; |
| 303 TouchEvent move1 = TouchWithTapParams( | 303 TouchEvent move1 = TouchWithTapParams( |
| 304 ET_TOUCH_MOVED, ids[1], radius_x, radius_y, rotation_angle, pressure); | 304 ET_TOUCH_MOVED, ids[1], radius_x, radius_y, rotation_angle, pressure); |
| 305 move1.set_location(gfx::Point(20, 21)); | 305 move1.set_location(gfx::PointF(20.f, 21.f)); |
| 306 EXPECT_TRUE(event.OnTouch(move1)); | 306 EXPECT_TRUE(event.OnTouch(move1)); |
| 307 | 307 |
| 308 EXPECT_EQ(2U, event.GetPointerCount()); | 308 EXPECT_EQ(2U, event.GetPointerCount()); |
| 309 EXPECT_FLOAT_EQ(radius_y, event.GetTouchMajor(1) / 2); | 309 EXPECT_FLOAT_EQ(radius_y, event.GetTouchMajor(1) / 2); |
| 310 EXPECT_FLOAT_EQ(radius_x, event.GetTouchMinor(1) / 2); | 310 EXPECT_FLOAT_EQ(radius_x, event.GetTouchMinor(1) / 2); |
| 311 EXPECT_FLOAT_EQ(rotation_angle, event.GetOrientation(1) * 180 / M_PI); | 311 EXPECT_FLOAT_EQ(rotation_angle, event.GetOrientation(1) * 180 / M_PI); |
| 312 EXPECT_FLOAT_EQ(pressure, event.GetPressure(1)); | 312 EXPECT_FLOAT_EQ(pressure, event.GetPressure(1)); |
| 313 | 313 |
| 314 // Test case: radius_x > radius_y, rotation_angle > 90 | 314 // Test case: radius_x > radius_y, rotation_angle > 90 |
| 315 radius_x = 123.45f; | 315 radius_x = 123.45f; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 int id = i + kIdOffset; | 530 int id = i + kIdOffset; |
| 531 TouchEvent release = TouchWithType(ET_TOUCH_RELEASED, id); | 531 TouchEvent release = TouchWithType(ET_TOUCH_RELEASED, id); |
| 532 if (i < MotionEvent::MAX_TOUCH_POINT_COUNT) | 532 if (i < MotionEvent::MAX_TOUCH_POINT_COUNT) |
| 533 EXPECT_TRUE(event.OnTouch(release)); | 533 EXPECT_TRUE(event.OnTouch(release)); |
| 534 else | 534 else |
| 535 EXPECT_FALSE(event.OnTouch(release)); | 535 EXPECT_FALSE(event.OnTouch(release)); |
| 536 } | 536 } |
| 537 } | 537 } |
| 538 | 538 |
| 539 } // namespace ui | 539 } // namespace ui |
| OLD | NEW |