Commit b9a1950b authored by Kevin Ellis's avatar Kevin Ellis Committed by Commit Bot

Split and augment reftests for rotation interpolation.

Divided the rotation tests into two groups: one for common axis,
second for interpolated axis + angle (SLERP).  By separating in this
way, it is easier to match up the tests with the corresponding images.

The 0 -> 90 degree tests for common-axis rotations were changed to
30 -> 90 since a zero degree rotation matches any non-zero counterpart.

Tests added to both groups to verify the following:

* rotation with scaled axis
* rotate -> rotateZ
* special case of a zero rotation angle
* counter-rotation with negative angle
* counter-rotation with inverted axis
* axis+angle interpolation (SLERP)

Bug: 998175, 929841
Change-Id: Iefcfa9bf0d55b6df7f459f51c8b900dd991ab890
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2513796Reviewed-by: default avatarXida Chen <xidachen@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823746}
parent 70ee8e77
......@@ -6228,3 +6228,10 @@ crbug.com/1144537 external/wpt/xhr/responsexml-document-properties.htm [ Pass Fa
# Sheriff 2020-11-03
crbug.com/1145019 [ Win7 ] fast/events/updateLayoutForHitTest.html [ Failure ]
# Lack of support for reftest fuzzy matching
# Reftests have minor pixel differences due to antialiasing.
crbug.com/997202 [ Mac ] external/wpt/css/css-transforms/animation/transform-interpolation-rotate-slerp.html [ Failure ]
crbug.com/997202 [ Mac ] virtual/composite-relative-keyframes/external/wpt/css/css-transforms/animation/transform-interpolation-rotate-slerp.html [ Failure ]
crbug.com/997202 [ Mac ] virtual/threaded/external/wpt/css/css-transforms/animation/transform-interpolation-rotate-slerp.html [ Failure ]
crbug.com/997202 [ Mac ] virtual/transform-interop/external/wpt/css/css-transforms/animation/transform-interpolation-rotate-slerp.html [ Failure ]
......@@ -18,13 +18,43 @@ const transformTests = {
['translateX(50%)', 'translateX(calc(25% - 2em))', 'translateX(-4em)']
],
rotate: [
['rotate(0deg)', 'rotate(45deg)', 'rotate(90deg)'],
['rotateX(0deg)', 'rotateX(45deg)', 'rotateX(90deg)'],
['rotateY(0deg)', 'rotateY(45deg)', 'rotateY(90deg)'],
// Rotation about named-axis.
['rotate(30deg)', 'rotate(60deg)', 'rotate(90deg)'],
['rotateX(30deg)', 'rotateX(60deg)', 'rotateX(90deg)'],
['rotateY(30deg)', 'rotateY(60deg)', 'rotateY(90deg)'],
['rotate(30deg)', 'rotate(60deg)', 'rotateZ(90deg)'],
['rotate(0deg)', 'rotate(180deg)', 'rotate(360deg)'],
// Common axis rotations.
['rotate3d(7, 8, 9, 0deg)', 'rotate3d(7, 8, 9, 45deg)', 'rotate3d(7, 8, 9, 90deg)'],
['rotate3d(1, 2, 3, 0deg)', 'rotate3d(3, 6, 9, 45deg)', 'rotate3d(2, 4, 6, 90deg)'],
// Axis is arbitrary if angle is zero. Use non-zero rotation to determine
// the rotation axis.
['rotateX(0deg)', 'rotate(45deg)', 'rotate(90deg)'],
['rotateX(90deg)', 'rotateX(45deg)', 'rotate(0deg)']
],
rotateSlerp: [
// First endpoint is the same rotation as rotateZ(0deg) but triggers SLERP
['rotateX(360deg)', 'rotateZ(45deg)', 'rotateZ(90deg)']
['rotateX(360deg)', 'rotateZ(45deg)', 'rotateZ(90deg)'],
// Interpolation with inverse. Second case is a common-axis case, but
// included here to group it with its equivalent SLERP test.
['rotate(45deg)', 'rotate(0deg)', 'rotate3d(0, 0, -1, 45deg)'],
['rotate(45deg)', 'rotate(0deg)', 'rotate(-45deg)'],
// Interpolate axis and angle of rotation.
// 70.5288deg = acos(1/3).
['rotateX(90deg)', 'rotate3d(1, 1, 0, 70.5288deg)', 'rotateY(90deg)'],
// Not nice analytical solution for this last one.
// (1, 1, 0, 90deg) --> (x, y, z, w) = (1/2, 1/2, 0, 1/root2)
// (0, 1, 1, 180deg) --> (x, y, z, w) = (0, 1/root2, 1/root2, 0)
// Trace of the "to" transformation matrix is -1. Requires special handling
// to ensure correctness of the quaternion.
// SLERP @0.5: (x, y, z, w) = (0.30389062997686395,
// 0.7336568918027127,
// 0.4297662618258487,
// 0.4297662618258487)
// --> rotate3d(0.3365568, 0.8125199, 0.4759632, 129.094547486deg)
['rotate3d(1, 1, 0, 90deg)',
'rotate3d(0.3365568, 0.8125199, 0.4759632, 129.094547486deg)',
'rotate3d(0, 1, 1, 180deg)'],
],
scale: [
['scaleX(0.5)', 'scaleX(0.75)', 'scaleX(1)'],
......
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="match" href="transform-interpolation-ref.html?rotateSlerp">
<link rel="help" href="https://drafts.csswg.org/css-transforms/">
<script src="../../../common/reftest-wait.js"></script>
<script src="support/transform-interpolation-reftests.js"></script>
<body>
<script>
createTests(transformTests.rotateSlerp);
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment