Commit cc8c7225 authored by ericwilligers's avatar ericwilligers Committed by Commit bot

CSS Animations layout tests: fix flaky animation-direction-normal.html

We pause the animation, and progress using animationDelay.

animation-direction-normal.html now uses testharness.js

BUG=674123

Review-Url: https://codereview.chromium.org/2580703002
Cr-Commit-Position: refs/heads/master@{#438764}
parent c8b2173b
...@@ -2214,5 +2214,4 @@ crbug.com/673539 [ Linux ] css3/filters/effect-contrast-hw.html [ Pass Failure ] ...@@ -2214,5 +2214,4 @@ crbug.com/673539 [ Linux ] css3/filters/effect-contrast-hw.html [ Pass Failure ]
# Added 2016-12-14 # Added 2016-12-14
crbug.com/674048 [ Linux ] virtual/mojo-loading/http/tests/navigation/image-load-in-unload-handler.html [ Pass Timeout ] crbug.com/674048 [ Linux ] virtual/mojo-loading/http/tests/navigation/image-load-in-unload-handler.html [ Pass Timeout ]
crbug.com/674123 virtual/threaded/animations/animation-direction-normal.html [ Failure Timeout ]
crbug.com/674396 [ Win ] compositing/reflections/nested-reflection-transition.html [ Pass Failure ] crbug.com/674396 [ Win ] compositing/reflections/nested-reflection-transition.html [ Pass Failure ]
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test of animation-direction</title>
<style type="text/css" media="screen">
body {
margin: 0;
}
#box {
position: absolute;
left: 0px;
top: 100px;
height: 100px;
width: 100px;
background-color: red;
margin: 0;
transform: translateX(50px);
}
#safezone {
position: absolute;
top: 100px;
height: 100px;
width: 130px;
left: 30px;
background-color: green;
}
</style>
</script>
</head>
<body>
<!-- This tests the operation of animation-direction. After 1 second the red boxes should be hidden by the green boxes. You should see no red boxes. -->
<div id="box"></div>
<div id="safezone"></div>
<div id="result">
Warning this test is running in real-time and may be flaky.<br>
PASS - "transform" property for "box" element at 0.5s saw something close to: 1,0,0,1,50,0<br>
PASS - "transform" property for "box" element at 1s saw something close to: 1,0,0,1,100,0<br>
PASS - "transform" property for "box" element at 2.5s saw something close to: 1,0,0,1,50,0
</div>
</div>
</body>
</html>
<html lang="en"> <!DOCTYPE html>
<head> <title>Test of animation-direction</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="../resources/testharness.js"></script>
<title>Test of animation-direction</title> <script src="../resources/testharnessreport.js"></script>
<style type="text/css" media="screen"> <style>
body { #target {
margin: 0;
}
#box {
position: absolute;
left: 0px;
top: 100px;
height: 100px;
width: 100px;
background-color: red;
margin: 0;
animation-duration: 2s;
animation-direction: normal; animation-direction: normal;
animation-duration: 2s;
animation-iteration-count: 2; animation-iteration-count: 2;
animation-timing-function: linear;
animation-name: move1; animation-name: move1;
} animation-play-state: paused;
#safezone { animation-timing-function: linear;
background-color: red;
height: 100px;
left: 0px;
margin: 0;
position: absolute; position: absolute;
top: 100px; top: 100px;
height: 100px; width: 100px;
width: 130px;
left: 30px;
background-color: green;
} }
@keyframes move1 { @keyframes move1 {
from { transform: translateX(0px); } from { left: 0px; }
to { transform: translateX(200px); } to { left: 200px; }
} }
</style>
<script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
const expectedValues = [
// [time, element-id, property, expected-value, tolerance]
[0.5, "box", "transform", [1,0,0,1, 50,0], 20],
[1.0, "box", "transform", [1,0,0,1,100,0], 20],
[2.5, "box", "transform", [1,0,0,1, 50,0], 20],
];
function pauseAnimation() </style>
{ <div id="target"></div>
document.getElementById("box").style.animationPlayState = "paused"; <script>
} test(function() {
target.style.animationDelay = '-0.5s';
function setTimers() assert_equals(getComputedStyle(target).left, '50px');
{
setTimeout(pauseAnimation, 2500);
}
runAnimationTest(expectedValues, setTimers, null, true, true); target.style.animationDelay = '-1s';
assert_equals(getComputedStyle(target).left, '100px');
</script> target.style.animationDelay = '-2.5s';
</head> assert_equals(getComputedStyle(target).left, '50px');
<body> }, "animation-direction normal plays forwards");
<!-- This tests the operation of animation-direction. After 1 second the red boxes should be hidden by the green boxes. You should see no red boxes. --> </script>
<div id="box"></div>
<div id="safezone"></div>
<div id="result"></div>
</div>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment