OLD | NEW |
1 description("Series of tests to ensure stroke() works with optional path paramet
er."); | 1 description("Series of tests to ensure stroke() works with optional path paramet
er."); |
2 | 2 |
3 var ctx = document.getElementById('canvas').getContext('2d'); | 3 var ctx = document.getElementById('canvas').getContext('2d'); |
4 | 4 |
5 function pixelDataAtPoint() { | 5 function pixelDataAtPoint() { |
6 return ctx.getImageData(75, 75, 1, 1).data; | 6 return ctx.getImageData(75, 75, 1, 1).data; |
7 } | 7 } |
8 | 8 |
9 function checkResult(expectedColors, sigma) { | 9 function checkResult(expectedColors, sigma) { |
10 for (var i = 0; i < 4; i++) | 10 for (var i = 0; i < 4; i++) |
(...skipping 21 matching lines...) Expand all Loading... |
32 ctx.beginPath(); | 32 ctx.beginPath(); |
33 drawRectangleOn(ctx); | 33 drawRectangleOn(ctx); |
34 ctx.stroke(); | 34 ctx.stroke(); |
35 } | 35 } |
36 debug(''); | 36 debug(''); |
37 checkResult([0, 255, 0, 255], 5); | 37 checkResult([0, 255, 0, 255], 5); |
38 } | 38 } |
39 | 39 |
40 // Execute test. | 40 // Execute test. |
41 function prepareTestScenario() { | 41 function prepareTestScenario() { |
42 var path = new Path(); | 42 var path = new Path2D(); |
43 drawRectangleOn(path); | 43 drawRectangleOn(path); |
44 | 44 |
45 testStrokeWith(); | 45 testStrokeWith(); |
46 testStrokeWith(path); | 46 testStrokeWith(path); |
47 | 47 |
48 // Test exception cases. | 48 // Test exception cases. |
49 shouldThrow("ctx.stroke(null)"); | 49 shouldThrow("ctx.stroke(null)"); |
50 shouldThrow("ctx.stroke([])"); | 50 shouldThrow("ctx.stroke([])"); |
51 shouldThrow("ctx.stroke({})"); | 51 shouldThrow("ctx.stroke({})"); |
52 } | 52 } |
53 | 53 |
54 // Run test and allow variation of results. | 54 // Run test and allow variation of results. |
55 prepareTestScenario(); | 55 prepareTestScenario(); |
OLD | NEW |