mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
Update web-platform-tests to revision 1e42017386ce1eaeed4925fb8bc7f5417752019a
This commit is contained in:
parent
5574a4e4c8
commit
a972fdb353
2003 changed files with 16788 additions and 3140 deletions
|
@ -1,6 +1,7 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Web Animations API: DocumentTimeline tests</title>
|
||||
<title>Default document timeline tests</title>
|
||||
<link rel="help" href="https://w3c.github.io/web-animations/#the-documents-default-timeline">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
|
@ -16,15 +17,9 @@ test(function() {
|
|||
'document.timeline returns a different object for each document');
|
||||
assert_not_equals(iframe.contentDocument.timeline, null,
|
||||
'document.timeline on an iframe is not null');
|
||||
},
|
||||
'document.timeline identity tests',
|
||||
{
|
||||
help: 'http://dev.w3.org/fxtf/web-animations/#the-document-timeline',
|
||||
assert: [ 'Each document has a timeline called the document timeline' ],
|
||||
author: 'Brian Birtles'
|
||||
});
|
||||
}, 'document.timeline identity tests');
|
||||
|
||||
async_test(function(t) {
|
||||
promise_test(function(t) {
|
||||
assert_true(document.timeline.currentTime > 0,
|
||||
'document.timeline.currentTime is positive');
|
||||
// document.timeline.currentTime should be set even before document
|
||||
|
@ -40,31 +35,14 @@ async_test(function(t) {
|
|||
// We can't just compare document.timeline.currentTime to
|
||||
// window.performance.now() because currentTime is only updated on a sample
|
||||
// so we use requestAnimationFrame instead.
|
||||
window.requestAnimationFrame(t.step_func(function(rafTime) {
|
||||
return window.requestAnimationFrame(t.step_func(function(rafTime) {
|
||||
assert_equals(document.timeline.currentTime, rafTime,
|
||||
'document.timeline.currentTime matches' +
|
||||
' requestAnimationFrame time');
|
||||
t.done();
|
||||
}));
|
||||
},
|
||||
'document.timeline.currentTime value tests',
|
||||
{
|
||||
help: [
|
||||
'http://dev.w3.org/fxtf/web-animations/#the-global-clock',
|
||||
'http://dev.w3.org/fxtf/web-animations/#the-document-timeline'
|
||||
],
|
||||
assert: [
|
||||
'The global clock is a source of monotonically increasing time values',
|
||||
'The time values of the document timeline are calculated as a fixed' +
|
||||
' offset from the global clock',
|
||||
'the zero time corresponds to the navigationStart moment',
|
||||
'the time value of each document timeline must be equal to the time ' +
|
||||
'passed to animation frame request callbacks for that browsing context'
|
||||
],
|
||||
author: 'Brian Birtles'
|
||||
});
|
||||
}, 'document.timeline.currentTime value tests');
|
||||
|
||||
async_test(function(t) {
|
||||
promise_test(function(t) {
|
||||
var valueAtStart = document.timeline.currentTime;
|
||||
var timeAtStart = window.performance.now();
|
||||
while (window.performance.now() - timeAtStart < 100) {
|
||||
|
@ -72,18 +50,10 @@ async_test(function(t) {
|
|||
}
|
||||
assert_equals(document.timeline.currentTime, valueAtStart,
|
||||
'document.timeline.currentTime does not change within a script block');
|
||||
window.requestAnimationFrame(t.step_func(function() {
|
||||
return window.requestAnimationFrame(t.step_func(function() {
|
||||
assert_true(document.timeline.currentTime > valueAtStart,
|
||||
'document.timeline.currentTime increases between script blocks');
|
||||
t.done();
|
||||
}));
|
||||
},
|
||||
'document.timeline.currentTime liveness tests',
|
||||
{
|
||||
help: 'http://dev.w3.org/fxtf/web-animations/#script-execution-and-live-updates-to-the-model',
|
||||
assert: [ 'The value returned by the currentTime attribute of a' +
|
||||
' document timeline will not change within a script block' ],
|
||||
author: 'Brian Birtles'
|
||||
});
|
||||
}, 'document.timeline.currentTime liveness tests');
|
||||
|
||||
</script>
|
||||
|
|
|
@ -6,11 +6,13 @@
|
|||
<script src="/resources/WebIDLParser.js"></script>
|
||||
<script src="/resources/idlharness.js"></script>
|
||||
<div id="log"></div>
|
||||
<script type="text/plain" id="DocumentTimeline-IDL">
|
||||
<script type="text/plain" id="AnimationTimeline-IDL">
|
||||
interface AnimationTimeline {
|
||||
readonly attribute double? currentTime;
|
||||
};
|
||||
|
||||
</script>
|
||||
<script type="text/plain" id="DocumentTimeline-IDL">
|
||||
[Constructor (DOMHighResTimeStamp originTime)]
|
||||
interface DocumentTimeline : AnimationTimeline {
|
||||
};
|
||||
</script>
|
||||
|
@ -20,6 +22,8 @@ interface DocumentTimeline : AnimationTimeline {
|
|||
var idlArray;
|
||||
test(function() {
|
||||
idlArray = new IdlArray();
|
||||
idlArray.add_untested_idls(
|
||||
document.getElementById('AnimationTimeline-IDL').textContent);
|
||||
idlArray.add_idls(
|
||||
document.getElementById('DocumentTimeline-IDL').textContent);
|
||||
idlArray.add_objects( { DocumentTimeline: ['document.timeline'] } );
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>DocumentTimeline constructor tests</title>
|
||||
<link rel="help" href="https://w3c.github.io/web-animations/#the-documenttimeline-interface">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../../testcommon.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
test(function(t) {
|
||||
var timeline = new DocumentTimeline(0);
|
||||
|
||||
assert_times_equal(timeline.currentTime, document.timeline.currentTime);
|
||||
}, 'zero origin time');
|
||||
|
||||
test(function(t) {
|
||||
var timeline = new DocumentTimeline(10 * MS_PER_SEC);
|
||||
|
||||
assert_times_equal(timeline.currentTime,
|
||||
(document.timeline.currentTime - 10 * MS_PER_SEC));
|
||||
}, 'positive origin time');
|
||||
|
||||
test(function(t) {
|
||||
var timeline = new DocumentTimeline(-10 * MS_PER_SEC);
|
||||
|
||||
assert_times_equal(timeline.currentTime,
|
||||
(document.timeline.currentTime + 10 * MS_PER_SEC));
|
||||
}, 'negative origin time');
|
||||
|
||||
</script>
|
||||
</body>
|
|
@ -85,5 +85,76 @@ test(function(t) {
|
|||
'changing the animation current time.');
|
||||
}, 'Test setting target from a valid target to another target');
|
||||
|
||||
test(function(t) {
|
||||
var anim = createDiv(t).animate([ { marginLeft: '0px' },
|
||||
{ marginLeft: '-20px' },
|
||||
{ marginLeft: '100px' },
|
||||
{ marginLeft: '50px' } ],
|
||||
{ duration: 100 * MS_PER_SEC,
|
||||
spacing: 'paced(margin-left)' });
|
||||
|
||||
anim.effect.target = null;
|
||||
|
||||
var frames = anim.effect.getKeyframes();
|
||||
var slots = frames.length - 1;
|
||||
assert_equals(frames[0].computedOffset, 0.0, '1st frame offset');
|
||||
assert_equals(frames[1].computedOffset, 1.0 / slots, '2nd frame offset');
|
||||
assert_equals(frames[2].computedOffset, 2.0 / slots, '3rd frame offset');
|
||||
assert_equals(frames[3].computedOffset, 1.0, 'last frame offset');
|
||||
}, 'Test falling back to distribute spacing mode after setting null target');
|
||||
|
||||
test(function(t) {
|
||||
var effect = new KeyframeEffect(null,
|
||||
[ { marginLeft: '0px' },
|
||||
{ marginLeft: '-20px' },
|
||||
{ marginLeft: '100px' },
|
||||
{ marginLeft: '50px' } ],
|
||||
{ duration: 100 * MS_PER_SEC,
|
||||
spacing: 'paced(margin-left)' });
|
||||
var frames = effect.getKeyframes();
|
||||
var slots = frames.length - 1;
|
||||
assert_equals(frames[1].computedOffset, 1.0 / slots, '2nd frame offset');
|
||||
assert_equals(frames[2].computedOffset, 2.0 / slots, '3rd frame offset');
|
||||
}, 'Test falling back to distribute spacing mode if there is no context ' +
|
||||
'element');
|
||||
|
||||
test(function(t) {
|
||||
var div1 = createDiv(t);
|
||||
var div2 = createDiv(t);
|
||||
div1.style.marginLeft = '-20px';
|
||||
div2.style.marginLeft = '-50px';
|
||||
var child1 = document.createElement('div');
|
||||
var child2 = document.createElement('div');
|
||||
div1.appendChild(child1);
|
||||
div2.appendChild(child2);
|
||||
// body
|
||||
// / \
|
||||
// div1 div2
|
||||
// (-20px) (-50px)
|
||||
// | |
|
||||
// child1 child2
|
||||
var anim = child1.animate([ { marginLeft: '0px' },
|
||||
{ marginLeft: 'inherit' },
|
||||
{ marginLeft: '100px' },
|
||||
{ marginLeft: '50px' } ],
|
||||
{ duration: 100 * MS_PER_SEC,
|
||||
spacing: 'paced(margin-left)' });
|
||||
|
||||
var frames = anim.effect.getKeyframes();
|
||||
var cumDist = [0, 20, 140, 190];
|
||||
assert_equals(frames[1].computedOffset, cumDist[1] / cumDist[3],
|
||||
'2nd frame offset');
|
||||
assert_equals(frames[2].computedOffset, cumDist[2] / cumDist[3],
|
||||
'3rd frame offset');
|
||||
|
||||
anim.effect.target = child2;
|
||||
frames = anim.effect.getKeyframes();
|
||||
cumDist = [0, 50, 200, 250];
|
||||
assert_equals(frames[1].computedOffset, cumDist[1] / cumDist[3],
|
||||
'2nd frame offset after setting a new target');
|
||||
assert_equals(frames[2].computedOffset, cumDist[2] / cumDist[3],
|
||||
'3rd frame offset after setting a new target');
|
||||
}, 'Test paced spacing mode after setting a new target');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -0,0 +1,237 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>KeyframeEffectReadOnly spacing attribute tests</title>
|
||||
<link rel="help"
|
||||
href="https://w3c.github.io/web-animations/#dom-keyframeeffectreadonly-spacing">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../../testcommon.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: '' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using empty string');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'dist' });
|
||||
});
|
||||
}, 'Test throwing TypeError if not using the correct keyword');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: ' paced(margin-left)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if adding leading spaces');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(margin-left) ' });
|
||||
});
|
||||
}, 'Test throwing TypeError if adding trailing spaces');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced( margin-left)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if adding leading spaces before the ' +
|
||||
'paced property');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(margin-left )' });
|
||||
});
|
||||
}, 'Test throwing TypeError if adding trailing spaces after the ' +
|
||||
'paced property');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced()' });
|
||||
});
|
||||
}, 'Test throwing TypeError if these is no paced property');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(.margin)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident started string');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(1margin)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident started string');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(\\)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident started string with ' +
|
||||
'an invalid escape');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(\\\fmargin)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident started string with ' +
|
||||
'an invalid escape (FF)');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(\\\rmargin)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident started string with ' +
|
||||
'an invalid escape (CR)');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(\\\nmargin)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident started string with ' +
|
||||
'an invalid escape (LF)');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(- )' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident started string with ' +
|
||||
'a leading minus and an invalid name-start code point');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(-\\)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident started string with ' +
|
||||
'a leading minus and an invalid escape');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(-\\\fmargin)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident started string with ' +
|
||||
'a leading minus and an invalid escape (FF)');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(-\\\rmargin)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident started string with ' +
|
||||
'a leading minus and an invalid escape (CR)');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(-\\\nmargin)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident started string with ' +
|
||||
'a leading minus and an invalid escape (LF)');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(--\\)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident string with an invalid ' +
|
||||
'escape');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(--\\\fmargin)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident string with an invalid ' +
|
||||
'escape (FF)');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(--\\\rmargin)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident string with an invalid ' +
|
||||
'escape (CR)');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(--\\\nmargin)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident string with an invalid ' +
|
||||
'escape (LF)');
|
||||
|
||||
test(function(t) {
|
||||
assert_throws(new TypeError, function() {
|
||||
createDiv(t).animate(null, { spacing: 'paced(margin.left)' });
|
||||
});
|
||||
}, 'Test throwing TypeError if using a non-ident string with an invalid name ' +
|
||||
'code point');
|
||||
|
||||
test(function(t) {
|
||||
var anim = createDiv(t).animate(null, { spacing: 'paced(A)' });
|
||||
assert_equals(anim.effect.spacing, 'distribute', 'spacing mode');
|
||||
}, 'Test falling back to distribute spacing if using a unrecognized property');
|
||||
|
||||
test(function(t) {
|
||||
var anim = createDiv(t).animate(null, { spacing: 'paced(\\.margin)' });
|
||||
assert_equals(anim.effect.spacing, 'distribute', 'spacing mode');
|
||||
}, 'Test falling back to distribute spacing if using a unrecognized property ' +
|
||||
'which starts with a valid escape (Full stop)');
|
||||
|
||||
test(function(t) {
|
||||
var anim = createDiv(t).animate(null, { spacing: 'paced(\\ margin)' });
|
||||
assert_equals(anim.effect.spacing, 'distribute', 'spacing mode');
|
||||
}, 'Test falling back to distribute spacing if using a unrecognized property ' +
|
||||
'which starts with a valid escape (white space)');
|
||||
|
||||
test(function(t) {
|
||||
var anim = createDiv(t).animate(null, { spacing: 'paced(_margin)' });
|
||||
assert_equals(anim.effect.spacing, 'distribute', 'spacing mode');
|
||||
}, 'Test falling back to distribute spacing if using a unrecognized property ' +
|
||||
'which starts with a valid escape (low line)');
|
||||
|
||||
test(function(t) {
|
||||
var anim = createDiv(t).animate(null, { spacing: 'paced(-_margin)' });
|
||||
assert_equals(anim.effect.spacing, 'distribute', 'spacing mode');
|
||||
}, 'Test falling back to distribute spacing if using a unrecognized property ' +
|
||||
'which starts with a minus and a low line');
|
||||
|
||||
test(function(t) {
|
||||
var anim = createDiv(t).animate(null, { spacing: 'paced(-\\.margin)' });
|
||||
assert_equals(anim.effect.spacing, 'distribute', 'spacing mode');
|
||||
}, 'Test falling back to distribute spacing if using a unrecognized property ' +
|
||||
'which starts with a minus and a valid escape');
|
||||
|
||||
test(function(t) {
|
||||
var anim = createDiv(t).animate(null, { spacing: 'paced(--bg-color)' });
|
||||
assert_equals(anim.effect.spacing, 'distribute', 'spacing mode');
|
||||
}, 'Test falling back to distribute spacing if using CSS variables');
|
||||
|
||||
test(function(t) {
|
||||
var anim = createDiv(t).animate(null, { spacing: 'paced(animation)' });
|
||||
assert_equals(anim.effect.spacing, 'distribute', 'spacing mode');
|
||||
}, 'Test falling back to distribute spacing if using a non-animatable ' +
|
||||
'shorthand property');
|
||||
|
||||
test(function(t) {
|
||||
var anim = createDiv(t).animate(null,
|
||||
{ spacing: 'paced(animation-duration)' });
|
||||
assert_equals(anim.effect.spacing, 'distribute', 'spacing mode');
|
||||
}, 'Test falling back to distribute spacing if using a non-animatable ' +
|
||||
'property');
|
||||
|
||||
test(function(t) {
|
||||
var anim = createDiv(t).animate(null);
|
||||
assert_equals(anim.effect.spacing, 'distribute', 'spacing mode');
|
||||
}, 'Test default value of spacing');
|
||||
|
||||
test(function(t) {
|
||||
var anim = createDiv(t).animate(null, { spacing: 'distribute' });
|
||||
assert_equals(anim.effect.spacing, 'distribute', 'spacing mode');
|
||||
}, 'Test spacing value if setting distribute');
|
||||
|
||||
test(function(t) {
|
||||
var anim = createDiv(t).animate(null, { spacing: 'paced(margin-left)' });
|
||||
assert_equals(anim.effect.spacing, 'paced(margin-left)', 'spacing mode');
|
||||
}, 'Test spacing value if setting paced');
|
||||
|
||||
</script>
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue