Index: ui/gfx/geometry/quaternion_unittest.cc |
diff --git a/ui/gfx/geometry/quaternion_unittest.cc b/ui/gfx/geometry/quaternion_unittest.cc |
index ef460151d37bbd1f0fe2f25234a2ced6aec97b71..38e192e1d0a669d4b9e9c1b90a0699193c33cd9b 100644 |
--- a/ui/gfx/geometry/quaternion_unittest.cc |
+++ b/ui/gfx/geometry/quaternion_unittest.cc |
@@ -142,16 +142,15 @@ TEST(QuatTest, SlerpOppositeAngles) { |
Quaternion start(axis, start_radians); |
Quaternion stop(axis, stop_radians); |
- // When quaternions are pointed in the fully opposite direction, we take the |
- // interpolated quaternion to be the first. This is arbitrary, but if we |
- // change this policy, this test should fail. |
- Quaternion expected = start; |
- |
- for (size_t i = 0; i < 100; ++i) { |
- float t = static_cast<float>(i) / 100.0f; |
- Quaternion interpolated = start.Slerp(stop, t); |
- CompareQuaternions(expected, interpolated); |
- } |
+ // When quaternions are pointed in the fully opposite direction, this is |
+ // ambiguous, so we rotate as per https://www.w3.org/TR/css-transforms-1/ |
+ Quaternion expected(axis, 0); |
+ |
+ Quaternion interpolated = start.Slerp(stop, 0.5f); |
+ EXPECT_NEAR(expected.x(), interpolated.x(), kEpsilon); |
+ EXPECT_NEAR(expected.y(), interpolated.y(), kEpsilon); |
+ EXPECT_NEAR(expected.z(), interpolated.z(), kEpsilon); |
+ EXPECT_NEAR(expected.w(), interpolated.w(), kEpsilon); |
} |
} // namespace gfx |