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

Side by Side Diff: LayoutTests/svg/animations/animate-setcurrenttime.html

Issue 910713002: Restrict floats over SVGSVGElement to finite values. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update svg/animations/animate-setcurrenttime.html Created 5 years, 10 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
« no previous file with comments | « no previous file | LayoutTests/svg/animations/animate-setcurrenttime-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 </head> 5 </head>
6 6
7 <body> 7 <body>
8 <h1>SVG 1.1 dynamic animation tests</h1>
9
10 <svg id='outer-svg' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www .w3.org/1999/xlink' xml:space='preserve'> 8 <svg id='outer-svg' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www .w3.org/1999/xlink' xml:space='preserve'>
11 <!-- sequential animations --> 9 <!-- sequential animations -->
12 <rect id='plain' x='0' y='0' width='32' height='32' fill='green'> 10 <rect id='plain' x='0' y='0' width='32' height='32' fill='green'>
13 <animate id='plain-anim' attributeName='x' from='0' to='128' begin='0s' du r='4s' fill='freeze'/> 11 <animate id='plain-anim' attributeName='x' from='0' to='128' begin='0s' du r='4s' fill='freeze'/>
14 </rect> 12 </rect>
15 13
16 <!-- sequential animations --> 14 <!-- sequential animations -->
17 <rect id='sequential' x='0' y='32' width='32' height='32' fill='green'> 15 <rect id='sequential' x='0' y='32' width='32' height='32' fill='green'>
18 <animate attributeName='x' from='0' to='32' begin='0s' dur='1s' fill='fr eeze'/> 16 <animate attributeName='x' from='0' to='32' begin='0s' dur='1s' fill='fr eeze'/>
19 <animate attributeName='x' from='64' to='128' begin='3s' dur='1s' fill='fr eeze'/> 17 <animate attributeName='x' from='64' to='128' begin='3s' dur='1s' fill='fr eeze'/>
(...skipping 10 matching lines...) Expand all
30 </rect> 28 </rect>
31 29
32 <!-- nested --> 30 <!-- nested -->
33 <svg id='nested-svg' x='0' y='128'> 31 <svg id='nested-svg' x='0' y='128'>
34 <rect id='nested' x='0' y='0' width='32' height='32' fill='green'> 32 <rect id='nested' x='0' y='0' width='32' height='32' fill='green'>
35 <animate attributeName='x' from='0' to='128' begin='0s' dur='4s' fill='f reeze'/> 33 <animate attributeName='x' from='0' to='128' begin='0s' dur='4s' fill='f reeze'/>
36 </rect> 34 </rect>
37 </svg> 35 </svg>
38 36
39 <script> 37 <script>
38 description("SVG 1.1 dynamic animation tests");
39 self.jsTestIsAsync = true;
40
40 var svg = document.getElementById('outer-svg'), 41 var svg = document.getElementById('outer-svg'),
41 nestedsvg = document.getElementById('nested-svg'); 42 nestedsvg = document.getElementById('nested-svg');
42 var tests, curIdx = 0; 43 var tests, curIdx = 0;
43 44
44 var plain = document.getElementById('plain'); 45 var plain = document.getElementById('plain');
45 var sequential = document.getElementById('sequential'); 46 var sequential = document.getElementById('sequential');
46 var accumulating = document.getElementById('accumulating'); 47 var accumulating = document.getElementById('accumulating');
47 var repeating = document.getElementById('repeating'); 48 var repeating = document.getElementById('repeating');
48 var nested = document.getElementById('nested'); 49 var nested = document.getElementById('nested');
50 var test;
49 51
50 function runTest() { 52 function runTest() {
51 var test = tests[curIdx++]; 53 test = tests[curIdx++];
52 54
53 svg.setCurrentTime(test.time[0]); 55 if (test.throws && test.throws[0])
54 nestedsvg.setCurrentTime(test.time[1]); 56 shouldThrow("svg.setCurrentTime(test.time[0])");
57 else
58 svg.setCurrentTime(test.time[0]);
59
60 if (test.throws && test.throws[1])
61 shouldThrow("nestedsvg.setCurrentTime(test.time[1])");
62 else
63 nestedsvg.setCurrentTime(test.time[1]);
55 64
56 setTimeout(function() { 65 setTimeout(function() {
57 for (var attr in test.values) { 66 for (var attr in test.values) {
58 shouldBe(attr + '.animVal.value', String(test.values[attr])); 67 shouldBe(attr + '.animVal.value', String(test.values[attr]));
59 } 68 }
60 69
61 if (curIdx == tests.length) { 70 if (curIdx == tests.length)
62 if (window.testRunner) 71 finishJSTest();
63 testRunner.notifyDone();
64 }
65 else 72 else
66 runTest(); 73 runTest();
67 }, 0); 74 }, 0);
68 } 75 }
69 76
70 function executeTests() { 77 function executeTests() {
71 nestedsvg.pauseAnimations(); 78 nestedsvg.pauseAnimations();
72 svg.pauseAnimations(); 79 svg.pauseAnimations();
73 80
74 tests = [ 81 tests = [
75 // Test invalid values. 82 // Test invalid values.
76 { time: ['tintin', NaN], values: { 'plain.x': 0, 'sequential.x': 0, 'accumulating.x': 0, 'repeating.x': 0, 'nested.x': 0 } }, 83 { time: ['tintin', NaN], throws: [true, true], values: { 'plain.x': 0, 'sequential.x': 0, 'accumulating.x': 0, 'repeating.x': 0, 'nested.x': 0 } },
77 84
78 // Test out-of-range values. 85 // Test out-of-range values.
79 { time: [-1, -1], values: { 'plain.x': 0, 'sequential.x': 0, 'accumu lating.x': 0, 'repeating.x': 0, 'nested.x': 0 } }, 86 { time: [-1, -1], values: { 'plain.x': 0, 'sequential.x': 0, 'accumu lating.x': 0, 'repeating.x': 0, 'nested.x': 0 } },
80 { time: [ 5, 5], values: { 'plain.x': 128, 'sequential.x': 128, 'accumu lating.x': 128, 'repeating.x': 128, 'nested.x': 128 } }, 87 { time: [ 5, 5], values: { 'plain.x': 128, 'sequential.x': 128, 'accumu lating.x': 128, 'repeating.x': 128, 'nested.x': 128 } },
81 88
82 // Test changing time only for all elements. 89 // Test changing time only for all elements.
83 { time: [0, 0], values: { 'plain.x': 0, 'sequential.x': 0, 'accumula ting.x': 0, 'repeating.x': 0, 'nested.x': 0 } }, 90 { time: [0, 0], values: { 'plain.x': 0, 'sequential.x': 0, 'accumula ting.x': 0, 'repeating.x': 0, 'nested.x': 0 } },
84 { time: [1, 1], values: { 'plain.x': 32, 'sequential.x': 32, 'accumula ting.x': 128, 'repeating.x': 128, 'nested.x': 32 } }, 91 { time: [1, 1], values: { 'plain.x': 32, 'sequential.x': 32, 'accumula ting.x': 128, 'repeating.x': 128, 'nested.x': 32 } },
85 { time: [2, 2], values: { 'plain.x': 64, 'sequential.x': 32, 'accumula ting.x': 256, 'repeating.x': 0, 'nested.x': 64 } }, 92 { time: [2, 2], values: { 'plain.x': 64, 'sequential.x': 32, 'accumula ting.x': 256, 'repeating.x': 0, 'nested.x': 64 } },
86 { time: [3, 3], values: { 'plain.x': 96, 'sequential.x': 64, 'accumula ting.x': 192, 'repeating.x': 128, 'nested.x': 96 } }, 93 { time: [3, 3], values: { 'plain.x': 96, 'sequential.x': 64, 'accumula ting.x': 192, 'repeating.x': 128, 'nested.x': 96 } },
(...skipping 23 matching lines...) Expand all
110 testRunner.waitUntilDone() 117 testRunner.waitUntilDone()
111 } 118 }
112 executeTests(); 119 executeTests();
113 </script> 120 </script>
114 </svg> 121 </svg>
115 122
116 <p id="description"></p> 123 <p id="description"></p>
117 <div id="console"></div> 124 <div id="console"></div>
118 </body> 125 </body>
119 </html> 126 </html>
120
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/svg/animations/animate-setcurrenttime-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698