| OLD | NEW |
| 1 description("Series of tests to ensure correct results of the winding rule in is
PointInPath."); | 1 description("Series of tests to ensure correct results of the winding rule in is
PointInPath."); |
| 2 | 2 |
| 3 var tmpimg = document.createElement('canvas'); | 3 var tmpimg = document.createElement('canvas'); |
| 4 tmpimg.width = 200; | 4 tmpimg.width = 200; |
| 5 tmpimg.height = 200; | 5 tmpimg.height = 200; |
| 6 ctx = tmpimg.getContext('2d'); | 6 ctx = tmpimg.getContext('2d'); |
| 7 | 7 |
| 8 // Execute test. | 8 // Execute test. |
| 9 function prepareTestScenario() { | 9 function prepareTestScenario() { |
| 10 debug('Testing default isPointInPath'); | 10 debug('Testing default isPointInPath'); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 shouldBeTrue("ctx.isPointInPath(path, 50, 50, 'nonzero')"); | 49 shouldBeTrue("ctx.isPointInPath(path, 50, 50, 'nonzero')"); |
| 50 debug(''); | 50 debug(''); |
| 51 | 51 |
| 52 debug('Testing evenodd isPointInPath with Path object'); | 52 debug('Testing evenodd isPointInPath with Path object'); |
| 53 path = new Path2D(); | 53 path = new Path2D(); |
| 54 path.rect(0, 0, 100, 100); | 54 path.rect(0, 0, 100, 100); |
| 55 path.rect(25, 25, 50, 50); | 55 path.rect(25, 25, 50, 50); |
| 56 shouldBeFalse("ctx.isPointInPath(path, 50, 50, 'evenodd')"); | 56 shouldBeFalse("ctx.isPointInPath(path, 50, 50, 'evenodd')"); |
| 57 debug(''); | 57 debug(''); |
| 58 | 58 |
| 59 debug('Testing invalid enumeration isPointInPath (w/ and w/o Path object'); |
| 60 shouldThrow("ctx.isPointInPath(path, 50, 50, 'gazonk')"); |
| 61 shouldThrow("ctx.isPointInPath(50, 50, 'gazonk')"); |
| 62 debug(''); |
| 63 |
| 59 debug('Testing null isPointInPath with Path object'); | 64 debug('Testing null isPointInPath with Path object'); |
| 60 path = null; | 65 path = null; |
| 61 shouldThrow("ctx.isPointInPath(null, 50, 50)"); | 66 shouldThrow("ctx.isPointInPath(null, 50, 50)"); |
| 62 shouldThrow("ctx.isPointInPath(null, 50, 50, 'nonzero')"); | 67 shouldThrow("ctx.isPointInPath(null, 50, 50, 'nonzero')"); |
| 63 shouldThrow("ctx.isPointInPath(null, 50, 50, 'evenodd')"); | 68 shouldThrow("ctx.isPointInPath(null, 50, 50, 'evenodd')"); |
| 64 shouldThrow("ctx.isPointInPath(path, 50, 50)"); | 69 shouldThrow("ctx.isPointInPath(path, 50, 50)"); |
| 65 shouldThrow("ctx.isPointInPath(path, 50, 50, 'nonzero')"); | 70 shouldThrow("ctx.isPointInPath(path, 50, 50, 'nonzero')"); |
| 66 shouldThrow("ctx.isPointInPath(path, 50, 50, 'evenodd')"); | 71 shouldThrow("ctx.isPointInPath(path, 50, 50, 'evenodd')"); |
| 67 debug(''); | 72 debug(''); |
| 68 | 73 |
| 69 debug('Testing invalid type isPointInPath with Path object'); | 74 debug('Testing invalid type isPointInPath with Path object'); |
| 70 shouldThrow("ctx.isPointInPath([], 50, 50)"); | 75 shouldThrow("ctx.isPointInPath([], 50, 50)"); |
| 71 shouldThrow("ctx.isPointInPath([], 50, 50, 'nonzero')"); | 76 shouldThrow("ctx.isPointInPath([], 50, 50, 'nonzero')"); |
| 72 shouldThrow("ctx.isPointInPath([], 50, 50, 'evenodd')"); | 77 shouldThrow("ctx.isPointInPath([], 50, 50, 'evenodd')"); |
| 73 shouldThrow("ctx.isPointInPath({}, 50, 50)"); | 78 shouldThrow("ctx.isPointInPath({}, 50, 50)"); |
| 74 shouldThrow("ctx.isPointInPath({}, 50, 50, 'nonzero')"); | 79 shouldThrow("ctx.isPointInPath({}, 50, 50, 'nonzero')"); |
| 75 shouldThrow("ctx.isPointInPath({}, 50, 50, 'evenodd')"); | 80 shouldThrow("ctx.isPointInPath({}, 50, 50, 'evenodd')"); |
| 76 debug(''); | 81 debug(''); |
| 77 } | 82 } |
| 78 | 83 |
| 79 // Run test and allow variation of results. | 84 // Run test and allow variation of results. |
| 80 prepareTestScenario(); | 85 prepareTestScenario(); |
| OLD | NEW |