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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 for (size_t index = 0; index < arraysize(axes); ++index) { | 738 for (size_t index = 0; index < arraysize(axes); ++index) { |
739 for (int i = -5; i < 15; ++i) { | 739 for (int i = -5; i < 15; ++i) { |
740 Transform to; | 740 Transform to; |
741 to.RotateAbout(axes[index], 180.0); | 741 to.RotateAbout(axes[index], 180.0); |
742 double t = i / 9.0; | 742 double t = i / 9.0; |
743 EXPECT_TRUE(to.Blend(from, t)); | 743 EXPECT_TRUE(to.Blend(from, t)); |
744 | 744 |
745 // A 180 degree rotation is exactly opposite on the sphere, therefore | 745 // A 180 degree rotation is exactly opposite on the sphere, therefore |
746 // either great circle arc to it is equivalent (and numerical precision | 746 // either great circle arc to it is equivalent (and numerical precision |
747 // will determine which is closer). Test both directions. | 747 // will determine which is closer). Test both directions. |
748 Transform expected = from; | 748 Transform expected1; |
749 EXPECT_TRUE(MatricesAreNearlyEqual(expected, to)) | 749 expected1.RotateAbout(axes[index], 180.0 * t); |
| 750 Transform expected2; |
| 751 expected2.RotateAbout(axes[index], -180.0 * t); |
| 752 |
| 753 EXPECT_TRUE(MatricesAreNearlyEqual(expected1, to) || |
| 754 MatricesAreNearlyEqual(expected2, to)) |
750 << "axis: " << index << ", i: " << i; | 755 << "axis: " << index << ", i: " << i; |
751 } | 756 } |
752 } | 757 } |
753 } | 758 } |
754 | 759 |
755 #if defined(_WIN64) | 760 #if defined(_WIN64) |
756 // https://crbug.com/406574 | 761 // https://crbug.com/406574 |
757 #define MAYBE_BlendScale DISABLED_BlendScale | 762 #define MAYBE_BlendScale DISABLED_BlendScale |
758 #else | 763 #else |
759 #define MAYBE_BlendScale BlendScale | 764 #define MAYBE_BlendScale BlendScale |
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2731 EXPECT_FALSE(backface_invisible.IsBackFaceVisible()); | 2736 EXPECT_FALSE(backface_invisible.IsBackFaceVisible()); |
2732 | 2737 |
2733 // A noise that is more than the tolerance should change the result. | 2738 // A noise that is more than the tolerance should change the result. |
2734 backface_invisible.matrix().set(0, 3, 1.f + (2 * noise)); | 2739 backface_invisible.matrix().set(0, 3, 1.f + (2 * noise)); |
2735 EXPECT_TRUE(backface_invisible.IsBackFaceVisible()); | 2740 EXPECT_TRUE(backface_invisible.IsBackFaceVisible()); |
2736 } | 2741 } |
2737 | 2742 |
2738 } // namespace | 2743 } // namespace |
2739 | 2744 |
2740 } // namespace gfx | 2745 } // namespace gfx |
OLD | NEW |