Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / animations / script-tests / svglength-animation-px-to-cm.js
blob74751fc50dc34c1aa9e492d60ceaba39c1feb949
1 description("Test SVGLength animation from px to cm.");
2 createSVGTestCase();
4 // Setup test document
5 var rect = createSVGElement("rect");
6 rect.setAttribute("id", "rect");
7 rect.setAttribute("x", "0");
8 rect.setAttribute("width", "100");
9 rect.setAttribute("height", "100");
10 rect.setAttribute("fill", "green");
11 rect.setAttribute("onclick", "executeTest()");
13 var animate = createSVGElement("animate");
14 animate.setAttribute("id", "animation");
15 animate.setAttribute("attributeName", "width");
16 animate.setAttribute("begin", "click");
17 animate.setAttribute("dur", "4s");
18 animate.setAttribute("from", "100px");
19 animate.setAttribute("to", "5cm");
20 rect.appendChild(animate);
21 rootSVGElement.appendChild(rect);
23 // Setup animation test
24 function sample1() {
25 // Check initial/end conditions
26 shouldBeCloseEnough("rect.width.animVal.value", "100");
27 shouldBe("rect.width.baseVal.value", "100");
30 function sample2() {
31 shouldBeCloseEnough("rect.width.animVal.value", "144.5");
32 shouldBe("rect.width.baseVal.value", "100");
35 function sample3() {
36 shouldBeCloseEnough("rect.width.animVal.value", "189");
37 shouldBe("rect.width.baseVal.value", "100");
40 function executeTest() {
41 const expectedValues = [
42 // [animationId, time, sampleCallback]
43 ["animation", 0.0, sample1],
44 ["animation", 2.0, sample2],
45 ["animation", 3.999, sample3],
46 ["animation", 4.001, sample1]
49 runAnimationTest(expectedValues);
52 var successfullyParsed = true;