Bug 1382517 - add wpt interpolation test for mismatched 3D transforms. r=hiro
authorJeremy Chen <jeremychen@mozilla.com>
Thu, 20 Jul 2017 15:30:53 +0800
changeset 418601 083ab3447c4ca27cc3a8c44528e42b5750b82cb4
parent 418600 f9cbe3a1e13290a978a7db2c26f4fbaf26e55b83
child 418602 6d52fa99545926627d4e2767af66b001373ca3b8
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1382517
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1382517 - add wpt interpolation test for mismatched 3D transforms. r=hiro 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)',