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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-lineDash-input-sequence.html

Issue 2810843002: bindings: Make the sequence conversion code more complaint with WebIDL. (Closed)
Patch Set: Adjust even more tests Created 3 years, 8 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
1 <link rel="help" href="http://www.w3.org/TR/2013/WD-2dcontext2-20130528/#dom-con text-2d-setlinedash"> 1 <link rel="help" href="http://www.w3.org/TR/2013/WD-2dcontext2-20130528/#dom-con text-2d-setlinedash">
2 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
4 <body> 4 <body>
5 <script> 5 <script>
6 test(function(t) { 6 test(function(t) {
7 7
8 var canvas = document.createElement('canvas'); 8 var canvas = document.createElement('canvas');
9 document.body.appendChild(canvas); 9 document.body.appendChild(canvas);
10 canvas.setAttribute('width', '700'); 10 canvas.setAttribute('width', '700');
11 canvas.setAttribute('height', '700'); 11 canvas.setAttribute('height', '700');
12 var ctx = canvas.getContext('2d'); 12 var ctx = canvas.getContext('2d');
13 13
14 var arrayValues = [5, 15, 25]; 14 var arrayValues = [5, 15, 25];
15 15
16 function createIterableObject() {
17 return {
18 [Symbol.iterator]() {
19 var i = 0;
20 return {
21 next() {
22 if (i >= arrayValues.length)
23 return { done: true };
24 return { done: false, value: arrayValues[i++] };
25 }
26 }
27 }
28 }
29 }
30
16 function createTestArray(arrayType) { 31 function createTestArray(arrayType) {
17 var array; 32 var array;
18 if (arrayType == Object) { 33 if (arrayType == Object) {
19 // Test a "sequence" (Object with length property). 34 array = createIterableObject();
20 array = {length: arrayValues.length};
21 } else { 35 } else {
22 array = new arrayType(arrayValues.length); 36 array = new arrayType(arrayValues.length);
37 for (var i = 0; i < arrayValues.length; ++i)
38 array[i] = arrayValues[i];
23 } 39 }
24
25 for (var i = 0; i < arrayValues.length; ++i)
26 array[i] = arrayValues[i]
27 return array; 40 return array;
28 } 41 }
29 42
30 var lineDash; 43 var lineDash;
31 var inputArray; 44 var inputArray;
32 function checkLineDash(testArray, shouldFail) { 45 function checkLineDash(testArray, shouldFail) {
33 inputArray = testArray; 46 inputArray = testArray;
34 // Reset line dash. 47 // Reset line dash.
35 ctx.setLineDash([]); 48 ctx.setLineDash([]);
36 // Set line dash. 49 // Set line dash.
(...skipping 29 matching lines...) Expand all
66 // Test passing a Boolean as input. 79 // Test passing a Boolean as input.
67 checkLineDash(true, true); 80 checkLineDash(true, true);
68 // Test passing null as input. 81 // Test passing null as input.
69 checkLineDash(null, true); 82 checkLineDash(null, true);
70 // Test passing undefined as input. 83 // Test passing undefined as input.
71 checkLineDash(undefined, true); 84 checkLineDash(undefined, true);
72 85
73 }, 'Test that setLineDash converts input argument into a Web IDL sequence'); 86 }, 'Test that setLineDash converts input argument into a Web IDL sequence');
74 </script> 87 </script>
75 </body> 88 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698