Fix search results being clipped in app list.
[chromium-blink-merge.git] / ui / events / gestures / fling_curve_unittest.cc
blobd6dffef9d6c80d7c7c70d5ee844db1ab15bc7b86
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/events/gestures/fling_curve.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gfx/frame_time.h"
10 namespace ui {
12 TEST(FlingCurveTest, Basic) {
13 const gfx::Vector2dF velocity(0, 5000);
14 base::TimeTicks now = gfx::FrameTime::Now();
15 FlingCurve curve(velocity, now);
17 gfx::Vector2dF delta;
18 EXPECT_TRUE(curve.ComputeScrollDeltaAtTime(
19 now + base::TimeDelta::FromMilliseconds(20), &delta));
20 EXPECT_EQ(0, delta.x());
21 EXPECT_NEAR(delta.y(), 96, 1);
23 EXPECT_TRUE(curve.ComputeScrollDeltaAtTime(
24 now + base::TimeDelta::FromMilliseconds(250), &delta));
25 EXPECT_EQ(0, delta.x());
26 EXPECT_NEAR(delta.y(), 705, 1);
28 EXPECT_FALSE(curve.ComputeScrollDeltaAtTime(
29 now + base::TimeDelta::FromSeconds(10), &delta));
30 EXPECT_EQ(0, delta.x());
31 EXPECT_NEAR(delta.y(), 392, 1);
33 EXPECT_FALSE(curve.ComputeScrollDeltaAtTime(
34 now + base::TimeDelta::FromSeconds(20), &delta));
35 EXPECT_TRUE(delta.IsZero());
38 } // namespace ui