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

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

Issue 178673002: Rename Path to Path2D (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@path
Patch Set: Merge to head which includes isPoint and addPath changes. Created 6 years, 9 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 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 16 matching lines...) Expand all
27 ctx.beginPath(); 27 ctx.beginPath();
28 ctx.rect(0, 0, 100, 100); 28 ctx.rect(0, 0, 100, 100);
29 ctx.rect(25, 25, 50, 50); 29 ctx.rect(25, 25, 50, 50);
30 shouldBeFalse("ctx.isPointInPath(50, 50, 'evenodd')"); 30 shouldBeFalse("ctx.isPointInPath(50, 50, 'evenodd')");
31 debug(''); 31 debug('');
32 32
33 // reset path in context 33 // reset path in context
34 ctx.beginPath(); 34 ctx.beginPath();
35 35
36 debug('Testing default isPointInPath with Path object'); 36 debug('Testing default isPointInPath with Path object');
37 path = new Path(); 37 path = new Path2D();
38 path.rect(0, 0, 100, 100); 38 path.rect(0, 0, 100, 100);
39 path.rect(25, 25, 50, 50); 39 path.rect(25, 25, 50, 50);
40 shouldBeTrue("ctx.isPointInPath(path, 50, 50)"); 40 shouldBeTrue("ctx.isPointInPath(path, 50, 50)");
41 shouldBeFalse("ctx.isPointInPath(path, NaN, 50)"); 41 shouldBeFalse("ctx.isPointInPath(path, NaN, 50)");
42 shouldBeFalse("ctx.isPointInPath(path, 50, NaN)"); 42 shouldBeFalse("ctx.isPointInPath(path, 50, NaN)");
43 debug(''); 43 debug('');
44 44
45 debug('Testing nonzero isPointInPath with Path object'); 45 debug('Testing nonzero isPointInPath with Path object');
46 path = new Path(); 46 path = new Path2D();
47 path.rect(0, 0, 100, 100); 47 path.rect(0, 0, 100, 100);
48 path.rect(25, 25, 50, 50); 48 path.rect(25, 25, 50, 50);
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 Path(); 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 null isPointInPath with Path object'); 59 debug('Testing null isPointInPath with Path object');
60 path = null; 60 path = null;
61 shouldThrow("ctx.isPointInPath(null, 50, 50)"); 61 shouldThrow("ctx.isPointInPath(null, 50, 50)");
62 shouldThrow("ctx.isPointInPath(null, 50, 50, 'nonzero')"); 62 shouldThrow("ctx.isPointInPath(null, 50, 50, 'nonzero')");
63 shouldThrow("ctx.isPointInPath(null, 50, 50, 'evenodd')"); 63 shouldThrow("ctx.isPointInPath(null, 50, 50, 'evenodd')");
64 shouldThrow("ctx.isPointInPath(path, 50, 50)"); 64 shouldThrow("ctx.isPointInPath(path, 50, 50)");
65 shouldThrow("ctx.isPointInPath(path, 50, 50, 'nonzero')"); 65 shouldThrow("ctx.isPointInPath(path, 50, 50, 'nonzero')");
66 shouldThrow("ctx.isPointInPath(path, 50, 50, 'evenodd')"); 66 shouldThrow("ctx.isPointInPath(path, 50, 50, 'evenodd')");
67 debug(''); 67 debug('');
68 68
69 debug('Testing invalid type isPointInPath with Path object'); 69 debug('Testing invalid type isPointInPath with Path object');
70 shouldThrow("ctx.isPointInPath([], 50, 50)"); 70 shouldThrow("ctx.isPointInPath([], 50, 50)");
71 shouldThrow("ctx.isPointInPath([], 50, 50, 'nonzero')"); 71 shouldThrow("ctx.isPointInPath([], 50, 50, 'nonzero')");
72 shouldThrow("ctx.isPointInPath([], 50, 50, 'evenodd')"); 72 shouldThrow("ctx.isPointInPath([], 50, 50, 'evenodd')");
73 shouldThrow("ctx.isPointInPath({}, 50, 50)"); 73 shouldThrow("ctx.isPointInPath({}, 50, 50)");
74 shouldThrow("ctx.isPointInPath({}, 50, 50, 'nonzero')"); 74 shouldThrow("ctx.isPointInPath({}, 50, 50, 'nonzero')");
75 shouldThrow("ctx.isPointInPath({}, 50, 50, 'evenodd')"); 75 shouldThrow("ctx.isPointInPath({}, 50, 50, 'evenodd')");
76 debug(''); 76 debug('');
77 } 77 }
78 78
79 // Run test and allow variation of results. 79 // Run test and allow variation of results.
80 prepareTestScenario(); 80 prepareTestScenario();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698