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

Unified Diff: ui/events/gestures/fling_curve_unittest.cc

Issue 436213002: athena: Add support for fling-scroll in overview mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test 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/gestures/fling_curve.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/gestures/fling_curve_unittest.cc
diff --git a/ui/events/gestures/fling_curve_unittest.cc b/ui/events/gestures/fling_curve_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..653a5effff8c9ea5cf2bf64f683183eca156cc76
--- /dev/null
+++ b/ui/events/gestures/fling_curve_unittest.cc
@@ -0,0 +1,36 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/events/gestures/fling_curve.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/frame_time.h"
+
+namespace ui {
+
+TEST(FlingCurveTest, Basic) {
+ const gfx::Vector2dF velocity(0, 5000);
+ base::TimeTicks now = gfx::FrameTime::Now();
+ FlingCurve curve(velocity, now);
+
+ gfx::Vector2dF scroll =
+ curve.GetScrollAmountAtTime(now + base::TimeDelta::FromMilliseconds(20));
+ EXPECT_EQ(0, scroll.x());
+ EXPECT_NEAR(scroll.y(), 96, 1);
+
+ scroll =
+ curve.GetScrollAmountAtTime(now + base::TimeDelta::FromMilliseconds(250));
+ EXPECT_EQ(0, scroll.x());
+ EXPECT_NEAR(scroll.y(), 705, 1);
+
+ scroll =
+ curve.GetScrollAmountAtTime(now + base::TimeDelta::FromSeconds(10));
+ EXPECT_EQ(0, scroll.x());
+ EXPECT_NEAR(scroll.y(), 392, 1);
+
+ EXPECT_TRUE(curve.GetScrollAmountAtTime(
+ now + base::TimeDelta::FromSeconds(20)).IsZero());
+}
+
+} // namespace ui
« no previous file with comments | « ui/events/gestures/fling_curve.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698