Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / animations / script-tests / animate-end-attribute-numeric-precision.js
blob00a49a86da92e0667b606b4e7199d6690d6db095
1 description("Tests end conditions are respected properly near the limits of float numeric precision");
2 createSVGTestCase();
4 // Setup test document
5 var rect = createSVGElement("rect");
6 rect.setAttribute("id", "rect");
7 rect.setAttribute("x", "100");
8 rect.setAttribute("width", "100");
9 rect.setAttribute("height", "100");
10 rect.setAttribute("fill", "green");
12 var animate = createSVGElement("animate");
13 animate.setAttribute("id", "animation");
14 animate.setAttribute("attributeName", "x");
15 animate.setAttribute("values", "0;300");
16 animate.setAttribute("begin", "0.333333333333333s");
17 animate.setAttribute("dur", "0.4256483205159505s");
18 animate.setAttribute("fill", "freeze");
19 rect.appendChild(animate);
20 rootSVGElement.appendChild(rect);
22 // Setup animation test
23 function sample1() {
24 shouldBeCloseEnough("rect.x.animVal.value", "100");
25 shouldBe("rect.x.baseVal.value", "100");
28 function sample2() {
29 shouldBeCloseEnough("rect.x.animVal.value", "300");
30 shouldBe("rect.x.baseVal.value", "100");
33 function executeTest() {
34 const expectedValues = [
35 // [animationId, time, sampleCallback]
36 ["animation", 0.0, sample1],
37 ["animation", 1.0, sample2]
40 runAnimationTest(expectedValues);
43 var successfullyParsed = true;
44 executeTest();