Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Side by Side Diff: LayoutTests/svg/animations/script-tests/use-animate-width-and-height.js

Issue 252903004: Avoid using SVGElementInstance in calcViewport (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase one more time Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 description("Test animation of use element width/height");
2 createSVGTestCase();
3
4 // Setup test document
5 var symbol = createSVGElement("symbol");
6 symbol.setAttribute("id", "symbol");
7
8 var rect = createSVGElement("rect");
9 rect.setAttribute("id", "rect");
10 rect.setAttribute("x", "10");
11 rect.setAttribute("y", "10");
12 rect.setAttribute("width", "100%");
13 rect.setAttribute("height", "100%");
14 rect.setAttribute("fill", "green");
15 rect.setAttribute("onclick", "executeTest()");
16 symbol.appendChild(rect);
17 rootSVGElement.appendChild(symbol);
18
19 var use = createSVGElement("use");
20 use.setAttribute("id", "use");
21 use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', '#symbol');
22 use.setAttribute("x", "0");
23 use.setAttribute("y", "0");
24 use.setAttribute("width", "100");
25 use.setAttribute("height", "100");
26 rootSVGElement.appendChild(use);
27
28 var animate = createSVGElement("animate");
29 animate.setAttribute("id", "animate");
30 animate.setAttribute("attributeName", "width");
31 animate.setAttribute("attributeType", "XML");
32 animate.setAttribute("begin", "1s");
33 animate.setAttribute("dur", "10s");
34 animate.setAttribute("from", "100");
35 animate.setAttribute("to", "200");
36 use.appendChild(animate);
37
38 var animate2 = createSVGElement("animate");
39 animate2.setAttribute("id", "animate2");
40 animate2.setAttribute("attributeName", "height");
41 animate2.setAttribute("attributeType", "XML");
42 animate2.setAttribute("begin", "1s");
43 animate2.setAttribute("dur", "10s");
44 animate2.setAttribute("from", "100");
45 animate2.setAttribute("to", "200");
46 use.appendChild(animate2);
47
48 var shadowRoot = internals.shadowRoot(use);
49
50 // Setup animation test
51 function sample1() {
52 // Check initial/end conditions
53 shouldBe("use.width.animVal.value", "100");
54 shouldBe("use.width.baseVal.value", "100");
55 shouldBe("use.height.animVal.value", "100");
56 shouldBe("use.height.baseVal.value", "100");
57 shouldBe("use.getAttribute('width')", "'100'");
58 shouldBe("use.getAttribute('height')", "'100'");
59 shouldBe("shadowRoot.firstChild.width.animVal.value", "100");
60 shouldBe("shadowRoot.firstChild.height.animVal.value", "100");
61 }
62
63 function sample2() {
64 shouldBe("use.width.animVal.value", "105");
65 shouldBe("use.width.baseVal.value", "100");
66 shouldBe("use.height.animVal.value", "105");
67 shouldBe("use.height.baseVal.value", "100");
68 shouldBe("use.getAttribute('width')", "'105'");
69 shouldBe("use.getAttribute('height')", "'105'");
70 shouldBe("shadowRoot.firstChild.width.animVal.value", "105");
71 shouldBe("shadowRoot.firstChild.height.animVal.value", "105");
72 }
73
74 function sample3() {
75 shouldBe("use.width.animVal.value", "115");
76 shouldBe("use.width.baseVal.value", "100");
77 shouldBe("use.height.animVal.value", "115");
78 shouldBe("use.height.baseVal.value", "100");
79 shouldBe("use.getAttribute('width')", "'115'");
80 shouldBe("use.getAttribute('height')", "'115'");
81 shouldBe("shadowRoot.firstChild.width.animVal.value", "115");
82 shouldBe("shadowRoot.firstChild.height.animVal.value", "115");
83 }
84
85 function sample4() {
86 shouldBe("use.width.animVal.value", "125");
87 shouldBe("use.width.baseVal.value", "100");
88 shouldBe("use.height.animVal.value", "125");
89 shouldBe("use.height.baseVal.value", "100");
90 shouldBe("use.getAttribute('width')", "'125'");
91 shouldBe("use.getAttribute('height')", "'125'");
92 shouldBe("shadowRoot.firstChild.width.animVal.value", "125");
93 shouldBe("shadowRoot.firstChild.height.animVal.value", "125");
94 }
95
96 function sample5() {
97 shouldBe("use.width.animVal.value", "135");
98 shouldBe("use.width.baseVal.value", "100");
99 shouldBe("use.height.animVal.value", "135");
100 shouldBe("use.height.baseVal.value", "100");
101 shouldBe("use.getAttribute('width')", "'135'");
102 shouldBe("use.getAttribute('height')", "'135'");
103 shouldBe("shadowRoot.firstChild.width.animVal.value", "135");
104 shouldBe("shadowRoot.firstChild.height.animVal.value", "135");
105 }
106
107 function executeTest() {
108 const expectedValues = [
109 // [animationId, time, sampleCallback]
110 ["animate2", 0.0, sample1],
111 ["animate2", 0.5, sample2],
112 ["animate2", 1.5, sample3],
113 ["animate2", 2.5, sample4],
114 ["animate2", 3.5, sample5]
115 ];
116
117 runAnimationTest(expectedValues);
118 }
119
120 window.clickX = 50;
121 window.clickY = 50;
122 var successfullyParsed = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698