blob: ad61ad5439c651862aa238ee4d13abaa938fb13d [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Verify that animations properly start</title>
<style>
#container {
position: absolute;
left: 0;
top: 3em;
}
#squareLinear, #squareSteps, #squareNonAccelerated {
width: 100px;
height: 100px;
background: lightblue;
position: absolute;
}
/* Avoid animation-fill-mode, to make sure that the move is done by the animation code. */
#squareSteps {
top: 150px;
animation: moveByTransform 10s steps(1000);
}
#squareNonAccelerated {
top: 300px;
animation: moveByLeft 200ms steps(10) forwards;
}
@keyframes moveByTransform
{
100% {
transform: translate(5000px);
}
}
@keyframes moveByLeft
{
0% {
left: 0px;
}
100% {
left: 90px;
}
}
#coveringRect {
background: blue;
position: absolute;
top: -10px;
left: 90px;
width: 5000px;
height: 500px;
}
</style>
<script>
window.addEventListener("DOMContentLoaded", () => {
if (!window.testRunner)
return;
// We wait a bit after the squares are moved behind the blue rectangle. For discontinuous
// transforms we have 5000px / 100 steps = 5px/step. Hence this happens after 20 steps i.e.
// 20/100*10s = 200ms.
testRunner.waitUntilDone();
document.getElementById("squareNonAccelerated").addEventListener("animationend", () => testRunner.notifyDone());
});
</script>
</head>
<body>
<p>This test passes if green squares are moved behind the blue rectangle.</p>
<div id="container">
<div id="squareSteps"><tt>transform</tt> (steps)</div>
<div id="squareNonAccelerated"><tt>left</tt> (steps)</div>
<div id="coveringRect"></div>
</div>
</body>
</html>