blob: cc29b40c2189f9ad45110638d1e7f9a362147d10 [file] [log] [blame]
cmarrin@apple.com9843c7d2010-08-11 01:03:58 +00001<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html lang="en">
3<head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5 <title>Test suspendAnimations()/resumeAnimations() for animations</title>
6 <style type="text/css" media="screen">
7 #box {
8 height: 100px;
9 width: 100px;
10 background-color: blue;
11 -webkit-animation-duration: 1.25s;
12 -webkit-animation-timing-function: linear;
13 -webkit-animation-name: "move";
14 }
15 @-webkit-keyframes "move" {
16 from { -webkit-transform: translateX(0); }
17 to { -webkit-transform: translateX(500px); }
18 }
19 </style>
simon.fraser@apple.com93531132011-04-26 03:16:31 +000020 <script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
cmarrin@apple.com9843c7d2010-08-11 01:03:58 +000021 <script type="text/javascript" charset="utf-8">
22
23 const expectedValues = [
24 // [animation-name, time, element-id, property, expected-value, tolerance]
25 ["rotate", 0.6, "box", "webkitTransform", [1,0,0,1, 200, 0], 30],
26 ["rotate", 0.9, "box", "webkitTransform", [1,0,0,1, 200, 0], 30],
27 ["rotate", 1.5, "box", "webkitTransform", [1,0,0,1, 400, 0], 30],
28 ];
29
30 function suspend()
31 {
gyuyoung.kim@samsung.comfb87fb42012-05-10 06:11:21 +000032 if (window.internals)
commit-queue@webkit.org3e466982013-10-28 16:15:45 +000033 internals.suspendAnimations();
cmarrin@apple.com9843c7d2010-08-11 01:03:58 +000034 }
35
36 function resume()
37 {
gyuyoung.kim@samsung.com05ecb882012-05-11 05:31:35 +000038 if (window.internals)
commit-queue@webkit.org3e466982013-10-28 16:15:45 +000039 internals.resumeAnimations();
cmarrin@apple.com9843c7d2010-08-11 01:03:58 +000040 }
41
42 function setTimers()
43 {
44 setTimeout(suspend, 500);
45 setTimeout(resume, 1000);
46 }
47
48 runAnimationTest(expectedValues, setTimers, undefined, true);
49
50 </script>
51</head>
52<body>
53<p>
54This test shows suspend and resume of a box moving to the right 500px. If running inside DumpRenderTest the box should stop at 200px
55after 500ms and then continue to complete the move in another 750ms
56<div id="box">
57</div>
58<div id="result">
59</div>
60</body>
61</html>