OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/time/time.h" | 5 #include "base/time/time.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 #include "ui/gfx/android/scroller.h" | 7 #include "ui/gfx/android/scroller.h" |
8 | 8 |
9 namespace gfx { | 9 namespace gfx { |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 const float kDefaultStartX = 7.f; | 13 const float kDefaultStartX = 7.f; |
14 const float kDefaultStartY = 25.f; | 14 const float kDefaultStartY = 25.f; |
15 const float kDefaultDeltaX = -20.f; | 15 const float kDefaultDeltaX = -20.f; |
16 const float kDefaultDeltaY = 73.f; | 16 const float kDefaultDeltaY = 73.f; |
17 const float kDefaultVelocityX = -35.f; | 17 const float kDefaultVelocityX = -350.f; |
18 const float kDefaultVelocityY = 22.f; | 18 const float kDefaultVelocityY = 220.f; |
19 const float kEpsilon = 1e-3f; | 19 const float kEpsilon = 1e-3f; |
20 | 20 |
21 Scroller::Config DefaultConfig() { | 21 Scroller::Config DefaultConfig() { |
22 return Scroller::Config(); | 22 return Scroller::Config(); |
23 } | 23 } |
24 | 24 |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 class ScrollerTest : public testing::Test {}; | 27 class ScrollerTest : public testing::Test {}; |
28 | 28 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 // Try to advance further; nothing should change. | 159 // Try to advance further; nothing should change. |
160 scroller.ComputeScrollOffset(start_time + scroll_duration * 2); | 160 scroller.ComputeScrollOffset(start_time + scroll_duration * 2); |
161 EXPECT_EQ(scroller.GetFinalX(), scroller.GetCurrX()); | 161 EXPECT_EQ(scroller.GetFinalX(), scroller.GetCurrX()); |
162 EXPECT_EQ(scroller.GetFinalY(), scroller.GetCurrY()); | 162 EXPECT_EQ(scroller.GetFinalY(), scroller.GetCurrY()); |
163 EXPECT_TRUE(scroller.IsFinished()); | 163 EXPECT_TRUE(scroller.IsFinished()); |
164 EXPECT_EQ(scroll_duration, scroller.GetTimePassed()); | 164 EXPECT_EQ(scroll_duration, scroller.GetTimePassed()); |
165 } | 165 } |
166 | 166 |
167 } // namespace gfx | 167 } // namespace gfx |
OLD | NEW |