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

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

Issue 170503002: Implement addPath() method for Path object (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
(Empty)
1 description("Test addPath() method.");
2 var ctx = document.createElement('canvas').getContext('2d');
3
4 debug("Test addPath() with transform as identity matrix.")
5 ctx.beginPath();
6 var p1 = new Path();
7 p1.rect(0,0,100,100);
8 var p2 = new Path();
9 p2.rect(0,100,100,100);
10 var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
11 var m = svgElement.createSVGMatrix();
Justin Novosad 2014/02/18 16:09:29 simpler way to create an SVGMatrix: var m = ctx.c
pals 2014/02/19 11:47:22 Done.
12 p1.addPath(p2, m);
13 ctx.fillStyle = 'yellow';
14 ctx.currentPath = p1;
15 ctx.fill();
16 var imageData = ctx.getImageData(0, 100, 100, 100);
17 var imgdata = imageData.data;
18 shouldBe("imgdata[4]", "255");
19 shouldBe("imgdata[5]", "255");
20 shouldBe("imgdata[6]", "0");
21 shouldBe("imgdata[7]", "255");
22 debug("");
23
24 debug("Test addPath() with transform as translate(100, -100).")
Justin Novosad 2014/02/18 16:09:29 Please add an additional test case where the trans
pals 2014/02/19 11:47:22 Done.
25 ctx.beginPath();
26 var p1 = new Path();
Justin Novosad 2014/02/18 16:09:29 re-declaration of existing variable.
pals 2014/02/19 11:47:22 Done.
27 p1.rect(0,0,100,100);
28 var p2 = new Path();
29 p2.rect(0,100,100,100);
30 var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
Justin Novosad 2014/02/18 16:09:29 No need to re-create this
pals 2014/02/19 11:47:22 Done.
31 var m = svgElement.createSVGMatrix();
32 m.a = 1; m.b = 0;
33 m.c = 0; m.d = 1;
34 m.e = 100; m.f = -100;
35 p1.addPath(p2, m);
36 ctx.fillStyle = 'yellow';
37 ctx.currentPath = p1;
38 ctx.fill();
39 var imageData = ctx.getImageData(100, 0, 100, 100);
40 var imgdata = imageData.data;
41 shouldBe("imgdata[4]", "255");
42 shouldBe("imgdata[5]", "255");
43 shouldBe("imgdata[6]", "0");
44 shouldBe("imgdata[7]", "255");
45 debug("");
46
47 debug("Test addPath() with transform as null.")
48 var p1 = new Path();
49 p1.rect(0,0,100,100);
50 var p2 = new Path();
51 shouldThrow("p1.addPath(p2, null)");
Justin Novosad 2014/02/18 16:09:29 According to the spec, the transform is a nullable
pals 2014/02/19 11:47:22 The addPath idl changes generates following code
52 debug("");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698