Bug 1290535 - Part 2: Add test. r=hiro

MozReview-Commit-ID: 8qDnF8RdXFF

--HG--
extra : rebase_source : 7322910400b38120a1ff0dde8bb95cb01affde13
This commit is contained in:
Boris Chiou 2016-08-19 14:13:00 +08:00
Родитель 3564271f97
Коммит 1c36938ba6
5 изменённых файлов: 70 добавлений и 0 удалений

Просмотреть файл

@ -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>

Просмотреть файл

@ -10,3 +10,4 @@ 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

Просмотреть файл

@ -41,6 +41,7 @@ support-files =
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
@ -91,6 +92,7 @@ skip-if = (toolkit == 'gonk' && debug)
[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]

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>