Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / animations / script-tests / animate-endElement-beginElement.js
blobc1de19c274187520b9ab096a8ae31a102224b289
1 description("Tests animation beginElement command's restarting capability after endElement.");
2 createSVGTestCase();
4 // Setup test document
6 var rect = createSVGElement("rect");
7 rect.setAttribute("id", "rect");
8 rect.setAttribute("width", "50px");
9 rect.setAttribute("height", "50px");
10 rect.setAttribute("fill", "green");
11 rect.setAttribute("onclick", "executeTest()");
13 var animateX = createSVGElement("animate");
14 animateX.setAttribute("id", "animateX");
15 animateX.setAttribute("attributeName", "x");
16 animateX.setAttribute("from", "0");
17 animateX.setAttribute("to", "100");
18 animateX.setAttribute("dur", "2s");
19 animateX.setAttribute("begin", "indefinite");
20 animateX.setAttribute("fill", "freeze");
21 rect.appendChild(animateX);
22 rootSVGElement.appendChild(rect);
24 // Setup animation test
26 function sample1() {
27 // Check half-time conditions
28 shouldBeCloseEnough("rect.x.animVal.value", "50");
29 shouldBe("rect.x.baseVal.value", "0");
32 function executeTest() {
33 // Start animating, and stop it again after 100ms.
34 animateX.beginElement();
35 // Allow time to pass. (The test framework pauses the timeline on load.)
36 rootSVGElement.unpauseAnimations();
37 setTimeout(end, 100);
40 function end() {
41 // Stop animating, and restart it in 100ms.
42 animateX.endElement();
43 setTimeout(begin, 100);
46 function begin() {
47 // Once the animation is running again, sample it.
48 animateX.beginElement();
50 setTimeout(function() {
51 const expectedValues = [
52 // [animationId, time, sampleCallback]
53 ["animateX", 1.0, sample1]
55 runAnimationTest(expectedValues);
56 }, 100);
59 window.clickX = 40;
60 window.clickY = 40;
61 var successfullyParsed = true;