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/script-tests/canvas-state-intact-after-putImageData.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("Test that the rendering context state is intact after a call to put ImageData()");
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 putImageData()");
21 ctx.putImageData(imageData, 1, 1);
22 imageData = ctx.getImageData(1, 1, 1, 1);
23 imgdata = imageData.data;
24 shouldBe("imgdata[0]", "255");
25 shouldBe("imgdata[1]", "0");
26 shouldBe("imgdata[2]", "0");
27 shouldBe("imgdata[3]", "255");
28
29 debug("Checking if state is intact");
30 shouldBe("ctx.fillStyle", "'#ff0000'");
31
32 ctx.fillRect(2, 2, 1, 1);
33 imageData = ctx.getImageData(2, 2, 1, 1);
34 imgdata = imageData.data;
35 shouldBe("imgdata[0]", "255");
36 shouldBe("imgdata[1]", "0");
37 shouldBe("imgdata[2]", "0");
38 shouldBe("imgdata[3]", "255");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698