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

Side by Side Diff: ui/gfx/geometry/vector3d_unittest.cc

Issue 2504583003: Fix QuadF::ContainsPoint and gfx::CrossProduct on arm64 (Closed)
Patch Set: quadtest: . Created 4 years, 1 month 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
« no previous file with comments | « ui/gfx/geometry/vector3d_f.cc ('k') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 { 38.72f, 197 { 38.72f,
198 gfx::Vector3dF(1.1f, 2.2f, 3.3f), gfx::Vector3dF(4.4f, 5.5f, 6.6f) } 198 gfx::Vector3dF(1.1f, 2.2f, 3.3f), gfx::Vector3dF(4.4f, 5.5f, 6.6f) }
199 }; 199 };
200 200
201 for (size_t i = 0; i < arraysize(tests); ++i) { 201 for (size_t i = 0; i < arraysize(tests); ++i) {
202 float actual = gfx::DotProduct(tests[i].input1, tests[i].input2); 202 float actual = gfx::DotProduct(tests[i].input1, tests[i].input2);
203 EXPECT_EQ(tests[i].expected, actual); 203 EXPECT_EQ(tests[i].expected, actual);
204 } 204 }
205 } 205 }
206 206
207 #if defined(ARCH_CPU_ARM_FAMILY) 207 TEST(Vector3dTest, CrossProduct) {
208 // TODO(danakj): Make this pass on ARM, https://crbug.com/662556
209 #define MAYBE_CrossProduct DISABLED_CrossProduct
210 #else
211 #define MAYBE_CrossProduct CrossProduct
212 #endif
213 TEST(Vector3dTest, MAYBE_CrossProduct) {
214 const struct { 208 const struct {
215 gfx::Vector3dF expected; 209 gfx::Vector3dF expected;
216 gfx::Vector3dF input1; 210 gfx::Vector3dF input1;
217 gfx::Vector3dF input2; 211 gfx::Vector3dF input2;
218 } tests[] = { 212 } tests[] = {
219 { Vector3dF(), Vector3dF(), Vector3dF(1, 1, 1) }, 213 { Vector3dF(), Vector3dF(), Vector3dF(1, 1, 1) },
220 { Vector3dF(), Vector3dF(1, 1, 1), Vector3dF() }, 214 { Vector3dF(), Vector3dF(1, 1, 1), Vector3dF() },
221 { Vector3dF(), Vector3dF(1, 1, 1), Vector3dF(1, 1, 1) }, 215 { Vector3dF(), Vector3dF(1, 1, 1), Vector3dF(1, 1, 1) },
222 { Vector3dF(), 216 { Vector3dF(),
223 Vector3dF(1.6f, 10.6f, -10.6f), 217 Vector3dF(1.6f, 10.6f, -10.6f),
224 Vector3dF(1.6f, 10.6f, -10.6f) }, 218 Vector3dF(1.6f, 10.6f, -10.6f) },
225 219
226 { Vector3dF(1, -1, 0), Vector3dF(1, 1, 1), Vector3dF(0, 0, 1) }, 220 { Vector3dF(1, -1, 0), Vector3dF(1, 1, 1), Vector3dF(0, 0, 1) },
227 { Vector3dF(-1, 0, 1), Vector3dF(1, 1, 1), Vector3dF(0, 1, 0) }, 221 { Vector3dF(-1, 0, 1), Vector3dF(1, 1, 1), Vector3dF(0, 1, 0) },
228 { Vector3dF(0, 1, -1), Vector3dF(1, 1, 1), Vector3dF(1, 0, 0) }, 222 { Vector3dF(0, 1, -1), Vector3dF(1, 1, 1), Vector3dF(1, 0, 0) },
229 223
230 { Vector3dF(-1, 1, 0), Vector3dF(0, 0, 1), Vector3dF(1, 1, 1) }, 224 { Vector3dF(-1, 1, 0), Vector3dF(0, 0, 1), Vector3dF(1, 1, 1) },
231 { Vector3dF(1, 0, -1), Vector3dF(0, 1, 0), Vector3dF(1, 1, 1) }, 225 { Vector3dF(1, 0, -1), Vector3dF(0, 1, 0), Vector3dF(1, 1, 1) },
232 { Vector3dF(0, -1, 1), Vector3dF(1, 0, 0), Vector3dF(1, 1, 1) } 226 { Vector3dF(0, -1, 1), Vector3dF(1, 0, 0), Vector3dF(1, 1, 1) }
233 }; 227 };
234 228
235 for (size_t i = 0; i < arraysize(tests); ++i) { 229 for (size_t i = 0; i < arraysize(tests); ++i) {
230 SCOPED_TRACE(i);
Nico 2016/11/16 22:36:15 remove?
danakj 2016/11/16 22:36:48 No, I think this should be here. It will report if
236 Vector3dF actual = gfx::CrossProduct(tests[i].input1, tests[i].input2); 231 Vector3dF actual = gfx::CrossProduct(tests[i].input1, tests[i].input2);
237 EXPECT_EQ(tests[i].expected.ToString(), actual.ToString()); 232 EXPECT_EQ(tests[i].expected.ToString(), actual.ToString());
238 } 233 }
239 } 234 }
240 235
241 TEST(Vector3dFTest, ClampVector3dF) { 236 TEST(Vector3dFTest, ClampVector3dF) {
242 Vector3dF a; 237 Vector3dF a;
243 238
244 a = Vector3dF(3.5f, 5.5f, 7.5f); 239 a = Vector3dF(3.5f, 5.5f, 7.5f);
245 EXPECT_EQ(Vector3dF(3.5f, 5.5f, 7.5f).ToString(), a.ToString()); 240 EXPECT_EQ(Vector3dF(3.5f, 5.5f, 7.5f).ToString(), a.ToString());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 EXPECT_FLOAT_EQ(tests[i].expected, actual); 312 EXPECT_FLOAT_EQ(tests[i].expected, actual);
318 actual = -gfx::ClockwiseAngleBetweenVectorsInDegrees( 313 actual = -gfx::ClockwiseAngleBetweenVectorsInDegrees(
319 tests[i].input2, tests[i].input1, normal_vector); 314 tests[i].input2, tests[i].input1, normal_vector);
320 if (actual < 0.0f) 315 if (actual < 0.0f)
321 actual += 360.0f; 316 actual += 360.0f;
322 EXPECT_FLOAT_EQ(tests[i].expected, actual); 317 EXPECT_FLOAT_EQ(tests[i].expected, actual);
323 } 318 }
324 } 319 }
325 320
326 } // namespace gfx 321 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/geometry/vector3d_f.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698