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

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

Issue 464013002: Fix bounding box calculation for touches with radius of 0. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address jdduke's comments. Created 6 years, 4 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
« no previous file with comments | « ui/events/gesture_detection/gesture_provider.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 aeb1c24899b304723022d2dbc27d2889eff8dfcf..aaaa0fd481fb3464e85f77f959f873841b917ae0 100644
--- a/ui/events/gesture_detection/gesture_provider_unittest.cc
+++ b/ui/events/gesture_detection/gesture_provider_unittest.cc
@@ -823,7 +823,7 @@ TEST_F(GestureProviderTest, FractionalScroll) {
// Verify that the event co-ordinates are still the precise values we
// supplied.
EXPECT_EQ(kFakeCoordX + delta_x * i, gesture.x);
- EXPECT_EQ(kFakeCoordY + delta_y * i, gesture.y);
+ EXPECT_FLOAT_EQ(kFakeCoordY + delta_y * i, gesture.y);
// Verify that we're scrolling vertically by the expected amount
// (modulo rounding).
@@ -2340,4 +2340,27 @@ TEST_F(GestureProviderTest, MaxGestureBoundsLength) {
GetMostRecentGestureEvent().details.bounding_box_f().height());
}
+TEST_F(GestureProviderTest, ZeroRadiusBoundingBox) {
+ base::TimeTicks event_time = base::TimeTicks::Now();
+ MockMotionEvent event =
+ ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN, 10, 20);
+ event.SetTouchMajor(0);
+ EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
+ EXPECT_EQ(gfx::RectF(10, 20, 0, 0),
+ GetMostRecentGestureEvent().details.bounding_box());
+
+ event = ObtainMotionEvent(
+ event_time, MotionEvent::ACTION_POINTER_DOWN, 10, 20, 110, 120);
+ event.SetTouchMajor(0);
+ EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
+
+ event = ObtainMotionEvent(
+ event_time, MotionEvent::ACTION_MOVE, 10, 20, 110, 150);
+ event.SetTouchMajor(0);
+ EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
+
+ EXPECT_EQ(gfx::RectF(10, 20, 100, 130),
+ GetMostRecentGestureEvent().details.bounding_box());
+}
+
} // namespace ui
« no previous file with comments | « ui/events/gesture_detection/gesture_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698