mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 13:55:43 +00:00
Bug 1412765 - Move and rewrite playState.html test; r=hiro
Currently we have a test in interfaces/Animation/playState.html that somewhat randomly tests the result of the `playState` member. However, there's no complex logic associated with the `playState` member in the IDL. It simply returns "The play state of this animation". The logic we need to test is in the definition of 'play state' which is in the timing model. As a result we move this test to timing-model/animations/play-states.html However, this test as it stands does not test the calculation of the play state in a particularly thorough manner. For example, it does not contain a single test for the 'finished' state. Given that this patch series will change the definition of the 'play state' we first fix this test to cover each of the different cases in the definition of the 'play state' prior to these changes. That is, we update the tests based on the definition of 'play state' here: https://www.w3.org/TR/2016/WD-web-animations-1-20160913/#play-states (Note that at this point in the patch series the pref to turn on the changed definition behavior has not been enabled even for tests so this patch is actually testing the behavior when that pref is false. We'll replace much of this test in the next patch but by updating the test first, we should be able to more clearly see the changes in the next patch.) MozReview-Commit-ID: 1xkOmuY1SxD --HG-- rename : testing/web-platform/tests/web-animations/interfaces/Animation/playState.html => testing/web-platform/tests/web-animations/timing-model/animations/play-states.html extra : rebase_source : 1890e1b4db007452df393e8a9e4b3ccf42bca237
This commit is contained in:
parent
e83e1a5e71
commit
ea536c1426
@ -347677,12 +347677,6 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"web-animations/interfaces/Animation/playState.html": [
|
||||
[
|
||||
"/web-animations/interfaces/Animation/playState.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"web-animations/interfaces/Animation/playbackRate.html": [
|
||||
[
|
||||
"/web-animations/interfaces/Animation/playbackRate.html",
|
||||
@ -347905,6 +347899,12 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"web-animations/timing-model/animations/play-states.html": [
|
||||
[
|
||||
"/web-animations/timing-model/animations/play-states.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"web-animations/timing-model/animations/playing-an-animation.html": [
|
||||
[
|
||||
"/web-animations/timing-model/animations/playing-an-animation.html",
|
||||
@ -575224,10 +575224,6 @@
|
||||
"b375f449a4c75b02d0d746e44e2ca6ff9646819b",
|
||||
"testharness"
|
||||
],
|
||||
"web-animations/interfaces/Animation/playState.html": [
|
||||
"69da0c5be9b5734fc45ccf0d5c855dbae8b71a8a",
|
||||
"testharness"
|
||||
],
|
||||
"web-animations/interfaces/Animation/playbackRate.html": [
|
||||
"a5463d070f7273e54099bc94d8a7b31b5366665d",
|
||||
"testharness"
|
||||
@ -575400,6 +575396,10 @@
|
||||
"9106dcffe7b9816cd9bda222714520f640b0afdc",
|
||||
"testharness"
|
||||
],
|
||||
"web-animations/timing-model/animations/play-states.html": [
|
||||
"9af38df5f4ef654514285b8a5af1b570b2123aef",
|
||||
"testharness"
|
||||
],
|
||||
"web-animations/timing-model/animations/playing-an-animation.html": [
|
||||
"700443f8c4a5573f0fa01932e3a6c143ccc7620f",
|
||||
"testharness"
|
||||
|
@ -1,53 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Animation.playState</title>
|
||||
<link rel="help" href="https://w3c.github.io/web-animations/#dom-animation-playstate">
|
||||
<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';
|
||||
|
||||
promise_test(t => {
|
||||
const div = createDiv(t);
|
||||
const animation = div.animate({}, 100 * MS_PER_SEC);
|
||||
|
||||
assert_equals(animation.playState, 'pending');
|
||||
return animation.ready.then(() => {
|
||||
assert_equals(animation.playState, 'running');
|
||||
});
|
||||
}, 'Animation.playState reports \'pending\'->\'running\' when initially ' +
|
||||
'played');
|
||||
|
||||
promise_test(t => {
|
||||
const div = createDiv(t);
|
||||
const animation = div.animate({}, 100 * MS_PER_SEC);
|
||||
animation.pause();
|
||||
|
||||
assert_equals(animation.playState, 'pending');
|
||||
return animation.ready.then(() => {
|
||||
assert_equals(animation.playState, 'paused');
|
||||
});
|
||||
}, 'Animation.playState reports \'pending\'->\'paused\' when pausing');
|
||||
|
||||
test(t => {
|
||||
const div = createDiv(t);
|
||||
const animation = div.animate({}, 100 * MS_PER_SEC);
|
||||
animation.cancel();
|
||||
assert_equals(animation.playState, 'idle');
|
||||
}, 'Animation.playState is \'idle\' when canceled.');
|
||||
|
||||
test(t => {
|
||||
const div = createDiv(t);
|
||||
const animation = div.animate({}, 100 * MS_PER_SEC);
|
||||
animation.cancel();
|
||||
animation.currentTime = 50 * MS_PER_SEC;
|
||||
assert_equals(animation.playState, 'paused',
|
||||
'After seeking an idle animation, it is effectively paused');
|
||||
}, 'Animation.playState is \'paused\' after cancelling an animation, ' +
|
||||
'seeking it makes it paused');
|
||||
|
||||
</script>
|
||||
</body>
|
@ -0,0 +1,152 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Play states</title>
|
||||
<link rel="help" href="https://w3c.github.io/web-animations/#play-state">
|
||||
<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(t => {
|
||||
const div = createDiv(t);
|
||||
|
||||
const animation = div.animate({}, 100 * MS_PER_SEC);
|
||||
|
||||
assert_equals(animation.playState, 'pending');
|
||||
}, 'reports \'pending\' for an animation with a pending play task');
|
||||
|
||||
test(t => {
|
||||
const div = createDiv(t);
|
||||
const animation = div.animate({}, 100 * MS_PER_SEC);
|
||||
|
||||
animation.pause();
|
||||
|
||||
assert_equals(animation.playState, 'pending');
|
||||
}, 'reports \'pending\' for an animation with a pending pause task');
|
||||
|
||||
test(t => {
|
||||
const animation = new Animation(
|
||||
new KeyframeEffect(null, {}, 100 * MS_PER_SEC)
|
||||
);
|
||||
assert_equals(animation.currentTime, null,
|
||||
'Current time should be initially unresolved');
|
||||
|
||||
assert_equals(animation.playState, 'idle');
|
||||
}, 'reports \'idle\' for an animation with an unresolved current time')
|
||||
|
||||
test(t => {
|
||||
const animation = new Animation(
|
||||
new KeyframeEffect(null, {}, 100 * MS_PER_SEC)
|
||||
);
|
||||
|
||||
animation.currentTime = 0;
|
||||
assert_equals(animation.startTime, null,
|
||||
'Start time should still be unresolved after setting current'
|
||||
+ ' time');
|
||||
|
||||
assert_equals(animation.playState, 'paused');
|
||||
}, 'reports \'paused\' for an animation with a resolved current time and'
|
||||
+ ' unresolved start time')
|
||||
|
||||
test(t => {
|
||||
const animation = new Animation(
|
||||
new KeyframeEffect(null, {}, 100 * MS_PER_SEC)
|
||||
);
|
||||
|
||||
animation.startTime = document.timeline.currentTime;
|
||||
assert_not_equals(animation.currentTime, null,
|
||||
'Current time should be resolved after setting start time');
|
||||
|
||||
assert_equals(animation.playState, 'running');
|
||||
}, 'reports \'running\' for an animation with a resolved start time and'
|
||||
+ ' current time');
|
||||
|
||||
test(t => {
|
||||
const animation = new Animation(
|
||||
new KeyframeEffect(null, {}, 100 * MS_PER_SEC)
|
||||
);
|
||||
animation.startTime = document.timeline.currentTime;
|
||||
|
||||
animation.currentTime = 100 * MS_PER_SEC;
|
||||
|
||||
assert_equals(animation.playState, 'finished');
|
||||
}, 'reports \'finished\' when playback rate > 0 and'
|
||||
+ ' current time = target effect end');
|
||||
|
||||
test(t => {
|
||||
const animation = new Animation(
|
||||
new KeyframeEffect(null, {}, 100 * MS_PER_SEC)
|
||||
);
|
||||
animation.startTime = document.timeline.currentTime;
|
||||
|
||||
animation.playbackRate = 0;
|
||||
animation.currentTime = 100 * MS_PER_SEC;
|
||||
|
||||
assert_equals(animation.playState, 'running');
|
||||
}, 'reports \'running\' when playback rate = 0 and'
|
||||
+ ' current time = target effect end');
|
||||
|
||||
test(t => {
|
||||
const animation = new Animation(
|
||||
new KeyframeEffect(null, {}, 100 * MS_PER_SEC)
|
||||
);
|
||||
animation.startTime = document.timeline.currentTime;
|
||||
|
||||
animation.playbackRate = -1;
|
||||
animation.currentTime = 100 * MS_PER_SEC;
|
||||
|
||||
assert_equals(animation.playState, 'running');
|
||||
}, 'reports \'running\' when playback rate < 0 and'
|
||||
+ ' current time = target effect end');
|
||||
|
||||
test(t => {
|
||||
const animation = new Animation(
|
||||
new KeyframeEffect(null, {}, 100 * MS_PER_SEC)
|
||||
);
|
||||
animation.startTime = document.timeline.currentTime;
|
||||
|
||||
animation.currentTime = 0;
|
||||
|
||||
assert_equals(animation.playState, 'running');
|
||||
}, 'reports \'running\' when playback rate > 0 and'
|
||||
+ ' current time = 0');
|
||||
|
||||
test(t => {
|
||||
const animation = new Animation(
|
||||
new KeyframeEffect(null, {}, 100 * MS_PER_SEC)
|
||||
);
|
||||
animation.startTime = document.timeline.currentTime;
|
||||
|
||||
animation.playbackRate = 0;
|
||||
animation.currentTime = 0;
|
||||
|
||||
assert_equals(animation.playState, 'running');
|
||||
}, 'reports \'running\' when playback rate = 0 and'
|
||||
+ ' current time = 0');
|
||||
|
||||
test(t => {
|
||||
const animation = new Animation(
|
||||
new KeyframeEffect(null, {}, 100 * MS_PER_SEC)
|
||||
);
|
||||
animation.startTime = document.timeline.currentTime;
|
||||
|
||||
animation.playbackRate = -1;
|
||||
animation.currentTime = 0;
|
||||
|
||||
assert_equals(animation.playState, 'finished');
|
||||
}, 'reports \'finished\' when playback rate < 0 and'
|
||||
+ ' current time = 0');
|
||||
|
||||
test(t => {
|
||||
const div = createDiv(t);
|
||||
const animation = div.animate({}, 0);
|
||||
|
||||
assert_equals(animation.playState, 'pending');
|
||||
}, 'reports \'pending\' when there is a pending play task even though the'
|
||||
+ ' animation will be finished when the pending task completes');
|
||||
|
||||
</script>
|
||||
</body>
|
Loading…
Reference in New Issue
Block a user