| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/gfx/animation/tween.h" | 5 #include "ui/gfx/animation/tween.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "build/build_config.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "ui/gfx/test/gfx_util.h" |
| 12 |
| 9 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
| 10 #include <float.h> | 14 #include <float.h> |
| 11 #endif | 15 #endif |
| 12 | 16 |
| 13 #include "testing/gtest/include/gtest/gtest.h" | |
| 14 #include "ui/gfx/test/gfx_util.h" | |
| 15 | |
| 16 namespace gfx { | 17 namespace gfx { |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 double next_double(double d) { | 20 double next_double(double d) { |
| 20 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
| 21 return _nextafter(d, d + 1); | 22 return _nextafter(d, d + 1); |
| 22 #else | 23 #else |
| 23 // Step two units of least precision towards positive infinity. On some 32 | 24 // Step two units of least precision towards positive infinity. On some 32 |
| 24 // bit x86 compilers a single step was not enough due to loss of precision in | 25 // bit x86 compilers a single step was not enough due to loss of precision in |
| 25 // optimized code. | 26 // optimized code. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 EXPECT_EQ(-1, Tween::LinearIntValueBetween(2.5 / 4.0, -2, 0)); | 131 EXPECT_EQ(-1, Tween::LinearIntValueBetween(2.5 / 4.0, -2, 0)); |
| 131 EXPECT_EQ(-1, Tween::LinearIntValueBetween(2.99 / 4.0, -2, 0)); | 132 EXPECT_EQ(-1, Tween::LinearIntValueBetween(2.99 / 4.0, -2, 0)); |
| 132 | 133 |
| 133 EXPECT_EQ(0, Tween::LinearIntValueBetween(3.0 / 4.0, -2, 0)); | 134 EXPECT_EQ(0, Tween::LinearIntValueBetween(3.0 / 4.0, -2, 0)); |
| 134 EXPECT_EQ(0, Tween::LinearIntValueBetween(3.5 / 4.0, -2, 0)); | 135 EXPECT_EQ(0, Tween::LinearIntValueBetween(3.5 / 4.0, -2, 0)); |
| 135 EXPECT_EQ(0, Tween::LinearIntValueBetween(4.0 / 4.0, -2, 0)); | 136 EXPECT_EQ(0, Tween::LinearIntValueBetween(4.0 / 4.0, -2, 0)); |
| 136 } | 137 } |
| 137 | 138 |
| 138 } // namespace | 139 } // namespace |
| 139 } // namespace gfx | 140 } // namespace gfx |
| OLD | NEW |