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

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

Issue 1476863003: bindings: Ignores the last undefined arguments when counting the args. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated layout tests. Created 5 years 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 20 matching lines...) Expand all
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 Path2D(); 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 shouldBeTrue("ctx.isPointInPath(path, 50, 50, undefined)");
41 shouldBeFalse("ctx.isPointInPath(path, NaN, 50)"); 42 shouldBeFalse("ctx.isPointInPath(path, NaN, 50)");
42 shouldBeFalse("ctx.isPointInPath(path, 50, NaN)"); 43 shouldBeFalse("ctx.isPointInPath(path, 50, NaN)");
43 debug(''); 44 debug('');
44 45
45 debug('Testing nonzero isPointInPath with Path object'); 46 debug('Testing nonzero isPointInPath with Path object');
46 path = new Path2D(); 47 path = new Path2D();
47 path.rect(0, 0, 100, 100); 48 path.rect(0, 0, 100, 100);
48 path.rect(25, 25, 50, 50); 49 path.rect(25, 25, 50, 50);
49 shouldBeTrue("ctx.isPointInPath(path, 50, 50, 'nonzero')"); 50 shouldBeTrue("ctx.isPointInPath(path, 50, 50, 'nonzero')");
50 debug(''); 51 debug('');
(...skipping 13 matching lines...) Expand all
64 debug('Testing invalid type isPointInPath with Path object'); 65 debug('Testing invalid type isPointInPath with Path object');
65 shouldThrow("ctx.isPointInPath(null, 50, 50)"); 66 shouldThrow("ctx.isPointInPath(null, 50, 50)");
66 shouldThrow("ctx.isPointInPath(null, 50, 50, 'nonzero')"); 67 shouldThrow("ctx.isPointInPath(null, 50, 50, 'nonzero')");
67 shouldThrow("ctx.isPointInPath(null, 50, 50, 'evenodd')"); 68 shouldThrow("ctx.isPointInPath(null, 50, 50, 'evenodd')");
68 shouldThrow("ctx.isPointInPath(null, 50, 50, null)"); 69 shouldThrow("ctx.isPointInPath(null, 50, 50, null)");
69 shouldThrow("ctx.isPointInPath(path, 50, 50, null)"); 70 shouldThrow("ctx.isPointInPath(path, 50, 50, null)");
70 shouldThrow("ctx.isPointInPath(undefined, 50, 50)"); 71 shouldThrow("ctx.isPointInPath(undefined, 50, 50)");
71 shouldThrow("ctx.isPointInPath(undefined, 50, 50, 'nonzero')"); 72 shouldThrow("ctx.isPointInPath(undefined, 50, 50, 'nonzero')");
72 shouldThrow("ctx.isPointInPath(undefined, 50, 50, 'evenodd')"); 73 shouldThrow("ctx.isPointInPath(undefined, 50, 50, 'evenodd')");
73 shouldThrow("ctx.isPointInPath(undefined, 50, 50, undefined)"); 74 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 debug("Testing extremely large scale") 83 debug("Testing extremely large scale")
84 ctx.save(); 84 ctx.save();
85 ctx.scale(Number.MAX_VALUE, Number.MAX_VALUE); 85 ctx.scale(Number.MAX_VALUE, Number.MAX_VALUE);
86 ctx.beginPath(); 86 ctx.beginPath();
87 ctx.rect(-10, -10, 20, 20); 87 ctx.rect(-10, -10, 20, 20);
88 shouldBeTrue("ctx.isPointInPath(0, 0, 'nonzero')"); 88 shouldBeTrue("ctx.isPointInPath(0, 0, 'nonzero')");
89 shouldBeTrue("ctx.isPointInPath(0, 0, 'evenodd')"); 89 shouldBeTrue("ctx.isPointInPath(0, 0, 'evenodd')");
90 ctx.restore(); 90 ctx.restore();
91 91
92 debug("Check with non-invertible ctm.") 92 debug("Check with non-invertible ctm.")
93 ctx.save(); 93 ctx.save();
94 ctx.scale(0, 0); 94 ctx.scale(0, 0);
95 ctx.beginPath(); 95 ctx.beginPath();
96 ctx.rect(-10, -10, 20, 20); 96 ctx.rect(-10, -10, 20, 20);
97 shouldBeFalse("ctx.isPointInPath(0, 0, 'nonzero')"); 97 shouldBeFalse("ctx.isPointInPath(0, 0, 'nonzero')");
98 shouldBeFalse("ctx.isPointInPath(0, 0, 'evenodd')"); 98 shouldBeFalse("ctx.isPointInPath(0, 0, 'evenodd')");
99 ctx.restore(); 99 ctx.restore();
100 } 100 }
101 101
102 // Run test and allow variation of results. 102 // Run test and allow variation of results.
103 prepareTestScenario(); 103 prepareTestScenario();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698