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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-style-intact-after-text.js

Issue 2695963004: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Fixing canvas-text-ideographic-space.html to pass on Mac trybots 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("Test that the rendering context's strokeStyle and fillStyle are int act after calling strokeText() and fillText()");
2 var ctx = document.createElement('canvas').getContext('2d');
3
4 ctx.fillStyle = 'red';
5 ctx.fillRect(0, 0, 1, 1);
6
7 debug("Checking initial state for sanity");
8 var imageData = ctx.getImageData(0, 0, 2, 1);
9 var imgdata = imageData.data;
10 shouldBe("ctx.fillStyle", "'#ff0000'");
11 shouldBe("imgdata[0]", "255");
12 shouldBe("imgdata[1]", "0");
13 shouldBe("imgdata[2]", "0");
14 shouldBe("imgdata[3]", "255");
15 shouldBe("imgdata[4]", "0");
16 shouldBe("imgdata[5]", "0");
17 shouldBe("imgdata[6]", "0");
18 shouldBe("imgdata[7]", "0");
19
20 debug("Calling fillText() to try and break the strokeStyle.");
21 ctx.strokeStyle = 'green';
22 ctx.lineWidth = 10;
23 ctx.fillStyle = 'red';
24 ctx.fillText("X", 0, 0);
25 shouldBe("ctx.strokeStyle", "'#008000'");
26 ctx.beginPath();
27 ctx.moveTo(0, 0);
28 ctx.lineTo(10, 10);
29 ctx.stroke();
30 imageData = ctx.getImageData(2, 2, 1, 1);
31 imgdata = imageData.data;
32 shouldBe("imgdata[0]", "0");
33 shouldBe("imgdata[1]", "128");
34 shouldBe("imgdata[2]", "0");
35 shouldBe("imgdata[3]", "255");
36
37 debug("Calling strokeText() to try and break the fillStyle.");
38 ctx.strokeStyle = 'red';
39 ctx.lineWidth = 100;
40 ctx.fillStyle = 'green';
41 ctx.strokeText("X", 0, 0);
42 shouldBe("ctx.fillStyle", "'#008000'");
43 ctx.fillRect(0, 0, 10, 10);
44 imageData = ctx.getImageData(2, 2, 1, 1);
45 imgdata = imageData.data;
46 shouldBe("imgdata[0]", "0");
47 shouldBe("imgdata[1]", "128");
48 shouldBe("imgdata[2]", "0");
49 shouldBe("imgdata[3]", "255");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698