Bug 1375812 - Test the result of interpolation from interpolatematrix to none. draft
authorBoris Chiou <boris.chiou@gmail.com>
Wed, 28 Jun 2017 10:57:50 -0700
changeset 601468 01aa1ba4be2f313637850669802b0b4a0f2240ff
parent 601467 0aa3176d72531aa6892a7cca232527733b665c49
child 635262 dd11ca4dcaa675b62dfb0c8b244b00fd78b13c44
push id66066
push userbmo:boris.chiou@gmail.com
push dateWed, 28 Jun 2017 19:57:26 +0000
bugs1375812
milestone56.0a1
Bug 1375812 - Test the result of interpolation from interpolatematrix to none. MozReview-Commit-ID: 3oiSVo2WCWE
dom/animation/test/mochitest.ini
dom/animation/test/style/test_interpolation-from-interpolatematrix-to-none.html
--- a/dom/animation/test/mochitest.ini
+++ b/dom/animation/test/mochitest.ini
@@ -110,10 +110,11 @@ support-files =
 [mozilla/test_transform_limits.html]
 [mozilla/test_transition_finish_on_compositor.html]
 skip-if = toolkit == 'android'
 [mozilla/test_underlying-discrete-value.html]
 [style/test_animation-seeking-with-current-time.html]
 [style/test_animation-seeking-with-start-time.html]
 [style/test_animation-setting-effect.html]
 [style/test_composite.html]
+[style/test_interpolation-from-interpolatematrix-to-none.html]
 [style/test_missing-keyframe.html]
 [style/test_missing-keyframe-on-compositor.html]
new file mode 100644
--- /dev/null
+++ b/dom/animation/test/style/test_interpolation-from-interpolatematrix-to-none.html
@@ -0,0 +1,43 @@
+<!doctype html>
+<meta charset=utf-8>
+<script src='/resources/testharness.js'></script>
+<script src='/resources/testharnessreport.js'></script>
+<script src='../testcommon.js'></script>
+<div id='log'></div>
+<script type='text/javascript'>
+'use strict';
+
+test(function(t) {
+  var target = addDiv(t);
+  target.style.transform = 'translateX(100px)';
+  target.style.transition = 'all 10s linear -5s';
+  getComputedStyle(target).transform;
+
+  target.style.transform = 'rotate(90deg)';
+  var interpolated_matrix = 'matrix(' + Math.cos(Math.PI / 4) + ',' +
+                                        Math.sin(Math.PI / 4) + ',' +
+                                       -Math.sin(Math.PI / 4) + ',' +
+                                        Math.cos(Math.PI / 4) + ',' +
+                                        '50, 0)';
+  assert_matrix_equals(getComputedStyle(target).transform,
+                       interpolated_matrix,
+                       'the equivalent matrix of ' + 'interpolatematrix(' +
+                       'translateX(100px), rotate(90deg), 0.5)');
+
+  // Trigger a new transition from
+  // interpolatematrix(translateX(100px), rotate(90deg), 0.5) to none
+  // with 'all 10s linear -5s'.
+  target.style.transform = 'none';
+  interpolated_matrix = 'matrix(' + Math.cos(Math.PI / 8) + ',' +
+                                    Math.sin(Math.PI / 8) + ',' +
+                                   -Math.sin(Math.PI / 8) + ',' +
+                                    Math.cos(Math.PI / 8) + ',' +
+                                    '25, 0)';
+  assert_matrix_equals(getComputedStyle(target).transform,
+                       interpolated_matrix,
+                       'the expected matrix from interpolatematrix(' +
+                       'translateX(100px), rotate(90deg), 0.5) to none at 50%');
+}, 'Test interpolation from interpolatmatrix to none at 50%');
+
+</script>
+</html>