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

Side by Side Diff: LayoutTests/fast/canvas/script-tests/canvas-arc-connecting-line.js

Issue 14298022: Add support for new canvas ellipse method. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make canvas-ellipse-360-winding.html for virtual/gpu pass. Created 7 years, 3 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 that canvas arc()s are connected by a straight line. There sho uld be two C-shapes with a line from the bottom of the left one to the top of th e right one."); 1 description("Test that canvas arc()s are connected by a straight line. There sho uld be two C-shapes with a line from the bottom of the left one to the top of th e right one.");
2 2
3 var canvas = document.createElement('canvas'); 3 var canvas = document.createElement('canvas');
4 document.body.appendChild(canvas) 4 document.body.appendChild(canvas)
5 canvas.setAttribute('width', '300'); 5 canvas.setAttribute('width', '300');
6 canvas.setAttribute('height', '300'); 6 canvas.setAttribute('height', '300');
7 var ctx = canvas.getContext('2d'); 7 var ctx = canvas.getContext('2d');
8 function deg2rad(x) {
9 return x * 3.141592653589 / 180;
10 }
11 ctx.fillStyle = '#0f0'; 8 ctx.fillStyle = '#0f0';
12 ctx.fillRect(0, 0, canvas.width, canvas.height); 9 ctx.fillRect(0, 0, canvas.width, canvas.height);
13 ctx.lineJoin = 'bevel'; 10 ctx.lineJoin = 'bevel';
14 ctx.lineWidth = 12; 11 ctx.lineWidth = 12;
15 ctx.beginPath(); 12 ctx.beginPath();
16 ctx.arc(200, 50, 40, deg2rad(90), deg2rad(-90), false); 13 ctx.arc(200, 50, 40, Math.PI / 2, -Math.PI / 2, false);
17 ctx.arc(100, 50, 40, deg2rad(90), deg2rad(-90), false); 14 ctx.arc(100, 50, 40, Math.PI / 2, -Math.PI / 2, false);
18 ctx.stroke(); 15 ctx.stroke();
19 16
20 var imageData = ctx.getImageData(0, 0, 1, 1); 17 var imageData = ctx.getImageData(0, 0, 1, 1);
21 var imgdata = imageData.data; 18 var imgdata = imageData.data;
22 shouldBe("imgdata[0]", "0"); 19 shouldBe("imgdata[0]", "0");
23 shouldBe("imgdata[1]", "255"); 20 shouldBe("imgdata[1]", "255");
24 shouldBe("imgdata[2]", "0"); 21 shouldBe("imgdata[2]", "0");
25 22
26 imageData = ctx.getImageData(125, 30, 1, 1); 23 imageData = ctx.getImageData(125, 30, 1, 1);
27 imgdata = imageData.data; 24 imgdata = imageData.data;
28 shouldBe("imgdata[0]", "0"); 25 shouldBe("imgdata[0]", "0");
29 shouldBe("imgdata[1]", "255"); 26 shouldBe("imgdata[1]", "255");
30 shouldBe("imgdata[2]", "0"); 27 shouldBe("imgdata[2]", "0");
31 28
32 imageData = ctx.getImageData(125, 70, 1, 1); 29 imageData = ctx.getImageData(125, 70, 1, 1);
33 imgdata = imageData.data; 30 imgdata = imageData.data;
34 shouldBe("imgdata[0]", "0"); 31 shouldBe("imgdata[0]", "0");
35 shouldBe("imgdata[1]", "0"); 32 shouldBe("imgdata[1]", "0");
36 shouldBe("imgdata[2]", "0"); 33 shouldBe("imgdata[2]", "0");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698