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

Side by Side Diff: LayoutTests/fast/canvas/script-tests/canvas-isPointInStroke-with-path.js

Issue 289283002: Add some layout tests about behavior on undefined and null. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 7 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("Test the behavior of isPointInStroke in Canvas with path object"); 1 description("Test the behavior of isPointInStroke in Canvas with path object");
2 var ctx = document.createElement('canvas').getContext('2d'); 2 var ctx = document.createElement('canvas').getContext('2d');
3 3
4 document.body.appendChild(ctx.canvas); 4 document.body.appendChild(ctx.canvas);
5 5
6 ctx.strokeStyle = '#0ff'; 6 ctx.strokeStyle = '#0ff';
7 7
8 // Create new path. 8 // Create new path.
9 var path = new Path2D(); 9 var path = new Path2D();
10 path.rect(20,20,100,100); 10 path.rect(20,20,100,100);
(...skipping 12 matching lines...) Expand all
23 shouldBeFalse("ctx.isPointInStroke(path,22,118)"); 23 shouldBeFalse("ctx.isPointInStroke(path,22,118)");
24 shouldBeFalse("ctx.isPointInStroke(path,118,118)"); 24 shouldBeFalse("ctx.isPointInStroke(path,118,118)");
25 shouldBeFalse("ctx.isPointInStroke(path,70,18)"); 25 shouldBeFalse("ctx.isPointInStroke(path,70,18)");
26 shouldBeFalse("ctx.isPointInStroke(path,122,70)"); 26 shouldBeFalse("ctx.isPointInStroke(path,122,70)");
27 shouldBeFalse("ctx.isPointInStroke(path,70,122)"); 27 shouldBeFalse("ctx.isPointInStroke(path,70,122)");
28 shouldBeFalse("ctx.isPointInStroke(path,18,70)"); 28 shouldBeFalse("ctx.isPointInStroke(path,18,70)");
29 shouldBeFalse("ctx.isPointInStroke(path,NaN,122)"); 29 shouldBeFalse("ctx.isPointInStroke(path,NaN,122)");
30 shouldBeFalse("ctx.isPointInStroke(path,18,NaN)"); 30 shouldBeFalse("ctx.isPointInStroke(path,18,NaN)");
31 debug(""); 31 debug("");
32 32
33 debug("Check null and invalid type"); 33 debug("Check invalid type");
34 shouldThrow("ctx.isPointInStroke(null,70,20)"); 34 shouldThrow("ctx.isPointInStroke(null,70,20)");
35 shouldThrow("ctx.isPointInStroke(undefined,70,20)");
35 shouldThrow("ctx.isPointInStroke([],20,70)"); 36 shouldThrow("ctx.isPointInStroke([],20,70)");
36 shouldThrow("ctx.isPointInStroke({},120,70)"); 37 shouldThrow("ctx.isPointInStroke({},120,70)");
37 debug(""); 38 debug("");
38 39
39 debug("Set lineWidth = 10.0"); 40 debug("Set lineWidth = 10.0");
40 ctx.lineWidth = 10; 41 ctx.lineWidth = 10;
41 shouldBeTrue("ctx.isPointInStroke(path,22,22)"); 42 shouldBeTrue("ctx.isPointInStroke(path,22,22)");
42 shouldBeTrue("ctx.isPointInStroke(path,118,22)"); 43 shouldBeTrue("ctx.isPointInStroke(path,118,22)");
43 shouldBeTrue("ctx.isPointInStroke(path,22,118)"); 44 shouldBeTrue("ctx.isPointInStroke(path,22,118)");
44 shouldBeTrue("ctx.isPointInStroke(path,118,118)"); 45 shouldBeTrue("ctx.isPointInStroke(path,118,118)");
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 shouldBeTrue("ctx.isPointInStroke(path,15,10)"); 99 shouldBeTrue("ctx.isPointInStroke(path,15,10)");
99 shouldBeFalse("ctx.isPointInStroke(path,25,10)"); 100 shouldBeFalse("ctx.isPointInStroke(path,25,10)");
100 shouldBeTrue("ctx.isPointInStroke(path,35,10)"); 101 shouldBeTrue("ctx.isPointInStroke(path,35,10)");
101 debug(""); 102 debug("");
102 103
103 debug("Check dashOffset = 10"); 104 debug("Check dashOffset = 10");
104 ctx.lineDashOffset = 10; 105 ctx.lineDashOffset = 10;
105 shouldBeFalse("ctx.isPointInStroke(path,15,10)"); 106 shouldBeFalse("ctx.isPointInStroke(path,15,10)");
106 shouldBeTrue("ctx.isPointInStroke(path,25,10)"); 107 shouldBeTrue("ctx.isPointInStroke(path,25,10)");
107 shouldBeFalse("ctx.isPointInStroke(path,35,10)"); 108 shouldBeFalse("ctx.isPointInStroke(path,35,10)");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698