mirror of
https://github.com/servo/servo.git
synced 2025-08-09 07:25:35 +01:00
Update web-platform-tests to revision dc60bfc45b49e3a5e653320e65b0fd447676b836
This commit is contained in:
parent
652a177ff5
commit
0bc549be55
690 changed files with 6588 additions and 1564 deletions
|
@ -11,6 +11,17 @@
|
|||
<script>
|
||||
'use strict';
|
||||
|
||||
test(t => {
|
||||
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
|
||||
animation.cancel();
|
||||
|
||||
assert_equals(animation.startTime, null,
|
||||
'The start time of a canceled animation should be unresolved');
|
||||
assert_equals(animation.currentTime, null,
|
||||
'The hold time of a canceled animation should be unresolved');
|
||||
}, 'Canceling an animation should cause its start time and hold time to be'
|
||||
+ ' unresolved');
|
||||
|
||||
promise_test(t => {
|
||||
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
|
||||
const retPromise = animation.ready.then(() => {
|
||||
|
|
|
@ -11,6 +11,35 @@
|
|||
<script>
|
||||
'use strict';
|
||||
|
||||
promise_test(async t => {
|
||||
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
|
||||
await animation.ready;
|
||||
|
||||
const startTimeBeforePausing = animation.startTime;
|
||||
|
||||
animation.pause();
|
||||
assert_equals(animation.startTime, startTimeBeforePausing,
|
||||
'The start time does not change when pausing-pending');
|
||||
|
||||
await animation.ready;
|
||||
|
||||
assert_equals(animation.startTime, null,
|
||||
'The start time is unresolved when paused');
|
||||
}, 'Pausing clears the start time');
|
||||
|
||||
promise_test(async t => {
|
||||
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
|
||||
await animation.ready;
|
||||
|
||||
animation.pause();
|
||||
assert_not_equals(animation.startTime, null,
|
||||
'The start time is resolved when pause-pending');
|
||||
|
||||
animation.play();
|
||||
assert_not_equals(animation.startTime, null,
|
||||
'The start time is preserved when a pause is aborted');
|
||||
}, 'Aborting a pause preserves the start time');
|
||||
|
||||
promise_test(async t => {
|
||||
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
|
||||
const promise = animation.ready;
|
||||
|
@ -42,5 +71,23 @@ promise_test(async t => {
|
|||
}, 'A pause-pending animation maintains the current time when applying a'
|
||||
+ ' pending playback rate');
|
||||
|
||||
promise_test(async t => {
|
||||
// This test does not cover a specific step in the algorithm but serves as a
|
||||
// high-level sanity check that pausing does, in fact, freeze the current
|
||||
// time.
|
||||
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
|
||||
await animation.ready;
|
||||
|
||||
animation.pause();
|
||||
await animation.ready;
|
||||
|
||||
const currentTimeAfterPausing = animation.currentTime;
|
||||
|
||||
await waitForNextFrame();
|
||||
|
||||
assert_equals(animation.currentTime, currentTimeAfterPausing,
|
||||
'Animation.currentTime is unchanged after pausing');
|
||||
}, 'The animation\'s current time remains fixed after pausing');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -36,6 +36,32 @@ test(t => {
|
|||
assert_time_equals_literal(animation.currentTime, 100 * MS_PER_SEC);
|
||||
}, 'Playing a finished and reversed animation seeks to end');
|
||||
|
||||
promise_test(async t => {
|
||||
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
|
||||
animation.finish();
|
||||
|
||||
// Initiate a pause then abort it
|
||||
animation.pause();
|
||||
animation.play();
|
||||
|
||||
// Wait to return to running state
|
||||
await animation.ready;
|
||||
|
||||
assert_true(animation.currentTime < 100 * 1000,
|
||||
'After aborting a pause when finished, the current time should'
|
||||
+ ' jump back to the start of the animation');
|
||||
}, 'Playing a pause-pending but previously finished animation seeks back to'
|
||||
+ ' to the start');
|
||||
|
||||
promise_test(async t => {
|
||||
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
|
||||
animation.finish();
|
||||
await animation.ready;
|
||||
|
||||
animation.play();
|
||||
assert_equals(animation.startTime, null, 'start time is unresolved');
|
||||
}, 'Playing a finished animation clears the start time');
|
||||
|
||||
test(t => {
|
||||
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
|
||||
animation.cancel();
|
||||
|
@ -54,6 +80,28 @@ promise_test(async t => {
|
|||
}, 'A pending ready promise should be resolved and not replaced when the'
|
||||
+ ' animation enters the running state');
|
||||
|
||||
promise_test(async t => {
|
||||
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
|
||||
await animation.ready;
|
||||
|
||||
// Go to pause-pending state
|
||||
animation.pause();
|
||||
assert_true(animation.pending, 'Animation is pending');
|
||||
const pauseReadyPromise = animation.ready;
|
||||
|
||||
// Now play again immediately (abort the pause)
|
||||
animation.play();
|
||||
assert_true(animation.pending, 'Animation is still pending');
|
||||
assert_equals(animation.ready, pauseReadyPromise,
|
||||
'The pause Promise is re-used when playing while waiting'
|
||||
+ ' to pause');
|
||||
|
||||
// Sanity check: Animation proceeds to running state
|
||||
await animation.ready;
|
||||
assert_true(!animation.pending && animation.playState === 'running',
|
||||
'Animation is running after aborting a pause');
|
||||
}, 'If a pause operation is interrupted, the ready promise is reused');
|
||||
|
||||
promise_test(async t => {
|
||||
// Seek animation beyond target end
|
||||
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
|
||||
|
|
|
@ -213,6 +213,18 @@ promise_test(async t => {
|
|||
}, 'Reversing when when playbackRate == 0 should preserve the current ' +
|
||||
'time and playback rate');
|
||||
|
||||
test(t => {
|
||||
const div = createDiv(t);
|
||||
const animation =
|
||||
new Animation(new KeyframeEffect(div, null, 100 * MS_PER_SEC));
|
||||
assert_equals(animation.currentTime, null);
|
||||
|
||||
animation.reverse();
|
||||
|
||||
assert_equals(animation.currentTime, 100 * MS_PER_SEC,
|
||||
'animation.currentTime should be at its effect end');
|
||||
}, 'Reversing an idle animation from starts playing the animation');
|
||||
|
||||
test(t => {
|
||||
const div = createDiv(t);
|
||||
const animation =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue