Chromium Code Reviews| Index: content/browser/renderer_host/input/motion_event_android_unittest.cc |
| diff --git a/content/browser/renderer_host/input/motion_event_android_unittest.cc b/content/browser/renderer_host/input/motion_event_android_unittest.cc |
| index f1c13308f38d688b2e5bd393a9f0996523da1f1d..c779c80be0d3cd96bb6fc97ed7a38bb6e58c2ce9 100644 |
| --- a/content/browser/renderer_host/input/motion_event_android_unittest.cc |
| +++ b/content/browser/renderer_host/input/motion_event_android_unittest.cc |
| @@ -3,6 +3,7 @@ |
| // found in the LICENSE file. |
| #include "base/android/jni_android.h" |
| +#include "base/float_util.h" |
| #include "content/browser/renderer_host/input/motion_event_android.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -31,13 +32,17 @@ TEST(MotionEventAndroidTest, Constructor) { |
| int event_time_ms = 5; |
| base::TimeTicks event_time = |
| base::TimeTicks() + base::TimeDelta::FromMilliseconds(event_time_ms); |
| - float x0 = 13.7; |
| - float y0 = -7.13; |
| - float x1 = -13.7; |
| - float y1 = 7.13; |
| + float x0 = 13.7f; |
| + float y0 = -7.13f; |
| + float x1 = -13.7f; |
| + float y1 = 7.13f; |
| float raw_offset = 10.1f; |
| float touch_major0 = 5.3f; |
| float touch_major1 = 3.5f; |
| + float touch_minor0 = 1.2f; |
| + float touch_minor1 = 2.1f; |
| + float orientation0 = 0.1f; |
| + float orientation1 = std::numeric_limits<float>::quiet_NaN(); |
|
jdduke (slow)
2014/08/29 16:45:08
Thanks.
|
| int p0 = 1; |
| int p1 = 2; |
| int pointer_count = 2; |
| @@ -64,6 +69,10 @@ TEST(MotionEventAndroidTest, Constructor) { |
| p1, |
| touch_major0, |
| touch_major1, |
| + touch_minor0, |
| + touch_minor1, |
| + orientation0, |
| + orientation1, |
| x0 + raw_offset, |
| y0 - raw_offset, |
| kAndroidToolTypeFinger, |
| @@ -82,6 +91,10 @@ TEST(MotionEventAndroidTest, Constructor) { |
| EXPECT_FLOAT_EQ((y1 - raw_offset) * kPixToDip, event.GetRawY(1)); |
| EXPECT_EQ(touch_major0 * kPixToDip, event.GetTouchMajor(0)); |
| EXPECT_EQ(touch_major1 * kPixToDip, event.GetTouchMajor(1)); |
| + EXPECT_EQ(touch_minor0 * kPixToDip, event.GetTouchMinor(0)); |
| + EXPECT_EQ(touch_minor1 * kPixToDip, event.GetTouchMinor(1)); |
| + EXPECT_EQ(orientation0, event.GetOrientation(0)); |
| + EXPECT_EQ(0.f, event.GetOrientation(1)); |
| EXPECT_EQ(p0, event.GetPointerId(0)); |
| EXPECT_EQ(p1, event.GetPointerId(1)); |
| EXPECT_EQ(MotionEvent::TOOL_TYPE_FINGER, event.GetToolType(0)); |
| @@ -96,9 +109,11 @@ TEST(MotionEventAndroidTest, Clone) { |
| int event_time_ms = 5; |
| base::TimeTicks event_time = |
| base::TimeTicks() + base::TimeDelta::FromMilliseconds(event_time_ms); |
| - float x = 13.7; |
| - float y = -7.13; |
| + float x = 13.7f; |
| + float y = -7.13f; |
| float touch_major = 5.3f; |
| + float touch_minor = 3.5f; |
| + float orientation = 0.2f; |
| int pointer_count = 1; |
| int pointer_id = 1; |
| base::android::ScopedJavaLocalRef<jobject> event_obj = |
| @@ -122,6 +137,10 @@ TEST(MotionEventAndroidTest, Clone) { |
| 0, |
| touch_major, |
| 0.f, |
| + touch_minor, |
| + 0.f, |
| + orientation, |
| + 0.f, |
| x, |
| y, |
| 0, |
| @@ -137,8 +156,8 @@ TEST(MotionEventAndroidTest, Cancel) { |
| base::TimeTicks event_time = |
| base::TimeTicks() + base::TimeDelta::FromMilliseconds(event_time_ms); |
| int pointer_count = 1; |
| - float x = 13.7; |
| - float y = -7.13; |
| + float x = 13.7f; |
| + float y = -7.13f; |
| base::android::ScopedJavaLocalRef<jobject> event_obj = |
| MotionEventAndroid::Obtain( |
| event_time, event_time, MotionEvent::ACTION_DOWN, x, y); |
| @@ -160,6 +179,10 @@ TEST(MotionEventAndroidTest, Cancel) { |
| 0, |
| 0.f, |
| 0.f, |
| + 0.f, |
| + 0.f, |
| + 0.f, |
| + 0.f, |
| x, |
| y, |
| 0, |