Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / animations / script-tests / svgangle-animation-rad-to-grad.js
blob9669a9da608f638d854bf062490516a54acd9d5e
1 description("Tests SVGAngle animation from rad to grad.");
2 createSVGTestCase();
4 // Setup test document
5 var defs = createSVGElement("defs");
7 var marker = createSVGElement("marker");
8 marker.setAttribute("id", "marker");
9 marker.setAttribute("viewBox", "0 0 10 10");
10 marker.setAttribute("markerWidth", "4");
11 marker.setAttribute("markerHeight", "3");
12 marker.setAttribute("markerUnits", "strokeWidth");
13 marker.setAttribute("refX", "1");
14 marker.setAttribute("refY", "5");
15 marker.setAttribute("orient", "0deg");
16 defs.appendChild(marker);
18 var polyline = createSVGElement("polyline");
19 polyline.setAttribute("id", "polyline");
20 polyline.setAttribute("points", "0,0 10,5 0,10 1,5");
21 polyline.setAttribute("fill", "green");
22 marker.appendChild(polyline);
24 var path = createSVGElement("path");
25 path.setAttribute("id", "path");
26 path.setAttribute("d", "M45,50 L55,50");
27 path.setAttribute("stroke-width","10");
28 path.setAttribute("stroke", "green");
29 path.setAttribute("marker-end", "url(#marker)");
30 path.setAttribute("onclick", "executeTest()");
32 var animate = createSVGElement("animate");
33 animate.setAttribute("id", "animation");
34 animate.setAttribute("attributeName", "orient");
35 animate.setAttribute("begin", "path.click");
36 animate.setAttribute("dur", "4s");
37 animate.setAttribute("from", "0rad");
38 animate.setAttribute("to", "200grad");
39 marker.appendChild(animate);
40 rootSVGElement.appendChild(defs);
41 rootSVGElement.appendChild(path);
43 // Setup animation test
44 function sample1() {
45 // Check initial/end conditions
46 shouldBeCloseEnough("marker.orientAngle.animVal.value", "0");
47 shouldBe("marker.orientAngle.baseVal.value", "0");
49 shouldBe("marker.orientType.animVal", "SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE");
50 shouldBe("marker.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE");
53 function sample2() {
54 shouldBeCloseEnough("marker.orientAngle.animVal.value", "90");
55 shouldBe("marker.orientAngle.baseVal.value", "0");
57 shouldBe("marker.orientType.animVal", "SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE");
58 shouldBe("marker.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE");
61 function sample3() {
62 shouldBeCloseEnough("marker.orientAngle.animVal.value", "180");
63 shouldBe("marker.orientAngle.baseVal.value", "0");
65 shouldBe("marker.orientType.animVal", "SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE");
66 shouldBe("marker.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE");
69 function executeTest() {
70 const expectedValues = [
71 // [animationId, time, sampleCallback]
72 ["animation", 0.0, sample1],
73 ["animation", 2.0, sample2],
74 ["animation", 3.999, sample3],
75 ["animation", 4.001, sample1]
78 runAnimationTest(expectedValues);
81 var successfullyParsed = true;