| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
| 6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
| 7 | 7 |
| 8 #include "ui/gfx/transform.h" | 8 #include "ui/gfx/transform.h" |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 transform.Translate3d(4.5f, 0, 0); | 1338 transform.Translate3d(4.5f, 0, 0); |
| 1339 EXPECT_FALSE(transform.IsIdentityOrIntegerTranslation()); | 1339 EXPECT_FALSE(transform.IsIdentityOrIntegerTranslation()); |
| 1340 | 1340 |
| 1341 transform.MakeIdentity(); | 1341 transform.MakeIdentity(); |
| 1342 transform.Translate3d(0, -6.7f, 0); | 1342 transform.Translate3d(0, -6.7f, 0); |
| 1343 EXPECT_FALSE(transform.IsIdentityOrIntegerTranslation()); | 1343 EXPECT_FALSE(transform.IsIdentityOrIntegerTranslation()); |
| 1344 | 1344 |
| 1345 transform.MakeIdentity(); | 1345 transform.MakeIdentity(); |
| 1346 transform.Translate3d(0, 0, 8.9f); | 1346 transform.Translate3d(0, 0, 8.9f); |
| 1347 EXPECT_FALSE(transform.IsIdentityOrIntegerTranslation()); | 1347 EXPECT_FALSE(transform.IsIdentityOrIntegerTranslation()); |
| 1348 |
| 1349 float max_int = std::numeric_limits<int>::max(); |
| 1350 transform.MakeIdentity(); |
| 1351 transform.Translate3d(0, 0, max_int + 1000.5f); |
| 1352 EXPECT_FALSE(transform.IsIdentityOrIntegerTranslation()); |
| 1353 |
| 1354 float max_float = std::numeric_limits<float>::max(); |
| 1355 transform.MakeIdentity(); |
| 1356 transform.Translate3d(0, 0, max_float - 0.5f); |
| 1357 EXPECT_FALSE(transform.IsIdentityOrIntegerTranslation()); |
| 1348 } | 1358 } |
| 1349 | 1359 |
| 1350 TEST(XFormTest, verifyMatrixInversion) { | 1360 TEST(XFormTest, verifyMatrixInversion) { |
| 1351 { | 1361 { |
| 1352 // Invert a translation | 1362 // Invert a translation |
| 1353 gfx::Transform translation; | 1363 gfx::Transform translation; |
| 1354 translation.Translate3d(2.0, 3.0, 4.0); | 1364 translation.Translate3d(2.0, 3.0, 4.0); |
| 1355 EXPECT_TRUE(translation.IsInvertible()); | 1365 EXPECT_TRUE(translation.IsInvertible()); |
| 1356 | 1366 |
| 1357 gfx::Transform inverse_translation; | 1367 gfx::Transform inverse_translation; |
| (...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2717 EXPECT_FALSE(backface_invisible.IsBackFaceVisible()); | 2727 EXPECT_FALSE(backface_invisible.IsBackFaceVisible()); |
| 2718 | 2728 |
| 2719 // A noise that is more than the tolerance should change the result. | 2729 // A noise that is more than the tolerance should change the result. |
| 2720 backface_invisible.matrix().set(0, 3, 1.f + (2 * noise)); | 2730 backface_invisible.matrix().set(0, 3, 1.f + (2 * noise)); |
| 2721 EXPECT_TRUE(backface_invisible.IsBackFaceVisible()); | 2731 EXPECT_TRUE(backface_invisible.IsBackFaceVisible()); |
| 2722 } | 2732 } |
| 2723 | 2733 |
| 2724 } // namespace | 2734 } // namespace |
| 2725 | 2735 |
| 2726 } // namespace gfx | 2736 } // namespace gfx |
| OLD | NEW |