Bug 1507600 [wpt PR 14080] - Improve robustness of wpt animation interpolation tests., a=testonly
☠☠ backed out by 46ad93280b06 ☠ ☠
authorKevin Ellis <kevers@chromium.org>
Mon, 19 Nov 2018 18:45:27 +0000
changeset 503727 ac81704153383bad49d9009a5992d97517381424
parent 503726 d7e0ada6193474f4e446485988d6f10b992499b2
child 503728 956ed95b791ee5dbb48bb027943e5257144fb2d7
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1507600, 14080, 797472, 1337640, 608466
milestone65.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 1507600 [wpt PR 14080] - Improve robustness of wpt animation interpolation tests., a=testonly Automatic update from web-platform-testsImprove robustness of wpt animation interpolation tests. This patch fixes the problem where subtle changes to numerical values in matrix interpolation cause mismatches in the expected results. To address the issue: * Styles are checked to see if they are of the form matrix(...) or matrix3d(...). * If the style is a matrix, then arguments are rounded and the style is reconstructed. Bug: 797472 Change-Id: I44d6e0ed13e24dc2ecfeeacbcd4809d6dcdb6465 Reviewed-on: https://chromium-review.googlesource.com/c/1337640 Reviewed-by: Xida Chen <xidachen@chromium.org> Commit-Queue: Kevin Ellis <kevers@chromium.org> Cr-Commit-Position: refs/heads/master@{#608466} -- wpt-commits: 794b7ee9292f09802cd41e41a04be420b1d7bec3 wpt-pr: 14080
testing/web-platform/tests/css/css-transforms/animation/resources/interpolation-testcommon.js
--- a/testing/web-platform/tests/css/css-transforms/animation/resources/interpolation-testcommon.js
+++ b/testing/web-platform/tests/css/css-transforms/animation/resources/interpolation-testcommon.js
@@ -6,16 +6,38 @@ function test_interpolation(settings, ex
     if (progress === 0)
       return 'steps(1, end)';
     if (progress === 1)
       return 'steps(1, start)';
     var y = (8 * progress - 1) / 6;
     return 'cubic-bezier(0, ' + y + ', 1, ' + y + ')';
   }
 
+  function RoundMatrix(style) {
+    var matrixMatch = style.match(/^(matrix(3d)?)\(.+\)$/);
+    if (!!matrixMatch) {
+      var matrixType = matrixMatch[1];
+      var matrixArgs = style.substr(matrixType.length);
+      var extractmatrix = function(matrixStr) {
+        var list = [];
+        var regex = /[+\-]?[0-9]+[.]?[0-9]*(e[+/-][0-9]+)?/g;
+        var match = undefined;
+        do {
+          match = regex.exec(matrixStr);
+          if (match) {
+            list.push(parseFloat(parseFloat(match[0]).toFixed(6)));
+          }
+        } while (match);
+        return list;
+      }
+      return matrixType + '(' + extractmatrix(matrixArgs).join(', ') + ')';
+    }
+    return style;
+  }
+
   test(function(){
     assert_true(CSS.supports(settings.property, settings.from), 'Value "' + settings.from + '" is supported by ' + settings.property);
     assert_true(CSS.supports(settings.property, settings.to), 'Value "' + settings.to + '" is supported by ' + settings.property);
   }, message_prefix + '"' + settings.from + '" and "' + settings.to + '" are valid ' + settings.property + ' values');
 
   for (var i = 0; i < expectations.length; ++i) {
     var progress = expectations[i].at;
     var expectation = expectations[i].expect;
@@ -44,12 +66,14 @@ function test_interpolation(settings, ex
       target.id = targetId;
       document.body.appendChild(target);
 
       var reference = document.createElement('div');
       reference.id = referenceId;
       document.body.appendChild(reference);
       reference.style = '';
 
-      assert_equals(getComputedStyle(target)[settings.property], getComputedStyle(reference)[settings.property]);
+      var observed = RoundMatrix(getComputedStyle(target)[settings.property]);
+      var expected = RoundMatrix(getComputedStyle(reference)[settings.property]);
+      assert_equals(observed, expected);
     }, message_prefix + 'Animation between "' + settings.from + '" and "' + settings.to + '" at progress ' + progress);
   }
 }