| 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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 Transform expected2; | 750 Transform expected2; |
| 751 expected2.RotateAbout(axes[index], -180.0 * t); | 751 expected2.RotateAbout(axes[index], -180.0 * t); |
| 752 | 752 |
| 753 EXPECT_TRUE(MatricesAreNearlyEqual(expected1, to) || | 753 EXPECT_TRUE(MatricesAreNearlyEqual(expected1, to) || |
| 754 MatricesAreNearlyEqual(expected2, to)) | 754 MatricesAreNearlyEqual(expected2, to)) |
| 755 << "axis: " << index << ", i: " << i; | 755 << "axis: " << index << ", i: " << i; |
| 756 } | 756 } |
| 757 } | 757 } |
| 758 } | 758 } |
| 759 | 759 |
| 760 #if defined(_WIN64) || defined(ARCH_CPU_ARM_FAMILY) | 760 #if defined(_WIN64) |
| 761 // Win: https://crbug.com/406574 | 761 // https://crbug.com/406574 |
| 762 // Arm: https://crbug.com/662558 | |
| 763 #define MAYBE_BlendScale DISABLED_BlendScale | 762 #define MAYBE_BlendScale DISABLED_BlendScale |
| 764 #else | 763 #else |
| 765 #define MAYBE_BlendScale BlendScale | 764 #define MAYBE_BlendScale BlendScale |
| 766 #endif | 765 #endif |
| 767 TEST(XFormTest, MAYBE_BlendScale) { | 766 TEST(XFormTest, MAYBE_BlendScale) { |
| 768 Transform from; | 767 Transform from; |
| 769 for (int i = -5; i < 15; ++i) { | 768 for (int i = -5; i < 15; ++i) { |
| 770 Transform to; | 769 Transform to; |
| 771 to.Scale3d(5, 4, 3); | 770 to.Scale3d(5, 4, 3); |
| 772 double t = i / 9.0; | 771 double s1 = i / 9.0; |
| 773 EXPECT_TRUE(to.Blend(from, t)); | 772 double s2 = 1 - s1; |
| 774 EXPECT_FLOAT_EQ(t * 4 + 1, to.matrix().get(0, 0)) << "i: " << i; | 773 EXPECT_TRUE(to.Blend(from, s1)); |
| 775 EXPECT_FLOAT_EQ(t * 3 + 1, to.matrix().get(1, 1)) << "i: " << i; | 774 EXPECT_FLOAT_EQ(5 * s1 + s2, to.matrix().get(0, 0)) << "i: " << i; |
| 776 EXPECT_FLOAT_EQ(t * 2 + 1, to.matrix().get(2, 2)) << "i: " << i; | 775 EXPECT_FLOAT_EQ(4 * s1 + s2, to.matrix().get(1, 1)) << "i: " << i; |
| 776 EXPECT_FLOAT_EQ(3 * s1 + s2, to.matrix().get(2, 2)) << "i: " << i; |
| 777 } | 777 } |
| 778 } | 778 } |
| 779 | 779 |
| 780 TEST(XFormTest, BlendSkew) { | 780 TEST(XFormTest, BlendSkew) { |
| 781 Transform from; | 781 Transform from; |
| 782 for (int i = 0; i < 2; ++i) { | 782 for (int i = 0; i < 2; ++i) { |
| 783 Transform to; | 783 Transform to; |
| 784 to.Skew(10, 5); | 784 to.Skew(10, 5); |
| 785 double t = i; | 785 double t = i; |
| 786 Transform expected; | 786 Transform expected; |
| (...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2717 EXPECT_FALSE(backface_invisible.IsBackFaceVisible()); | 2717 EXPECT_FALSE(backface_invisible.IsBackFaceVisible()); |
| 2718 | 2718 |
| 2719 // A noise that is more than the tolerance should change the result. | 2719 // A noise that is more than the tolerance should change the result. |
| 2720 backface_invisible.matrix().set(0, 3, 1.f + (2 * noise)); | 2720 backface_invisible.matrix().set(0, 3, 1.f + (2 * noise)); |
| 2721 EXPECT_TRUE(backface_invisible.IsBackFaceVisible()); | 2721 EXPECT_TRUE(backface_invisible.IsBackFaceVisible()); |
| 2722 } | 2722 } |
| 2723 | 2723 |
| 2724 } // namespace | 2724 } // namespace |
| 2725 | 2725 |
| 2726 } // namespace gfx | 2726 } // namespace gfx |
| OLD | NEW |