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

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

Issue 2343793002: Convert fast/canvas Layouttests to testharness (Closed)
Patch Set: Created 4 years, 3 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 <!DOCTYPE html>
2 <html> 2 <title>Test for chromium's canvas bug where fillText resets the current context< /title>
3 <head> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 </head> 5
6 <body> 6 <body></body>
7 <script src="script-tests/translate-text.js"></script> 7 <script>
8 </body> 8 test(function() {
9 </html> 9 function pixelToString(p) {
10 » return "[" + p[0] + ", " + p[1] + ", " + p[2] + ", " + p[3] + "]"
sivag 2016/09/15 05:31:14 maintain indentation
Abhishek Kanike 2016/09/15 11:52:56 Done.
11 }
12
13 var canvas = document.createElement("canvas");
14 canvas.height = 100;
15 canvas.width = 500;
16 canvas.style.height = "100";
17 canvas.style.width = "500";
18
19 document.body.appendChild(canvas);
20
21 var ctx = canvas.getContext('2d');
22 ctx.fillStyle = 'rgb(0,255,0)';
23 ctx.fillRect(0, 0, 500, 100);
24 ctx.fillStyle = 'rgb(0,0,0)';
25 ctx.fillText("This text should be seen", 20, 20);
26 ctx.translate(0, 50);
27 ctx.font = "10pt Arial";
28 ctx.fillText("This text should NOT be seen", 20, 20);
29 // If fillText resets the current context, this rectangle won't hide the tex t.
30 ctx.fillStyle = 'rgb(0,0,0)';
31 ctx.fillRect(0, 0, 500, 50);
32
33 » // Pixel value at 0, 0
sivag 2016/09/15 05:31:14 maintain indentation
Abhishek Kanike 2016/09/15 11:52:56 Done.
34 var imageData = ctx.getImageData(0, 0, 1, 1);
35 var pixel = imageData.data;
36
37 assert_equals(pixelToString(pixel), "[0, 255, 0, 255]");
38 });
39 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698