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

Side by Side Diff: LayoutTests/svg/animations/script-tests/svgnumber-animation-1.js

Issue 705373004: Don't require getPropertyCSSValue in svg number animation tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | LayoutTests/svg/animations/script-tests/svgnumber-animation-2.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 description("Test for SVGNumber animation."); 1 description("Test for SVGNumber animation.");
2 createSVGTestCase(); 2 createSVGTestCase();
3 3
4 // Setup test document 4 // Setup test document
5 var rect = createSVGElement("rect"); 5 var rect = createSVGElement("rect");
6 rect.setAttribute("id", "rect"); 6 rect.setAttribute("id", "rect");
7 rect.setAttribute("x", "0"); 7 rect.setAttribute("x", "0");
8 rect.setAttribute("width", "100"); 8 rect.setAttribute("width", "100");
9 rect.setAttribute("height", "100"); 9 rect.setAttribute("height", "100");
10 rect.setAttribute("fill", "green"); 10 rect.setAttribute("fill", "green");
11 rect.setAttribute("opacity", "0"); 11 rect.setAttribute("opacity", "0");
12 rect.setAttribute("onclick", "executeTest()"); 12 rect.setAttribute("onclick", "executeTest()");
13 13
14 var animate = createSVGElement("animate"); 14 var animate = createSVGElement("animate");
15 animate.setAttribute("id", "animation"); 15 animate.setAttribute("id", "animation");
16 animate.setAttribute("attributeName", "opacity"); 16 animate.setAttribute("attributeName", "opacity");
17 animate.setAttribute("begin", "click"); 17 animate.setAttribute("begin", "click");
18 animate.setAttribute("dur", "4s"); 18 animate.setAttribute("dur", "4s");
19 animate.setAttribute("from", "0"); 19 animate.setAttribute("from", "0");
20 animate.setAttribute("to", "1"); 20 animate.setAttribute("to", "1");
21 rect.appendChild(animate); 21 rect.appendChild(animate);
22 rootSVGElement.appendChild(rect); 22 rootSVGElement.appendChild(rect);
23 23
24 // Setup animation test 24 // Setup animation test
25 function sample1() { 25 function sample1() {
26 // Check initial/end conditions 26 // Check initial/end conditions
27 shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').g etFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0"); 27 shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0");
28 } 28 }
29 29
30 function sample2() { 30 function sample2() {
31 shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').g etFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.5"); 31 shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0.5");
32 } 32 }
33 33
34 function sample3() { 34 function sample3() {
35 shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').g etFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "1"); 35 shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "1");
36 } 36 }
37 37
38 function executeTest() { 38 function executeTest() {
39 const expectedValues = [ 39 const expectedValues = [
40 // [animationId, time, sampleCallback] 40 // [animationId, time, sampleCallback]
41 ["animation", 0.0, sample1], 41 ["animation", 0.0, sample1],
42 ["animation", 2.0, sample2], 42 ["animation", 2.0, sample2],
43 ["animation", 3.999, sample3], 43 ["animation", 3.999, sample3],
44 ["animation", 4.001, sample1] 44 ["animation", 4.001, sample1]
45 ]; 45 ];
46 46
47 runAnimationTest(expectedValues); 47 runAnimationTest(expectedValues);
48 } 48 }
49 49
50 var successfullyParsed = true; 50 var successfullyParsed = true;
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/svg/animations/script-tests/svgnumber-animation-2.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698