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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-set-properties-with-non-invertible-ctm.js

Issue 2693193003: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Addressing comments Created 3 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("Tests to make sure we can assign to non-ctm effected properties wit h a non-invertible ctm set");
2 var canvas = document.createElement("canvas");
3 canvas.width = 100;
4 canvas.height = 100;
5 var ctx = canvas.getContext('2d');
6 document.body.appendChild(canvas);
7
8 function testPixel(x,y, r, g, b) {
9 imageData = ctx.getImageData(x, y, 1, 1);
10 shouldBe("imageData.data[0]", ""+r);
11 shouldBe("imageData.data[1]", ""+g);
12 shouldBe("imageData.data[2]", ""+b);
13 }
14
15 // Test our ability to set fillStyle
16 ctx.save();
17 ctx.scale(0, 0);
18 ctx.fillStyle = "green";
19 shouldBe('ctx.fillStyle', '"#008000"');
20 ctx.setTransform(1, 0, 0, 1, 0, 0);
21 ctx.fillRect(0,0,100,100);
22 testPixel(50, 50, 0, 128, 0);
23 ctx.restore();
24
25 // Test our ability to set strokeStyle
26 ctx.save();
27 ctx.fillStyle = "red";
28 ctx.fillRect(0,0,100,100);
29 ctx.scale(0, 0);
30 ctx.strokeStyle = "green";
31 shouldBe('ctx.strokeStyle', '"#008000"');
32 ctx.lineWidth = 100;
33 ctx.setTransform(1, 0, 0, 1, 0, 0);
34 ctx.strokeRect(0,0,100,100);
35 testPixel(50, 50, 0, 128, 0);
36 ctx.restore();
37
38
39 // test closePath
40 ctx.save();
41 ctx.fillStyle = "red";
42 ctx.fillRect(0,0,100,100);
43
44 ctx.beginPath();
45 ctx.strokeStyle = "green";
46 ctx.lineWidth = 100;
47 ctx.moveTo(-100, 50);
48 ctx.lineTo(-100, -100);
49 ctx.lineTo( 200, -100);
50 ctx.lineTo( 200, 50);
51 ctx.scale(0, 0);
52 ctx.closePath();
53 ctx.setTransform(1, 0, 0, 1, 0, 0);
54 ctx.stroke();
55 ctx.restore();
56 testPixel(50, 50, 0, 128, 0);
57
58 // Test beginPath behaviour
59 ctx.fillStyle = "green";
60 ctx.fillRect(0,0,100,100);
61 ctx.fillStyle = "red";
62 ctx.rect(0,0,100,100);
63 ctx.scale(0,0);
64 ctx.beginPath();
65 ctx.setTransform(1, 0, 0, 1, 0, 0);
66 ctx.fill();
67
68 testPixel(50, 50, 0, 128, 0);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698