Bug 1382517 - add wpt interpolation test for mismatched 3D transforms. draft
authorJeremy Chen <jeremychen@mozilla.com>
Thu, 20 Jul 2017 15:30:53 +0800
changeset 612130 95ff2d211520d3708e0faf0af9a66da92f2e8bff
parent 612129 167532d4d6e549a2998f178d1c93f0f42206eb92
child 612131 a28d42816b77d2583b03e909fd94801b4e5a0165
push id69392
push userbmo:jeremychen@mozilla.com
push dateThu, 20 Jul 2017 10:27:50 +0000
bugs1382517
milestone56.0a1
Bug 1382517 - add wpt interpolation test for mismatched 3D transforms. This test aims for forcing the two mismatched transforms to be decomposed into matrix3d before interpolation. To do so, we need to: 1. make 'From' and 'To' to be two mismatched transforms, 2. at least one of the two transforms has to be a 3D transform. In this way, we not only test the interpolation, but also test the correctness of 3D matrix decomposition. MozReview-Commit-ID: FAKu6GFVZRm
testing/web-platform/tests/web-animations/animation-model/animation-types/property-types.js
--- a/testing/web-platform/tests/web-animations/animation-model/animation-types/property-types.js
+++ b/testing/web-platform/tests/web-animations/animation-model/animation-types/property-types.js
@@ -879,16 +879,35 @@ const transformListType = {
       var to = rotate3dToMatrix3d(1, 1, 0, Math.PI * 3 / 4);
       var animation =
         target.animate({ [idlName]: [ from, to ] }, 1000);
 
       testAnimationSampleMatrices(animation, idlName,
         [{ time: 500, expected: rotate3dToMatrix(1, 1, 0, Math.PI * 2 / 4) }]);
     }, property + ': matrix3d');
 
+    // This test aims for forcing the two mismatched transforms to be
+    // decomposed into matrix3d before interpolation. Therefore, we not only
+    // test the interpolation, but also test the 3D matrix decomposition.
+    test(function(t) {
+      var idlName = propertyToIDL(property);
+      var target = createTestElement(t, setup);
+      var animation =
+        target.animate({ [idlName]: ['scale(0.3)',
+                                     // scale(0.5) translateZ(1px)
+                                     'matrix3d(0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1)'] },
+                       1000);
+
+      testAnimationSampleMatrices(animation, idlName,
+        [{ time: 500,  expected: [ 0.4, 0,   0,   0,
+                                   0,   0.4, 0,   0,
+                                   0,   0,   1,   0,
+                                   0,   0,   0.5, 1] }]);
+    }, property + ': mismatched 3D transforms');
+
   },
 
   testAddition: function(property, setup) {
     test(function(t) {
       var idlName = propertyToIDL(property);
       var target = createTestElement(t, setup);
       target.style[idlName] = 'translateX(100px)';
       var animation = target.animate({ [idlName]: ['translateX(-200px)',