mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-27 20:25:44 +00:00
Bug 1527640 [wpt PR 15364] - [Animation Worklet] Upstream web tests (related to animator) to WPT, a=testonly
Automatic update from web-platform-tests [Animation Worklet] Upstream web tests (related to animator) to WPT Test for animator-registration was purposefully left out of this group because it will be a more involved change web_tests/animations/animationworklet/animator-animate.html -> web_tests/external/wpt/animation-worklet/animator-animate.https.html web_tests/animations/animationworklet/animator-with-options.html -> web_tests/external/wpt/animation-worklet/animator-with-options.https.html Bug: 915352 Change-Id: I3ccab26ec2134a2d02df9fc9ae4e42dd997264ea Reviewed-on: https://chromium-review.googlesource.com/c/1468008 Commit-Queue: Jordan Taylor <jortaylo@microsoft.com> Reviewed-by: Yi Gu <yigu@chromium.org> Cr-Commit-Position: refs/heads/master@{#631489} -- wpt-commits: 0e4b1315e61ec051dafad75c73f6258f718d56c6 wpt-pr: 15364
This commit is contained in:
parent
9d76aed5b0
commit
5e91e37353
@ -0,0 +1,22 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<title>Basic use of Worklet Animation</title>
|
||||||
|
<link rel="help" href="https://drafts.css-houdini.org/css-animationworklet/">
|
||||||
|
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<script src="/web-animations/testcommon.js"></script>
|
||||||
|
<script src="common.js"></script>
|
||||||
|
|
||||||
|
<div id="target"></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
promise_test(async t => {
|
||||||
|
await registerConstantLocalTimeAnimator(500);
|
||||||
|
const effect = new KeyframeEffect(target, [{ opacity: 0 }], { duration: 1000 });
|
||||||
|
const animation = new WorkletAnimation('constant_time', effect);
|
||||||
|
animation.play();
|
||||||
|
|
||||||
|
await waitForAsyncAnimationFrames(1);
|
||||||
|
assert_equals(getComputedStyle(target).opacity, "0.5");
|
||||||
|
}, "Simple worklet animation should output values at specified local time");
|
||||||
|
</script>
|
@ -0,0 +1,35 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<title>Worklet Animation with options</title>
|
||||||
|
<link rel="help" href="https://drafts.css-houdini.org/css-animationworklet/">
|
||||||
|
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<script src="/web-animations/testcommon.js"></script>
|
||||||
|
<script src="common.js"></script>
|
||||||
|
|
||||||
|
<div id="target"></div>
|
||||||
|
|
||||||
|
<script id="animate_with_options" type="text/worklet">
|
||||||
|
registerAnimator("test_animator", class {
|
||||||
|
constructor(options) {
|
||||||
|
this.time_ = options.time;
|
||||||
|
}
|
||||||
|
animate(currentTime, effect) {
|
||||||
|
effect.localTime = this.time_;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
promise_test(async t => {
|
||||||
|
await runInAnimationWorklet(document.getElementById('animate_with_options').textContent);
|
||||||
|
const target = document.getElementById('target');
|
||||||
|
const effect = new KeyframeEffect(target, [{ opacity: 0 }], { duration: 1000 });
|
||||||
|
const options = {'time': 500};
|
||||||
|
const animation = new WorkletAnimation('test_animator', effect, document.timeline, options);
|
||||||
|
animation.play();
|
||||||
|
|
||||||
|
await waitForAsyncAnimationFrames(1);
|
||||||
|
assert_equals(getComputedStyle(target).opacity, "0.5");
|
||||||
|
}, "Animator should be able to use options to update the animation");
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user