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

Unified Diff: ui/events/gesture_detection/gesture_provider_unittest.cc

Issue 256593003: Also pass unclamped delta and velocity values to GestureEventDetails. (DEPRECATED) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/gesture_detection/gesture_provider_unittest.cc
diff --git a/ui/events/gesture_detection/gesture_provider_unittest.cc b/ui/events/gesture_detection/gesture_provider_unittest.cc
index 9720a20153b49cf63ebaa9b909f03a9cc3228ef4..1b247456904b7d35cf7752031009feb5c8e4e876 100644
--- a/ui/events/gesture_detection/gesture_provider_unittest.cc
+++ b/ui/events/gesture_detection/gesture_provider_unittest.cc
@@ -304,23 +304,29 @@ TEST_F(GestureProviderTest, GestureFlingAndCancelLongPress) {
event = ObtainMotionEvent(event_time + delta_time,
MotionEvent::ACTION_MOVE,
kFakeCoordX * 10,
- kFakeCoordY * 10);
+ kFakeCoordY * 1.5);
event.SetId(++motion_event_id);
EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
event = ObtainMotionEvent(event_time + delta_time * 2,
MotionEvent::ACTION_UP,
kFakeCoordX * 10,
- kFakeCoordY * 10);
+ kFakeCoordY * 1.5);
event.SetId(++motion_event_id);
EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
EXPECT_EQ(ET_SCROLL_FLING_START, GetMostRecentGestureEventType());
+
+ EXPECT_EQ(8000, GetMostRecentGestureEvent().details.velocity_x());
jdduke (slow) 2014/04/24 19:58:53 We should probably get 8000 using the |maximum_fli
+ EXPECT_EQ(0, GetMostRecentGestureEvent().details.velocity_y());
+ EXPECT_EQ(8000, GetMostRecentGestureEvent().details.velocity_x_ordinal());
+ EXPECT_EQ(2400, GetMostRecentGestureEvent().details.velocity_y_ordinal());
+
EXPECT_EQ(motion_event_id, GetMostRecentGestureEvent().motion_event_id);
EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points());
EXPECT_FALSE(HasReceivedGesture(ET_GESTURE_LONG_PRESS));
EXPECT_EQ(
- BoundsForSingleMockTouchAtLocation(kFakeCoordX * 10, kFakeCoordY * 10),
+ BoundsForSingleMockTouchAtLocation(kFakeCoordX * 10, kFakeCoordY * 1.5),
GetMostRecentGestureEvent().details.bounding_box());
}
@@ -387,6 +393,12 @@ TEST_F(GestureProviderTest, FlingEventSequence) {
EXPECT_FALSE(gesture_provider_->IsScrollInProgress());
EXPECT_EQ(ET_SCROLL_FLING_START, GetMostRecentGestureEventType());
EXPECT_EQ(motion_event_id, GetMostRecentGestureEvent().motion_event_id);
+
+ EXPECT_EQ(8000, GetMostRecentGestureEvent().details.velocity_x());
+ EXPECT_EQ(8000, GetMostRecentGestureEvent().details.velocity_y());
+ EXPECT_EQ(8000, GetMostRecentGestureEvent().details.velocity_x_ordinal());
+ EXPECT_EQ(8000, GetMostRecentGestureEvent().details.velocity_y_ordinal());
+
EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points());
EXPECT_FALSE(HasReceivedGesture(ET_GESTURE_SCROLL_END));
EXPECT_EQ(event_time + delta_time * 2, GetMostRecentGestureEvent().time)
@@ -592,6 +604,7 @@ TEST_F(GestureProviderTest, ScrollUpdateValues) {
// No horizontal delta because of snapping.
EXPECT_EQ(0, gesture.details.scroll_x());
+ EXPECT_EQ(-delta_x / 2, gesture.details.scroll_x_ordinal());
EXPECT_EQ(-delta_y / 2, gesture.details.scroll_y());
jdduke (slow) 2014/04/24 19:58:53 Might as well round this out with EXPECT_EQ(-del
}

Powered by Google App Engine
This is Rietveld 408576698