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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-copyPixels.html

Issue 2675763005: 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
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <script src="../../resources/testharness.js"></script>
2 <html> 2 <script src="../../resources/testharnessreport.js"></script>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body> 3 <body>
7 <script src="script-tests/canvas-copyPixels.js"></script> 4 <script>
5 test(function(t) {
6 var ctx = document.createElement('canvas').getContext('2d');
7
8 ctx.fillStyle = "red";
9 ctx.fillRect(0,0,50,20);
10 ctx.fillStyle = "green";
11 ctx.fillRect(50,0,50,20);
12 ctx.fillStyle = "blue";
13 ctx.fillRect(100,0,50,20);
14
15 var data = ctx.getImageData(0,0,150,20);
16 ctx.putImageData(data, 0, 20);
17
18 var imageData = ctx.getImageData(1, 21, 48, 18);
19 var imgdata = imageData.data;
20 assert_equals(imgdata[4], 255);
21 assert_equals(imgdata[5], 0);
22 assert_equals(imgdata[6], 0);
23
24 imageData = ctx.getImageData(51, 21, 48, 18);
25 imgdata = imageData.data;
26 assert_equals(imgdata[4], 0);
27 assert_equals(imgdata[5], 128);
28 assert_equals(imgdata[6], 0);
29
30 imageData = ctx.getImageData(101, 21, 48, 18);
31 imgdata = imageData.data;
32 assert_equals(imgdata[4], 0);
33 assert_equals(imgdata[5], 0);
34 assert_equals(imgdata[6], 255);
35 }, "Test if putImageData gives back the same result as getImageData");
36 </script>
8 </body> 37 </body>
9 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698