Bug 1290535 - Part 2: Add test. draft
authorBoris Chiou <boris.chiou@gmail.com>
Fri, 19 Aug 2016 14:13:00 +0800
changeset 403195 f228a7e79a5d97cc446ce66ceb3a45d59e1c6773
parent 403188 d0b1bc6f446a5fe6a060474a36359ef6fb5053b4
child 528848 ad7597914094e851bc30ecd5567c9440c56717be
push id26851
push userbmo:boris.chiou@gmail.com
push dateFri, 19 Aug 2016 09:14:39 +0000
bugs1290535
milestone51.0a1
Bug 1290535 - Part 2: Add test. MozReview-Commit-ID: 8qDnF8RdXFF
dom/animation/test/crashtests/1290535-1.html
dom/animation/test/crashtests/crashtests.list
dom/animation/test/mochitest.ini
dom/animation/test/mozilla/file_spacing_property_order.html
dom/animation/test/mozilla/test_spacing_property_order.html
new file mode 100644
--- /dev/null
+++ b/dom/animation/test/crashtests/1290535-1.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title>Bug 1290535 - Sort paced subproperties of a shorthand property</title>
+<meta charset="UTF-8">
+<script>
+
+function test()
+{
+  var div = document.createElement('div');
+  document.documentElement.appendChild(div);
+  div.animate([ { borderRadius: "0", borderTopRightRadius: "0" },
+                { borderRadius: "50%" } ],
+              { spacing:"paced(border-radius)" });
+}
+
+</script>
+</head>
+<body onload="test();"></body>
+</html>
--- a/dom/animation/test/crashtests/crashtests.list
+++ b/dom/animation/test/crashtests/crashtests.list
@@ -5,8 +5,9 @@ pref(dom.animations-api.core.enabled,tru
 pref(dom.animations-api.core.enabled,true) load 1216842-3.html
 pref(dom.animations-api.core.enabled,true) load 1216842-4.html
 pref(dom.animations-api.core.enabled,true) load 1216842-5.html
 pref(dom.animations-api.core.enabled,true) load 1216842-6.html
 pref(dom.animations-api.core.enabled,true) load 1272475-1.html
 pref(dom.animations-api.core.enabled,true) load 1272475-2.html
 pref(dom.animations-api.core.enabled,true) load 1278485-1.html
 pref(dom.animations-api.core.enabled,true) load 1277272-1.html
+pref(dom.animations-api.core.enabled,true) load 1290535-1.html
--- a/dom/animation/test/mochitest.ini
+++ b/dom/animation/test/mochitest.ini
@@ -36,16 +36,17 @@ support-files =
   css-transitions/file_pseudoElement-get-animations.html
   document-timeline/file_document-timeline.html
   mozilla/file_cubic_bezier_limits.html
   mozilla/file_deferred_start.html
   mozilla/file_disabled_properties.html
   mozilla/file_document-timeline-origin-time-range.html
   mozilla/file_hide_and_show.html
   mozilla/file_partial_keyframes.html
+  mozilla/file_spacing_property_order.html
   mozilla/file_transform_limits.html
   mozilla/file_underlying-discrete-value.html
   style/file_animation-seeking-with-current-time.html
   style/file_animation-seeking-with-start-time.html
   testcommon.js
 
 [css-animations/test_animations-dynamic-changes.html]
 [css-animations/test_animation-cancel.html]
@@ -86,12 +87,13 @@ skip-if = buildapp == 'mulet'
 [mozilla/test_cubic_bezier_limits.html]
 [mozilla/test_deferred_start.html]
 skip-if = (toolkit == 'gonk' && debug)
 [mozilla/test_disabled_properties.html]
 [mozilla/test_document-timeline-origin-time-range.html]
 [mozilla/test_hide_and_show.html]
 [mozilla/test_partial_keyframes.html]
 [mozilla/test_set-easing.html]
+[mozilla/test_spacing_property_order.html]
 [mozilla/test_transform_limits.html]
 [mozilla/test_underlying-discrete-value.html]
 [style/test_animation-seeking-with-current-time.html]
 [style/test_animation-seeking-with-start-time.html]
new file mode 100644
--- /dev/null
+++ b/dom/animation/test/mozilla/file_spacing_property_order.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<meta charset=utf-8>
+<script src="../testcommon.js"></script>
+<body>
+<script>
+'use strict';
+
+test(function(t) {
+  var div = document.createElement('div');
+  document.documentElement.appendChild(div);
+  var anim = div.animate([ { borderRadius: "0", borderTopRightRadius: "10%" },
+                           { borderTopLeftRadius: "20%",
+                             borderTopRightRadius: "30%",
+                             borderBottomRightRadius: "40%",
+                             borderBottomLeftRadius: "50%" },
+                           { borderRadius: "50%" } ],
+                         { spacing:"paced(border-radius)" });
+
+  var frames = anim.effect.getKeyframes();
+  var dist = [ 0,
+               Math.sqrt(20 * 20 + (30 - 10) * (30 - 10) + 40 * 40 + 50 * 50),
+               Math.sqrt((50 - 20) * (50 - 20) + (50 - 30) * (50 - 30) +
+                         (50 - 40) * (50 - 40) + (50 - 50) * (50 - 50)) ];
+  var cumDist = [];
+  dist.reduce(function(prev, curr, i) { return cumDist[i] = prev + curr; }, 0);
+  assert_approx_equals(frames[1].computedOffset, cumDist[1] / cumDist[2],
+                       0.0001, 'frame offset');
+}, 'Test for the longhand components of the shorthand property surely sorted' );
+
+done();
+
+</script>
+</body>
new file mode 100644
--- /dev/null
+++ b/dom/animation/test/mozilla/test_spacing_property_order.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<meta charset=utf-8>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+'use strict';
+setup({explicit_done: true});
+SpecialPowers.pushPrefEnv(
+  { "set": [["dom.animations-api.core.enabled", true]]},
+  function() {
+    window.open("file_spacing_property_order.html");
+  });
+</script>