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

Side by Side Diff: Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp

Issue 9969140: Merge 113095 - [chromium] Switch touchpad fling curve physics to absolute (not scaled) curve. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 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 unified diff | Download patch
« no previous file with comments | « Source/WebKit/chromium/ChangeLog ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 EXPECT_TRUE(animation->animate(0.45)); 92 EXPECT_TRUE(animation->animate(0.45));
93 EXPECT_TRUE(animation->animate(0.75)); 93 EXPECT_TRUE(animation->animate(0.75));
94 EXPECT_TRUE(animation->animate(1000)); 94 EXPECT_TRUE(animation->animate(1000));
95 EXPECT_FALSE(animation->animate(1001)); 95 EXPECT_FALSE(animation->animate(1001));
96 EXPECT_NEAR(target.cumulativeDelta().x(), 50, 1); 96 EXPECT_NEAR(target.cumulativeDelta().x(), 50, 1);
97 EXPECT_NEAR(target.cumulativeDelta().y(), 150, 1); 97 EXPECT_NEAR(target.cumulativeDelta().y(), 150, 1);
98 } 98 }
99 99
100 TEST(PlatformGestureCurve, flingCurveTouch) 100 TEST(PlatformGestureCurve, flingCurveTouch)
101 { 101 {
102 double initialVelocity = 1000; 102 double initialVelocity = 5000;
103 const double touchFlingCurveAreaFactor = 1; // Depends on parameterization i n TouchpadFlingPlatformGestureCurve.
104 MockPlatformGestureCurveTarget target; 103 MockPlatformGestureCurveTarget target;
105 OwnPtr<ActivePlatformGestureAnimation> animation = ActivePlatformGestureAnim ation::create(TouchpadFlingPlatformGestureCurve::create(FloatPoint(initialVeloci ty, 0)), &target); 104 OwnPtr<ActivePlatformGestureAnimation> animation = ActivePlatformGestureAnim ation::create(TouchpadFlingPlatformGestureCurve::create(FloatPoint(initialVeloci ty, 0)), &target);
106 105
107 // Note: the expectations below are dependent on the value of sigma hard-cod ed in the Rayleigh 106 // Note: the expectations below are dependent on the value of sigma hard-cod ed in the curve parameters.
108 // curve. If sigma changes, these test expectations will also change. 107 // If the parameters change, then the tests values/expectations will n eed to be updated.
109 EXPECT_TRUE(animation->animate(0)); 108 EXPECT_TRUE(animation->animate(0));
110 EXPECT_TRUE(animation->animate(0.25)); 109 EXPECT_TRUE(animation->animate(0.25));
111 EXPECT_TRUE(animation->animate(0.45)); // Use non-uniform tick spacing. 110 EXPECT_TRUE(animation->animate(0.45)); // Use non-uniform tick spacing.
112 EXPECT_TRUE(animation->animate(0.75)); 111 EXPECT_TRUE(animation->animate(1));
113 EXPECT_TRUE(animation->animate(0.9)); 112 EXPECT_FALSE(animation->animate(1.5));
114 EXPECT_TRUE(animation->animate(1000)); 113 EXPECT_NEAR(target.cumulativeDelta().x(), 1094, 1);
115 EXPECT_FALSE(animation->animate(1001));
116 EXPECT_NEAR(target.cumulativeDelta().x(), initialVelocity * touchFlingCurveA reaFactor, 1);
117 EXPECT_EQ(target.cumulativeDelta().y(), 0); 114 EXPECT_EQ(target.cumulativeDelta().y(), 0);
118 } 115 }
119 116
120 } // namespace anonymous 117 } // namespace anonymous
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698