Index: LayoutTests/fast/canvas/script-tests/canvas-isPointInPath-winding.js |
diff --git a/LayoutTests/fast/canvas/script-tests/canvas-isPointInPath-winding.js b/LayoutTests/fast/canvas/script-tests/canvas-isPointInPath-winding.js |
index 30d0a46d65d8d0611587f19446c9c67b4fd4fd7f..8dc6d26dab0598190c055504a5996639c7a40e2d 100644 |
--- a/LayoutTests/fast/canvas/script-tests/canvas-isPointInPath-winding.js |
+++ b/LayoutTests/fast/canvas/script-tests/canvas-isPointInPath-winding.js |
@@ -1,24 +1,19 @@ |
description("Series of tests to ensure correct results of the winding rule in isPointInPath."); |
- |
var tmpimg = document.createElement('canvas'); |
tmpimg.width = 200; |
tmpimg.height = 200; |
ctx = tmpimg.getContext('2d'); |
-// Create the image for blending test with images. |
-var img = document.createElement('canvas'); |
-img.width = 100; |
-img.height = 100; |
-var imgCtx = img.getContext('2d'); |
- |
// Execute test. |
function prepareTestScenario() { |
debug('Testing default isPointInPath'); |
ctx.beginPath(); |
ctx.rect(0, 0, 100, 100); |
ctx.rect(25, 25, 50, 50); |
- shouldBeTrue("ctx.isPointInPath(50, 50)"); |
+ shouldBeTrue("ctx.isPointInPath(50, 50)"); |
+ shouldBeFalse("ctx.isPointInPath(NaN, 50)"); |
+ shouldBeFalse("ctx.isPointInPath(50, NaN)"); |
debug(''); |
debug('Testing nonzero isPointInPath'); |
@@ -32,7 +27,52 @@ function prepareTestScenario() { |
ctx.beginPath(); |
ctx.rect(0, 0, 100, 100); |
ctx.rect(25, 25, 50, 50); |
- shouldBeFalse("ctx.isPointInPath(50, 50, 'evenodd')"); |
+ shouldBeFalse("ctx.isPointInPath(50, 50, 'evenodd')"); |
+ debug(''); |
+ |
+ // reset path in context |
+ ctx.beginPath(); |
+ |
+ debug('Testing default isPointInPath with Path object'); |
+ path = new Path(); |
+ path.rect(0, 0, 100, 100); |
+ path.rect(25, 25, 50, 50); |
+ shouldBeTrue("ctx.isPointInPath(path, 50, 50)"); |
+ shouldBeFalse("ctx.isPointInPath(path, NaN, 50)"); |
+ shouldBeFalse("ctx.isPointInPath(path, 50, NaN)"); |
+ debug(''); |
+ |
+ debug('Testing nonzero isPointInPath with Path object'); |
+ path = new Path(); |
+ path.rect(0, 0, 100, 100); |
+ path.rect(25, 25, 50, 50); |
+ shouldBeTrue("ctx.isPointInPath(path, 50, 50, 'nonzero')"); |
+ debug(''); |
+ |
+ debug('Testing evenodd isPointInPath with Path object'); |
+ path = new Path(); |
+ path.rect(0, 0, 100, 100); |
+ path.rect(25, 25, 50, 50); |
+ shouldBeFalse("ctx.isPointInPath(path, 50, 50, 'evenodd')"); |
+ debug(''); |
+ |
+ debug('Testing null isPointInPath with Path object'); |
+ path = null; |
+ shouldThrow("ctx.isPointInPath(null, 50, 50)"); |
+ shouldThrow("ctx.isPointInPath(null, 50, 50, 'nonzero')"); |
+ shouldThrow("ctx.isPointInPath(null, 50, 50, 'evenodd')"); |
+ shouldThrow("ctx.isPointInPath(path, 50, 50)"); |
+ shouldThrow("ctx.isPointInPath(path, 50, 50, 'nonzero')"); |
+ shouldThrow("ctx.isPointInPath(path, 50, 50, 'evenodd')"); |
+ debug(''); |
+ |
+ debug('Testing invalid type isPointInPath with Path object'); |
+ shouldThrow("ctx.isPointInPath([], 50, 50)"); |
+ shouldThrow("ctx.isPointInPath([], 50, 50, 'nonzero')"); |
+ shouldThrow("ctx.isPointInPath([], 50, 50, 'evenodd')"); |
+ shouldThrow("ctx.isPointInPath({}, 50, 50)"); |
+ shouldThrow("ctx.isPointInPath({}, 50, 50, 'nonzero')"); |
+ shouldThrow("ctx.isPointInPath({}, 50, 50, 'evenodd')"); |
debug(''); |
} |