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

Side by Side Diff: LayoutTests/svg/animations/script-tests/animate-css-xml-attributeType.js

Issue 11186052: Revert 131767 - Merge 130777 - Prevent animation when CSS attributeType is invalid. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1271/
Patch Set: Created 8 years, 2 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("Tests that XML and CSS attributeTypes can be switched between.");
2 createSVGTestCase();
3
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");
11 rect.setAttribute("onclick", "executeTest()");
12
13 var set = createSVGElement("set");
14 set.setAttribute("id", "set");
15 set.setAttribute("attributeName", "x");
16 set.setAttribute("attributeType", "XML");
17 set.setAttribute("to", "300");
18 set.setAttribute("begin", "click");
19 rect.appendChild(set);
20 rootSVGElement.appendChild(rect);
21
22 // Setup animation test
23 function sample1() {
24 shouldBeCloseEnough("rect.x.animVal.value", "100");
25 shouldBe("rect.x.baseVal.value", "100");
26 }
27
28 function sample2() {
29 shouldBeCloseEnough("rect.x.animVal.value", "300");
30 // change the animationType to CSS which is invalid.
31 set.setAttribute("attributeType", "CSS");
32 }
33
34 function sample3() {
35 // verify that the animation resets.
36 shouldBeCloseEnough("rect.x.animVal.value", "100");
37 // change the animation to a CSS animatable value.
38 set.setAttribute("attributeName", "opacity");
39 set.setAttribute("to", "0.8");
40 }
41
42 function sample4() {
43 shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').g etFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.8");
44 // change the animation to a non-CSS animatable value.
45 set.setAttribute("attributeName", "x");
46 set.setAttribute("to", "200");
47 }
48
49 function sample5() {
50 // verify that the animation does not run.
51 shouldBeCloseEnough("rect.x.animVal.value", "100");
52 shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').g etFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "1.0");
53 // change the animationType to XML which is valid.
54 set.setAttribute("attributeType", "XML");
55 }
56
57 function sample6() {
58 shouldBeCloseEnough("rect.x.animVal.value", "200");
59 shouldBe("rect.x.baseVal.value", "100");
60 }
61
62 function executeTest() {
63 const expectedValues = [
64 // [animationId, time, sampleCallback]
65 ["set", 0.0, sample1],
66 ["set", 0.5, sample2],
67 ["set", 1.0, sample3],
68 ["set", 1.5, sample4],
69 ["set", 2.0, sample5],
70 ["set", 2.5, sample6]
71 ];
72
73 runAnimationTest(expectedValues);
74 }
75
76 window.clickX = 150;
77 var successfullyParsed = true;
OLDNEW
« no previous file with comments | « LayoutTests/svg/animations/invalid-css-attribute-crash-expected.svg ('k') | Source/WebCore/svg/SVGAnimateElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698