Index: third_party/WebKit/LayoutTests/animations/animation-direction-alternate-reverse.html |
diff --git a/third_party/WebKit/LayoutTests/animations/animation-direction-alternate-reverse.html b/third_party/WebKit/LayoutTests/animations/animation-direction-alternate-reverse.html |
index 480b5e6ac77f1bcbea1d033db1b8edf08321edaa..7bb7f90cb32ac685c4666b763b2cdeab979e7093 100644 |
--- a/third_party/WebKit/LayoutTests/animations/animation-direction-alternate-reverse.html |
+++ b/third_party/WebKit/LayoutTests/animations/animation-direction-alternate-reverse.html |
@@ -1,62 +1,56 @@ |
<!DOCTYPE html> |
+<title>Test of animation-direction</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<style> |
+ #target { |
+ animation-direction: alternate-reverse; |
+ animation-duration: 2s; |
+ animation-iteration-count: 2; |
+ animation-name: move; |
+ animation-play-state: paused; |
+ animation-timing-function: linear; |
+ animation-fill-mode: both; |
+ |
-<html> |
-<head> |
- <style type="text/css" media="screen"> |
- |
- #container { |
- position: relative; |
- border: 1px solid black; |
+ background-color: red; |
height: 100px; |
- width: 500px; |
- } |
- |
- #box { |
+ left: 500px; |
position: absolute; |
- height: 100px; |
width: 100px; |
- background-color: blue; |
- animation-name: move; |
- animation-duration: 2s; |
- animation-direction: alternate-reverse; |
- animation-iteration-count: 2; |
- animation-timing-function: linear; |
- animation-fill-mode: forwards; |
} |
- |
@keyframes move { |
- 0% { |
- left: 0; |
- } |
- 100% { |
- left: 400px; |
- } |
+ from { left: 0px; } |
+ to { left: 400px; } |
} |
- |
- </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] |
- [1.0, "box", "left", 200, 20], |
- [2.0, "box", "left", 0, 20], |
- |
- [3.0, "box", "left", 200, 20], |
- [4.0, "box", "left", 400, 20], |
- ]; |
- |
- runAnimationTest(expectedValues); |
- </script> |
-</head> |
-<body> |
- |
-<!-- Test animation-direction: alternate-reverse --> |
-<div id="container"> |
- <div id="box"></div> |
-</div> |
- |
-<div id="result"></div> |
- |
-</body> |
-</html> |
+ |
+</style> |
+<div id="target"></div> |
+<script> |
+ 'use strict'; |
+ test(function() { |
+ target.style.animationDelay = '1s'; |
+ assert_equals(getComputedStyle(target).left, '400px'); |
+ |
+ target.style.animationDelay = '-0.5s'; |
+ assert_equals(getComputedStyle(target).left, '300px'); |
+ |
+ target.style.animationDelay = '-1s'; |
+ assert_equals(getComputedStyle(target).left, '200px'); |
+ |
+ target.style.animationDelay = '-2s'; |
+ assert_equals(getComputedStyle(target).left, '0px'); |
+ |
+ target.style.animationDelay = '-2.5s'; |
+ assert_equals(getComputedStyle(target).left, '100px'); |
+ |
+ target.style.animationDelay = '-3s'; |
+ assert_equals(getComputedStyle(target).left, '200px'); |
+ |
+ target.style.animationDelay = '-4s'; |
+ assert_equals(getComputedStyle(target).left, '400px'); |
+ |
+ target.style.animationDelay = '-5s'; |
+ assert_equals(getComputedStyle(target).left, '400px'); |
+ }, "animation-direction alternate-reverse plays backwards, then forwards"); |
+</script> |