Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: ui/gfx/transform_unittest.cc

Issue 475173006: Disable flaky XForm tests on Win 64. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <cmath> 10 #include <cmath>
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 EXPECT_TRUE(to.Blend(from, t)); 728 EXPECT_TRUE(to.Blend(from, t));
729 729
730 Transform expected; 730 Transform expected;
731 expected.RotateAbout(axes[index], 90 * t); 731 expected.RotateAbout(axes[index], 90 * t);
732 732
733 EXPECT_TRUE(MatricesAreNearlyEqual(expected, to)); 733 EXPECT_TRUE(MatricesAreNearlyEqual(expected, to));
734 } 734 }
735 } 735 }
736 } 736 }
737 737
738 TEST(XFormTest, BlendRotateFollowsShortestPath) { 738 #if defined(_WIN64)
739 // http://crbug.com/406574
740 #define MAYBE_BlendRotateFollowsShortestPath DISABLED_BlendRotateFollowsShortest Path
741 #else
742 #define MAYBE_BlendRotateFollowsShortestPath BlendRotateFollowsShortestPath
743 #endif
744 TEST(XFormTest, MAYBE_BlendRotateFollowsShortestPath) {
739 // Verify that we interpolate along the shortest path regardless of whether 745 // Verify that we interpolate along the shortest path regardless of whether
740 // this path crosses the 180-degree point. 746 // this path crosses the 180-degree point.
741 Vector3dF axes[] = { 747 Vector3dF axes[] = {
742 Vector3dF(1, 0, 0), 748 Vector3dF(1, 0, 0),
743 Vector3dF(0, 1, 0), 749 Vector3dF(0, 1, 0),
744 Vector3dF(0, 0, 1), 750 Vector3dF(0, 0, 1),
745 Vector3dF(1, 1, 1) 751 Vector3dF(1, 1, 1)
746 }; 752 };
747 for (size_t index = 0; index < ARRAYSIZE_UNSAFE(axes); ++index) { 753 for (size_t index = 0; index < ARRAYSIZE_UNSAFE(axes); ++index) {
748 for (int i = -5; i < 15; ++i) { 754 for (int i = -5; i < 15; ++i) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 Transform expected2; 801 Transform expected2;
796 expected2.RotateAbout(axes[index], -180.0 * t); 802 expected2.RotateAbout(axes[index], -180.0 * t);
797 803
798 EXPECT_TRUE(MatricesAreNearlyEqual(expected1, to) || 804 EXPECT_TRUE(MatricesAreNearlyEqual(expected1, to) ||
799 MatricesAreNearlyEqual(expected2, to)) 805 MatricesAreNearlyEqual(expected2, to))
800 << "axis: " << index << ", i: " << i; 806 << "axis: " << index << ", i: " << i;
801 } 807 }
802 } 808 }
803 } 809 }
804 810
805 TEST(XFormTest, BlendScale) { 811 #if defined(_WIN64)
812 // http://crbug.com/406574
813 #define MAYBE_BlendScale DISABLED_BlendScale
814 #else
815 #define MAYBE_BlendScale BlendScale
816 #endif
817 TEST(XFormTest, MAYBE_BlendScale) {
806 Transform from; 818 Transform from;
807 for (int i = -5; i < 15; ++i) { 819 for (int i = -5; i < 15; ++i) {
808 Transform to; 820 Transform to;
809 to.Scale3d(5, 4, 3); 821 to.Scale3d(5, 4, 3);
810 double t = i / 9.0; 822 double t = i / 9.0;
811 EXPECT_TRUE(to.Blend(from, t)); 823 EXPECT_TRUE(to.Blend(from, t));
812 EXPECT_FLOAT_EQ(t * 4 + 1, to.matrix().get(0, 0)) << "i: " << i; 824 EXPECT_FLOAT_EQ(t * 4 + 1, to.matrix().get(0, 0)) << "i: " << i;
813 EXPECT_FLOAT_EQ(t * 3 + 1, to.matrix().get(1, 1)) << "i: " << i; 825 EXPECT_FLOAT_EQ(t * 3 + 1, to.matrix().get(1, 1)) << "i: " << i;
814 EXPECT_FLOAT_EQ(t * 2 + 1, to.matrix().get(2, 2)) << "i: " << i; 826 EXPECT_FLOAT_EQ(t * 2 + 1, to.matrix().get(2, 2)) << "i: " << i;
815 } 827 }
(...skipping 20 matching lines...) Expand all
836 Transform to; 848 Transform to;
837 to.SkewX(20); 849 to.SkewX(20);
838 double t = i; 850 double t = i;
839 Transform expected; 851 Transform expected;
840 expected.SkewX(t * 20); 852 expected.SkewX(t * 20);
841 EXPECT_TRUE(to.Blend(from, t)); 853 EXPECT_TRUE(to.Blend(from, t));
842 EXPECT_TRUE(MatricesAreNearlyEqual(expected, to)); 854 EXPECT_TRUE(MatricesAreNearlyEqual(expected, to));
843 } 855 }
844 } 856 }
845 857
846 TEST(XFormTest, BlendPerspective) { 858 #if defined(_WIN64)
859 // http://crbug.com/406574
860 #define MAYBE_BlendPerspective DISABLED_BlendPerspective
861 #else
862 #define MAYBE_BlendPerspective BlendPerspective
863 #endif
864 TEST(XFormTest, MAYBE_BlendPerspective) {
847 Transform from; 865 Transform from;
848 from.ApplyPerspectiveDepth(200); 866 from.ApplyPerspectiveDepth(200);
849 for (int i = -1; i < 3; ++i) { 867 for (int i = -1; i < 3; ++i) {
850 Transform to; 868 Transform to;
851 to.ApplyPerspectiveDepth(800); 869 to.ApplyPerspectiveDepth(800);
852 double t = i; 870 double t = i;
853 double depth = 1.0 / ((1.0 / 200) * (1.0 - t) + (1.0 / 800) * t); 871 double depth = 1.0 / ((1.0 / 200) * (1.0 - t) + (1.0 / 800) * t);
854 Transform expected; 872 Transform expected;
855 expected.ApplyPerspectiveDepth(depth); 873 expected.ApplyPerspectiveDepth(depth);
856 EXPECT_TRUE(to.Blend(from, t)); 874 EXPECT_TRUE(to.Blend(from, t));
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 1060
1043 to = Transform(); 1061 to = Transform();
1044 to.SkewY(45.0); 1062 to.SkewY(45.0);
1045 to.Blend(from, 1.0); 1063 to.Blend(from, 1.0);
1046 EXPECT_ROW1_NEAR(1.0, 0.0, 0.0, 0.0, to, LOOSE_ERROR_THRESHOLD); 1064 EXPECT_ROW1_NEAR(1.0, 0.0, 0.0, 0.0, to, LOOSE_ERROR_THRESHOLD);
1047 EXPECT_ROW2_NEAR(1.0, 1.0, 0.0, 0.0, to, LOOSE_ERROR_THRESHOLD); 1065 EXPECT_ROW2_NEAR(1.0, 1.0, 0.0, 0.0, to, LOOSE_ERROR_THRESHOLD);
1048 EXPECT_ROW3_EQ(0.0f, 0.0f, 1.0f, 0.0f, to); 1066 EXPECT_ROW3_EQ(0.0f, 0.0f, 1.0f, 0.0f, to);
1049 EXPECT_ROW4_EQ(0.0f, 0.0f, 0.0f, 1.0f, to); 1067 EXPECT_ROW4_EQ(0.0f, 0.0f, 0.0f, 1.0f, to);
1050 } 1068 }
1051 1069
1052 TEST(XFormTest, VerifyBlendForRotationAboutX) { 1070 #if defined(_WIN64)
1071 // http://crbug.com/406574
1072 #define MAYBE_VerifyBlendForRotationAboutX DISABLED_VerifyBlendForRotationAboutX
1073 #else
1074 #define MAYBE_VerifyBlendForRotationAboutX VerifyBlendForRotationAboutX
1075 #endif
1076 TEST(XFormTest, MAYBE_VerifyBlendForRotationAboutX) {
1053 // Even though.Blending uses quaternions, axis-aligned rotations should. 1077 // Even though.Blending uses quaternions, axis-aligned rotations should.
1054 // Blend the same with quaternions or Euler angles. So we can test 1078 // Blend the same with quaternions or Euler angles. So we can test
1055 // rotation.Blending by comparing against manually specified matrices from 1079 // rotation.Blending by comparing against manually specified matrices from
1056 // Euler angles. 1080 // Euler angles.
1057 1081
1058 Transform from; 1082 Transform from;
1059 from.RotateAbout(Vector3dF(1.0, 0.0, 0.0), 0.0); 1083 from.RotateAbout(Vector3dF(1.0, 0.0, 0.0), 0.0);
1060 1084
1061 Transform to; 1085 Transform to;
1062 1086
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 1128
1105 to = Transform(); 1129 to = Transform();
1106 to.RotateAbout(Vector3dF(1.0, 0.0, 0.0), 90.0); 1130 to.RotateAbout(Vector3dF(1.0, 0.0, 0.0), 90.0);
1107 to.Blend(from, 1.0); 1131 to.Blend(from, 1.0);
1108 EXPECT_ROW1_NEAR(1.0, 0.0, 0.0, 0.0, to, ERROR_THRESHOLD); 1132 EXPECT_ROW1_NEAR(1.0, 0.0, 0.0, 0.0, to, ERROR_THRESHOLD);
1109 EXPECT_ROW2_NEAR(0.0, 0.0, -1.0, 0.0, to, ERROR_THRESHOLD); 1133 EXPECT_ROW2_NEAR(0.0, 0.0, -1.0, 0.0, to, ERROR_THRESHOLD);
1110 EXPECT_ROW3_NEAR(0.0, 1.0, 0.0, 0.0, to, ERROR_THRESHOLD); 1134 EXPECT_ROW3_NEAR(0.0, 1.0, 0.0, 0.0, to, ERROR_THRESHOLD);
1111 EXPECT_ROW4_EQ(0.0f, 0.0f, 0.0f, 1.0f, to); 1135 EXPECT_ROW4_EQ(0.0f, 0.0f, 0.0f, 1.0f, to);
1112 } 1136 }
1113 1137
1114 TEST(XFormTest, VerifyBlendForRotationAboutY) { 1138 #if defined(_WIN64)
1139 // http://crbug.com/406574
1140 #define MAYBE_VerifyBlendForRotationAboutY DISABLED_VerifyBlendForRotationAboutY
1141 #else
1142 #define MAYBE_VerifyBlendForRotationAboutY VerifyBlendForRotationAboutY
1143 #endif
1144 TEST(XFormTest, MAYBE_VerifyBlendForRotationAboutY) {
1115 Transform from; 1145 Transform from;
1116 from.RotateAbout(Vector3dF(0.0, 1.0, 0.0), 0.0); 1146 from.RotateAbout(Vector3dF(0.0, 1.0, 0.0), 0.0);
1117 1147
1118 Transform to; 1148 Transform to;
1119 1149
1120 to.RotateAbout(Vector3dF(0.0, 1.0, 0.0), 90.0); 1150 to.RotateAbout(Vector3dF(0.0, 1.0, 0.0), 90.0);
1121 to.Blend(from, 0.0); 1151 to.Blend(from, 0.0);
1122 EXPECT_EQ(from, to); 1152 EXPECT_EQ(from, to);
1123 1153
1124 double expectedRotationAngle = 22.5 * M_PI / 180.0; 1154 double expectedRotationAngle = 22.5 * M_PI / 180.0;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 1191
1162 to = Transform(); 1192 to = Transform();
1163 to.RotateAbout(Vector3dF(0.0, 1.0, 0.0), 90.0); 1193 to.RotateAbout(Vector3dF(0.0, 1.0, 0.0), 90.0);
1164 to.Blend(from, 1.0); 1194 to.Blend(from, 1.0);
1165 EXPECT_ROW1_NEAR(0.0, 0.0, 1.0, 0.0, to, ERROR_THRESHOLD); 1195 EXPECT_ROW1_NEAR(0.0, 0.0, 1.0, 0.0, to, ERROR_THRESHOLD);
1166 EXPECT_ROW2_NEAR(0.0, 1.0, 0.0, 0.0, to, ERROR_THRESHOLD); 1196 EXPECT_ROW2_NEAR(0.0, 1.0, 0.0, 0.0, to, ERROR_THRESHOLD);
1167 EXPECT_ROW3_NEAR(-1.0, 0.0, 0.0, 0.0, to, ERROR_THRESHOLD); 1197 EXPECT_ROW3_NEAR(-1.0, 0.0, 0.0, 0.0, to, ERROR_THRESHOLD);
1168 EXPECT_ROW4_EQ(0.0f, 0.0f, 0.0f, 1.0f, to); 1198 EXPECT_ROW4_EQ(0.0f, 0.0f, 0.0f, 1.0f, to);
1169 } 1199 }
1170 1200
1171 TEST(XFormTest, VerifyBlendForRotationAboutZ) { 1201 #if defined(_WIN64)
1202 // http://crbug.com/406574
1203 #define MAYBE_VerifyBlendForRotationAboutZ DISABLED_VerifyBlendForRotationAboutZ
1204 #else
1205 #define MAYBE_VerifyBlendForRotationAboutZ VerifyBlendForRotationAboutZ
1206 #endif
1207 TEST(XFormTest, MAYBE_VerifyBlendForRotationAboutZ) {
1172 Transform from; 1208 Transform from;
1173 from.RotateAbout(Vector3dF(0.0, 0.0, 1.0), 0.0); 1209 from.RotateAbout(Vector3dF(0.0, 0.0, 1.0), 0.0);
1174 1210
1175 Transform to; 1211 Transform to;
1176 1212
1177 to.RotateAbout(Vector3dF(0.0, 0.0, 1.0), 90.0); 1213 to.RotateAbout(Vector3dF(0.0, 0.0, 1.0), 90.0);
1178 to.Blend(from, 0.0); 1214 to.Blend(from, 0.0);
1179 EXPECT_EQ(from, to); 1215 EXPECT_EQ(from, to);
1180 1216
1181 double expectedRotationAngle = 22.5 * M_PI / 180.0; 1217 double expectedRotationAngle = 22.5 * M_PI / 180.0;
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after
2649 EXPECT_EQ(expected.ToString(), box.ToString()); 2685 EXPECT_EQ(expected.ToString(), box.ToString());
2650 2686
2651 Transform singular; 2687 Transform singular;
2652 singular.Scale3d(0.f, 0.f, 0.f); 2688 singular.Scale3d(0.f, 0.f, 0.f);
2653 EXPECT_FALSE(singular.TransformBoxReverse(&box)); 2689 EXPECT_FALSE(singular.TransformBoxReverse(&box));
2654 } 2690 }
2655 2691
2656 } // namespace 2692 } // namespace
2657 2693
2658 } // namespace gfx 2694 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698