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

Side by Side Diff: LayoutTests/fast/canvas/script-tests/canvas-isPointInPath-winding.js

Issue 179383002: Add versions of isPointIn*() that take a Path parameter. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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 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
4 var tmpimg = document.createElement('canvas'); 3 var tmpimg = document.createElement('canvas');
5 tmpimg.width = 200; 4 tmpimg.width = 200;
6 tmpimg.height = 200; 5 tmpimg.height = 200;
7 ctx = tmpimg.getContext('2d'); 6 ctx = tmpimg.getContext('2d');
8 7
9 // Create the image for blending test with images.
10 var img = document.createElement('canvas');
11 img.width = 100;
12 img.height = 100;
13 var imgCtx = img.getContext('2d');
14
15 // Execute test. 8 // Execute test.
16 function prepareTestScenario() { 9 function prepareTestScenario() {
17 debug('Testing default isPointInPath'); 10 debug('Testing default isPointInPath');
18 ctx.beginPath(); 11 ctx.beginPath();
19 ctx.rect(0, 0, 100, 100); 12 ctx.rect(0, 0, 100, 100);
20 ctx.rect(25, 25, 50, 50); 13 ctx.rect(25, 25, 50, 50);
21 shouldBeTrue("ctx.isPointInPath(50, 50)"); 14 shouldBeTrue("ctx.isPointInPath(50, 50)");
22 debug(''); 15 debug('');
23 16
24 debug('Testing nonzero isPointInPath'); 17 debug('Testing nonzero isPointInPath');
25 ctx.beginPath(); 18 ctx.beginPath();
26 ctx.rect(0, 0, 100, 100); 19 ctx.rect(0, 0, 100, 100);
27 ctx.rect(25, 25, 50, 50); 20 ctx.rect(25, 25, 50, 50);
28 shouldBeTrue("ctx.isPointInPath(50, 50, 'nonzero')"); 21 shouldBeTrue("ctx.isPointInPath(50, 50, 'nonzero')");
29 debug(''); 22 debug('');
30 23
31 debug('Testing evenodd isPointInPath'); 24 debug('Testing evenodd isPointInPath');
32 ctx.beginPath(); 25 ctx.beginPath();
33 ctx.rect(0, 0, 100, 100); 26 ctx.rect(0, 0, 100, 100);
34 ctx.rect(25, 25, 50, 50); 27 ctx.rect(25, 25, 50, 50);
35 shouldBeFalse("ctx.isPointInPath(50, 50, 'evenodd')"); 28 shouldBeFalse("ctx.isPointInPath(50, 50, 'evenodd')");
29 debug('');
30
31 // reset path in context
32 ctx.beginPath();
33
34 debug('Testing default isPointInPath with Path object');
35 path = new Path();
36 path.rect(0, 0, 100, 100);
37 path.rect(25, 25, 50, 50);
38 shouldBeTrue("ctx.isPointInPath(path, 50, 50)");
39 debug('');
40
41 debug('Testing nonzero isPointInPath with Path object');
42 path = new Path();
43 path.rect(0, 0, 100, 100);
44 path.rect(25, 25, 50, 50);
45 shouldBeTrue("ctx.isPointInPath(path, 50, 50, 'nonzero')");
46 debug('');
47
48 debug('Testing evenodd isPointInPath with Path object');
49 path = new Path();
50 path.rect(0, 0, 100, 100);
51 path.rect(25, 25, 50, 50);
52 shouldBeFalse("ctx.isPointInPath(path, 50, 50, 'evenodd')");
36 debug(''); 53 debug('');
37 } 54 }
38 55
39 // Run test and allow variation of results. 56 // Run test and allow variation of results.
40 prepareTestScenario(); 57 prepareTestScenario();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698