Bug 1390039 - Add tests for mismatched transform lists and some other corner cases. r=birtles
authorBoris Chiou <boris.chiou@gmail.com>
Mon, 21 Aug 2017 16:36:17 +0800
changeset 377813 3c98f36b75781b7787c4253a1170df12f38dc0bd
parent 377812 8cb237283ed0b7628f2253360ceb20add052611c
child 377814 e9156a9ede8e56245e18baa45e0f0a41e28a5792
push id94338
push userkwierso@gmail.com
push dateThu, 31 Aug 2017 02:58:58 +0000
treeherdermozilla-inbound@9ca18987dabb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1390039
milestone57.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 1390039 - Add tests for mismatched transform lists and some other corner cases. r=birtles MozReview-Commit-ID: ESchrGe6h9N
dom/animation/test/mozilla/test_distance_of_transform.html
--- a/dom/animation/test/mozilla/test_distance_of_transform.html
+++ b/dom/animation/test/mozilla/test_distance_of_transform.html
@@ -65,16 +65,22 @@ function rotate3dToMatrix(x, y, z, radia
     0,
     0,
     1
   ];
 }
 
 test(function(t) {
   var target = addDiv(t);
+  var dist = getDistance(target, 'transform', 'none', 'none');
+  assert_equals(dist, 0, 'distance of translate');
+}, 'Test distance of none and none');
+
+test(function(t) {
+  var target = addDiv(t);
   var dist = getDistance(target, 'transform', 'translate(100px)', 'none');
   assert_equals(dist, 100, 'distance of translate');
 }, 'Test distance of translate function and none');
 
 test(function(t) {
   var target = addDiv(t);
   var dist =
     getDistance(target, 'transform', 'translate(100px)', 'translate(200px)');
@@ -299,10 +305,44 @@ test(function(t) {
   var dist =
     getDistance(target, 'transform',
                 'rotate(180deg) translate(1000px)',
                 'rotate(360deg) translate(0px)');
   assert_equals(dist, Math.sqrt(1000 * 1000 + Math.PI * Math.PI),
                 'distance of transform lists');
 }, 'Test distance of transform lists');
 
+test(function(t) {
+  var target = addDiv(t);
+  var dist = getDistance(target, 'transform',
+                         'translate(100px) rotate(180deg)',
+                         'translate(50px) rotate(90deg) scale(5) skew(1rad)');
+  assert_approx_equals(dist,
+                       Math.sqrt(50 * 50 +
+                                 Math.PI / 2 * Math.PI / 2 +
+                                 4 * 4 * 2 +
+                                 1 * 1),
+                       epsilon,
+                       'distance of transform lists');
+}, 'Test distance of transform lists where one has extra items');
+
+test(function(t) {
+  var target = addDiv(t);
+  var dist = getDistance(target, 'transform',
+                         'translate(1000px) rotate3d(1, 0, 0, 180deg)',
+                         'translate(1000px) scale3d(2.5, 0.5, 1)');
+  assert_equals(dist, Math.sqrt(Math.PI * Math.PI + 1.5 * 1.5 + 0.5 * 0.5),
+                'distance of transform lists');
+}, 'Test distance of mismatched transform lists');
+
+test(function(t) {
+  var target = addDiv(t);
+  var dist = getDistance(target, 'transform',
+                         'translate(100px) skew(1rad)',
+                         'translate(1000px) rotate3d(0, 1, 0, -2rad)');
+  assert_approx_equals(dist,
+                       Math.sqrt(900 * 900 + 1 * 1 + 2 * 2),
+                       epsilon,
+                       'distance of transform lists');
+}, 'Test distance of mismatched transform lists with skew function');
+
 </script>
 </html>