browser_animation_current-time-scrubber_each-different-creation-time-animations.js (1247B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test whether proper currentTime was set for each animations. 7 8 const WAIT_TIME = 3000; 9 10 add_task(async function () { 11 await addTab(URL_ROOT + "doc_simple_animation.html"); 12 await removeAnimatedElementsExcept([".animated", ".still"]); 13 const { animationInspector, panel } = await openAnimationInspector(); 14 15 info( 16 "Add an animation to make a situation which has different creation time" 17 ); 18 await wait(WAIT_TIME); 19 await setClassAttribute(animationInspector, ".still", "ball compositor-all"); 20 await waitUntil(() => panel.querySelectorAll(".animation-item").length === 2); 21 22 info("Move the scrubber"); 23 clickOnCurrentTimeScrubberController(animationInspector, panel, 0.5); 24 await waitUntilAnimationsPlayState(animationInspector, "paused"); 25 26 info("Check existed animations have different currentTime"); 27 const animations = animationInspector.state.animations; 28 Assert.greater( 29 animations[0].state.currentTime + WAIT_TIME, 30 animations[1].state.currentTime, 31 `The currentTime of added animation shold be ${WAIT_TIME}ms less than ` + 32 "at least that currentTime of first animation" 33 ); 34 });