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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-pattern-transform.js

Issue 2689243002: 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("Series of tests to ensure correct behaviour on transform of a patte rn");
2 var canvas2 = document.createElement('canvas');
3 canvas2.width = 100;
4 canvas2.height = 100;
5 var ctx2 = canvas2.getContext('2d');
6 ctx2.fillStyle = '#0f0';
7 ctx2.fillRect(0, 0, 50, 50);
8 ctx2.fillRect(50, 50, 50, 50);
9 ctx2.fillStyle = '#f00';
10 ctx2.fillRect(50, 0, 50, 50);
11 ctx2.fillRect(0, 50, 50, 50);
12
13 var ctx = document.createElement('canvas').getContext('2d');
14
15 ctx.save();
16 ctx.transform(2, 0, 0, 2, 0, 0);
17 var pattern = ctx.createPattern(canvas2, 'repeat');
18 ctx.fillStyle = pattern;
19 ctx.fillRect(0,0,100,100);
20 ctx.restore();
21
22 ctx.save();
23 ctx.transform(0.5, 0, 0, 0.5, 0, 0);
24 pattern = ctx.createPattern(canvas2, 'repeat');
25 ctx.fillStyle = pattern;
26 ctx.fillRect(0,0,100,100);
27 ctx.restore();
28
29 var imageData = ctx.getImageData(26, 26, 74, 74);
30 var imgdata = imageData.data;
31 shouldBe("imgdata[4]", "0");
32 shouldBe("imgdata[5]", "255");
33 shouldBe("imgdata[6]", "0");
34 imageData = ctx.getImageData(25, 0, 25, 25);
35 imgdata = imageData.data;
36 shouldBe("imgdata[4]", "255");
37 shouldBe("imgdata[5]", "0");
38 shouldBe("imgdata[6]", "0");
39 imageData = ctx.getImageData(0, 0, 25, 25);
40 imgdata = imageData.data;
41 shouldBe("imgdata[4]", "0");
42 shouldBe("imgdata[5]", "255");
43 shouldBe("imgdata[6]", "0");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698