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

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

Issue 232913004: Use StrictTypeChecking for methods on CRC2D that accepts Path2D (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update some more expectations. Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 description("Test addPath() method."); 1 description("Test addPath() method.");
2 var canvas = document.createElement('canvas'); 2 var canvas = document.createElement('canvas');
3 var ctx = canvas.getContext('2d'); 3 var ctx = canvas.getContext('2d');
4 4
5 debug("Test addPath() with transform as identity matrix.") 5 debug("Test addPath() with transform as identity matrix.")
6 ctx.clearRect(0, 0, canvas.width, canvas.height); 6 ctx.clearRect(0, 0, canvas.width, canvas.height);
7 ctx.beginPath(); 7 ctx.beginPath();
8 var p1 = new Path2D(); 8 var p1 = new Path2D();
9 p1.rect(0,0,100,100); 9 p1.rect(0,0,100,100);
10 var p2 = new Path2D(); 10 var p2 = new Path2D();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 debug(""); 67 debug("");
68 68
69 debug("Test addPath() with transform as null or invalid type.") 69 debug("Test addPath() with transform as null or invalid type.")
70 ctx.clearRect(0, 0, canvas.width, canvas.height); 70 ctx.clearRect(0, 0, canvas.width, canvas.height);
71 ctx.beginPath(); 71 ctx.beginPath();
72 var p7 = new Path2D(); 72 var p7 = new Path2D();
73 p7.rect(0,0,100,100); 73 p7.rect(0,0,100,100);
74 var p8 = new Path2D(); 74 var p8 = new Path2D();
75 p8.rect(100,100,100,100); 75 p8.rect(100,100,100,100);
76 p7.addPath(p8, null); 76 p7.addPath(p8, null);
77 p7.addPath(p8, []); 77 shouldThrow("p7.addPath(p8, [])");
78 p7.addPath(p8, {}); 78 shouldThrow("p7.addPath(p8, {})");
79 ctx.fillStyle = 'red'; 79 ctx.fillStyle = 'red';
80 ctx.currentPath = p7; 80 ctx.currentPath = p7;
81 ctx.fill(); 81 ctx.fill();
82 imageData = ctx.getImageData(100, 100, 100, 100); 82 imageData = ctx.getImageData(100, 100, 100, 100);
83 imgdata = imageData.data; 83 imgdata = imageData.data;
84 shouldBe("imgdata[4]", "255"); 84 shouldBe("imgdata[4]", "255");
85 shouldBe("imgdata[5]", "0"); 85 shouldBe("imgdata[5]", "0");
86 shouldBe("imgdata[6]", "0"); 86 shouldBe("imgdata[6]", "0");
87 shouldBe("imgdata[7]", "255"); 87 shouldBe("imgdata[7]", "255");
88 debug(""); 88 debug("");
(...skipping 16 matching lines...) Expand all
105 shouldBe("imgdata[3]", "255"); 105 shouldBe("imgdata[3]", "255");
106 debug(""); 106 debug("");
107 107
108 debug("Test addPath() with path as null and invalid type"); 108 debug("Test addPath() with path as null and invalid type");
109 var p9 = new Path2D(); 109 var p9 = new Path2D();
110 p9.rect(0,0,100,100); 110 p9.rect(0,0,100,100);
111 shouldThrow("p7.addPath(null, m)"); 111 shouldThrow("p7.addPath(null, m)");
112 shouldThrow("p7.addPath([], m)"); 112 shouldThrow("p7.addPath([], m)");
113 shouldThrow("p7.addPath({}, m)"); 113 shouldThrow("p7.addPath({}, m)");
114 debug(""); 114 debug("");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698