diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-24 22:20:27 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-24 22:20:27 +0000 |
commit | 64e6b0ccbdc207a99003701a7cad7d30218bd784 (patch) | |
tree | c7b2a7b6784e2efece94a7692d58d7859e177571 /ui/aura/gestures/gesture_recognizer_unittest.cc | |
parent | 67f41cf34a5b878a59df1d9a838afaa778414b0e (diff) | |
download | chromium_src-64e6b0ccbdc207a99003701a7cad7d30218bd784.zip chromium_src-64e6b0ccbdc207a99003701a7cad7d30218bd784.tar.gz chromium_src-64e6b0ccbdc207a99003701a7cad7d30218bd784.tar.bz2 |
gesture recognizer: Improve multi-finger scrolling.
The patch includes several changes:
* Make sure scroll-update events are generated properly during pinch.
* Do not include radius in the bounding box for multi-finger gestures, because
change in radius can be too large and overshadow the actual location change
of the finger.
* Reduce the amount a finger needs to scroll before pinch/scroll-update events
are generated during a multi-finger gesture.
BUG=151230,151153
Review URL: https://codereview.chromium.org/11274015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/gestures/gesture_recognizer_unittest.cc')
-rw-r--r-- | ui/aura/gestures/gesture_recognizer_unittest.cc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc index 4dd423a..892af65 100644 --- a/ui/aura/gestures/gesture_recognizer_unittest.cc +++ b/ui/aura/gestures/gesture_recognizer_unittest.cc @@ -1641,7 +1641,9 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) { ui::TouchEvent move3(ui::ET_TOUCH_MOVED, gfx::Point(95, 201), kTouchId1, GetTime()); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move3); - EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_PINCH_UPDATE); + EXPECT_2_EVENTS(delegate->events(), + ui::ET_GESTURE_PINCH_UPDATE, + ui::ET_GESTURE_SCROLL_UPDATE); EXPECT_EQ(gfx::Rect(10, 10, 85, 191).ToString(), delegate->bounding_box().ToString()); @@ -1650,7 +1652,9 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) { ui::TouchEvent move4(ui::ET_TOUCH_MOVED, gfx::Point(55, 15), kTouchId2, GetTime()); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move4); - EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_PINCH_UPDATE); + EXPECT_2_EVENTS(delegate->events(), + ui::ET_GESTURE_PINCH_UPDATE, + ui::ET_GESTURE_SCROLL_UPDATE); EXPECT_EQ(gfx::Rect(55, 15, 40, 186).ToString(), delegate->bounding_box().ToString()); @@ -1767,7 +1771,9 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) { ui::TouchEvent move3(ui::ET_TOUCH_MOVED, gfx::Point(65, 201), kTouchId1, GetTime()); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move3); - EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_PINCH_UPDATE); + EXPECT_2_EVENTS(delegate->events(), + ui::ET_GESTURE_PINCH_UPDATE, + ui::ET_GESTURE_SCROLL_UPDATE); EXPECT_EQ(gfx::Rect(10, 10, 55, 191).ToString(), delegate->bounding_box().ToString()); @@ -1776,7 +1782,9 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) { ui::TouchEvent move4(ui::ET_TOUCH_MOVED, gfx::Point(55, 15), kTouchId2, GetTime()); root->AsRootWindowHostDelegate()->OnHostTouchEvent(&move4); - EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_PINCH_UPDATE); + EXPECT_2_EVENTS(delegate->events(), + ui::ET_GESTURE_PINCH_UPDATE, + ui::ET_GESTURE_SCROLL_UPDATE); EXPECT_EQ(gfx::Rect(55, 15, 10, 186).ToString(), delegate->bounding_box().ToString()); @@ -2860,6 +2868,8 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) { press2.set_radius_x(5); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_FALSE(delegate->pinch_begin()); + EXPECT_EQ(gfx::Rect(101, 201, 100, 0).ToString(), + delegate->bounding_box().ToString()); delegate->Reset(); @@ -2867,7 +2877,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) { press1.time_stamp() + base::TimeDelta::FromMilliseconds(40)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); EXPECT_TRUE(delegate->pinch_begin()); - EXPECT_EQ(gfx::Rect(141, 196, 65, 10).ToString(), + EXPECT_EQ(gfx::Rect(141, 201, 60, 0).ToString(), delegate->bounding_box().ToString()); delegate->Reset(); |