OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 #include "ui/events/gestures/velocity_calculator.h" | 7 #include "ui/events/gestures/velocity_calculator.h" |
8 | 8 |
9 namespace ui { | 9 namespace ui { |
10 namespace test { | 10 namespace test { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 velocity_calculator.PointSeen(21, -19, start_time + 8); | 67 velocity_calculator.PointSeen(21, -19, start_time + 8); |
68 velocity_calculator.PointSeen(30, -32, start_time + 16); | 68 velocity_calculator.PointSeen(30, -32, start_time + 16); |
69 velocity_calculator.PointSeen(38, -40, start_time + 24); | 69 velocity_calculator.PointSeen(38, -40, start_time + 24); |
70 velocity_calculator.PointSeen(50, -51, start_time + 32); | 70 velocity_calculator.PointSeen(50, -51, start_time + 32); |
71 | 71 |
72 EXPECT_GT(velocity_calculator.XVelocity(), 1230000); | 72 EXPECT_GT(velocity_calculator.XVelocity(), 1230000); |
73 EXPECT_LT(velocity_calculator.XVelocity(), 1260000); | 73 EXPECT_LT(velocity_calculator.XVelocity(), 1260000); |
74 EXPECT_GT(velocity_calculator.YVelocity(), -1270000); | 74 EXPECT_GT(velocity_calculator.YVelocity(), -1270000); |
75 EXPECT_LT(velocity_calculator.YVelocity(), -1240000); | 75 EXPECT_LT(velocity_calculator.YVelocity(), -1240000); |
76 | 76 |
77 start_time = GG_LONGLONG(1223372036800000000); | 77 start_time = 1223372036800000000LL; |
78 velocity_calculator.PointSeen(9, -11, start_time); | 78 velocity_calculator.PointSeen(9, -11, start_time); |
79 velocity_calculator.PointSeen(21, -19, start_time + 8); | 79 velocity_calculator.PointSeen(21, -19, start_time + 8); |
80 velocity_calculator.PointSeen(30, -32, start_time + 16); | 80 velocity_calculator.PointSeen(30, -32, start_time + 16); |
81 velocity_calculator.PointSeen(38, -40, start_time + 24); | 81 velocity_calculator.PointSeen(38, -40, start_time + 24); |
82 velocity_calculator.PointSeen(50, -51, start_time + 32); | 82 velocity_calculator.PointSeen(50, -51, start_time + 32); |
83 | 83 |
84 EXPECT_GT(velocity_calculator.XVelocity(), 1230000); | 84 EXPECT_GT(velocity_calculator.XVelocity(), 1230000); |
85 EXPECT_LT(velocity_calculator.XVelocity(), 1260000); | 85 EXPECT_LT(velocity_calculator.XVelocity(), 1260000); |
86 EXPECT_GT(velocity_calculator.YVelocity(), -1270000); | 86 EXPECT_GT(velocity_calculator.YVelocity(), -1270000); |
87 EXPECT_LT(velocity_calculator.YVelocity(), -124000); | 87 EXPECT_LT(velocity_calculator.YVelocity(), -124000); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 EXPECT_FLOAT_EQ(velocity_calculator.YVelocity(), -10.f); | 139 EXPECT_FLOAT_EQ(velocity_calculator.YVelocity(), -10.f); |
140 | 140 |
141 AddPoints(&velocity_calculator, 0, 0, 1, 5); | 141 AddPoints(&velocity_calculator, 0, 0, 1, 5); |
142 | 142 |
143 EXPECT_FLOAT_EQ(velocity_calculator.XVelocity(), 0); | 143 EXPECT_FLOAT_EQ(velocity_calculator.XVelocity(), 0); |
144 EXPECT_FLOAT_EQ(velocity_calculator.YVelocity(), 0); | 144 EXPECT_FLOAT_EQ(velocity_calculator.YVelocity(), 0); |
145 } | 145 } |
146 | 146 |
147 } // namespace test | 147 } // namespace test |
148 } // namespace ui | 148 } // namespace ui |
OLD | NEW |