wpt / css / css-image-animation / image-animation-paused-exact-frame.html

Status: FAIL | Duration: 9ms | Subtests: 0/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/css-image-animation/image-animation-paused-exact-frame.html

<!DOCTYPE html>
<html class="reftest-wait">
<title>image-animation: paused freezes at the current frame when transitioning from running</title>
<link rel="help" href="https://drafts.csswg.org/css-image-animation-1/">
<meta charset="utf-8" />
<link rel="match" href="image-animation-paused-exact-frame-ref.html" />
<script src="/common/reftest-wait.js"></script>
<script src="resources/image-animation-utils.js"></script>
<script>
  function loaded() {
    document.getElementById('img1').style.imageAnimation = 'running';
    // The GIF has 3 frames:
    //   Frame 1: red,   20ms  (passes quickly)
    //   Frame 2: green, 200ms (we pause during this frame)
    //   Frame 3: blue
    //
    // Wait 100ms so we are well past frame 1 (20ms) but still within
    // frame 2 (200ms), then pause. The paused image should show frame 2
    // (green), proving that pausing freezes at the current frame.
    waitForFrameTime(100).then(() => {
      document.getElementById('img1').style.imageAnimation = 'paused';
        requestAnimationFrame(()=>{
          takeScreenshot();
        })
    });
  }
</script>

<style>
  img {
    image-animation: paused;
  }
</style>

<img id="img1" src="../../images/anim-rgb.gif" onload="loaded()" />

</html>

/css/css-image-animation/image-animation-paused-exact-frame-ref.html

<!DOCTYPE html>
<img src="../../images/green.png">