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 <stddef.h> |
| 6 |
5 #include <cmath> | 7 #include <cmath> |
6 #include <limits> | 8 #include <limits> |
7 | 9 |
8 #include "base/basictypes.h" | 10 #include "base/macros.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/gfx/geometry/scroll_offset.h" | 12 #include "ui/gfx/geometry/scroll_offset.h" |
11 | 13 |
12 namespace gfx { | 14 namespace gfx { |
13 | 15 |
14 TEST(ScrollOffsetTest, IsZero) { | 16 TEST(ScrollOffsetTest, IsZero) { |
15 ScrollOffset zero(0, 0); | 17 ScrollOffset zero(0, 0); |
16 ScrollOffset nonzero(0.1, -0.1); | 18 ScrollOffset nonzero(0.1, -0.1); |
17 | 19 |
18 EXPECT_TRUE(zero.IsZero()); | 20 EXPECT_TRUE(zero.IsZero()); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 EXPECT_EQ(ScrollOffset(8.5, 10.5).ToString(), a.ToString()); | 115 EXPECT_EQ(ScrollOffset(8.5, 10.5).ToString(), a.ToString()); |
114 a.SetToMin(ScrollOffset(11.5, 9.5)); | 116 a.SetToMin(ScrollOffset(11.5, 9.5)); |
115 EXPECT_EQ(ScrollOffset(8.5, 9.5).ToString(), a.ToString()); | 117 EXPECT_EQ(ScrollOffset(8.5, 9.5).ToString(), a.ToString()); |
116 a.SetToMin(ScrollOffset(7.5, 11.5)); | 118 a.SetToMin(ScrollOffset(7.5, 11.5)); |
117 EXPECT_EQ(ScrollOffset(7.5, 9.5).ToString(), a.ToString()); | 119 EXPECT_EQ(ScrollOffset(7.5, 9.5).ToString(), a.ToString()); |
118 a.SetToMin(ScrollOffset(3.5, 5.5)); | 120 a.SetToMin(ScrollOffset(3.5, 5.5)); |
119 EXPECT_EQ(ScrollOffset(3.5, 5.5).ToString(), a.ToString()); | 121 EXPECT_EQ(ScrollOffset(3.5, 5.5).ToString(), a.ToString()); |
120 } | 122 } |
121 | 123 |
122 } // namespace gfx | 124 } // namespace gfx |
OLD | NEW |