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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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'); | 59 debug('Testing invalid enumeration isPointInPath (w/ and w/o Path object'); |
60 shouldThrow("ctx.isPointInPath(path, 50, 50, 'gazonk')"); | 60 shouldThrow("ctx.isPointInPath(path, 50, 50, 'gazonk')"); |
61 shouldThrow("ctx.isPointInPath(50, 50, 'gazonk')"); | 61 shouldThrow("ctx.isPointInPath(50, 50, 'gazonk')"); |
62 debug(''); | 62 debug(''); |
63 | 63 |
64 debug('Testing null isPointInPath with Path object'); | 64 debug('Testing invalid type isPointInPath with Path object'); |
65 path = null; | |
66 shouldThrow("ctx.isPointInPath(null, 50, 50)"); | 65 shouldThrow("ctx.isPointInPath(null, 50, 50)"); |
67 shouldThrow("ctx.isPointInPath(null, 50, 50, 'nonzero')"); | 66 shouldThrow("ctx.isPointInPath(null, 50, 50, 'nonzero')"); |
68 shouldThrow("ctx.isPointInPath(null, 50, 50, 'evenodd')"); | 67 shouldThrow("ctx.isPointInPath(null, 50, 50, 'evenodd')"); |
69 shouldThrow("ctx.isPointInPath(path, 50, 50)"); | 68 shouldThrow("ctx.isPointInPath(null, 50, 50, null)"); |
70 shouldThrow("ctx.isPointInPath(path, 50, 50, 'nonzero')"); | 69 shouldThrow("ctx.isPointInPath(path, 50, 50, null)"); |
71 shouldThrow("ctx.isPointInPath(path, 50, 50, 'evenodd')"); | 70 shouldThrow("ctx.isPointInPath(undefined, 50, 50)"); |
72 debug(''); | 71 shouldThrow("ctx.isPointInPath(undefined, 50, 50, 'nonzero')"); |
73 | 72 shouldThrow("ctx.isPointInPath(undefined, 50, 50, 'evenodd')"); |
74 debug('Testing invalid type isPointInPath with Path object'); | 73 shouldThrow("ctx.isPointInPath(undefined, 50, 50, undefined)"); |
| 74 shouldThrow("ctx.isPointInPath(path, 50, 50, undefined)"); |
75 shouldThrow("ctx.isPointInPath([], 50, 50)"); | 75 shouldThrow("ctx.isPointInPath([], 50, 50)"); |
76 shouldThrow("ctx.isPointInPath([], 50, 50, 'nonzero')"); | 76 shouldThrow("ctx.isPointInPath([], 50, 50, 'nonzero')"); |
77 shouldThrow("ctx.isPointInPath([], 50, 50, 'evenodd')"); | 77 shouldThrow("ctx.isPointInPath([], 50, 50, 'evenodd')"); |
78 shouldThrow("ctx.isPointInPath({}, 50, 50)"); | 78 shouldThrow("ctx.isPointInPath({}, 50, 50)"); |
79 shouldThrow("ctx.isPointInPath({}, 50, 50, 'nonzero')"); | 79 shouldThrow("ctx.isPointInPath({}, 50, 50, 'nonzero')"); |
80 shouldThrow("ctx.isPointInPath({}, 50, 50, 'evenodd')"); | 80 shouldThrow("ctx.isPointInPath({}, 50, 50, 'evenodd')"); |
81 debug(''); | 81 debug(''); |
82 } | 82 } |
83 | 83 |
84 // Run test and allow variation of results. | 84 // Run test and allow variation of results. |
85 prepareTestScenario(); | 85 prepareTestScenario(); |
OLD | NEW |