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

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

Issue 2343793002: Convert fast/canvas Layouttests to testharness (Closed)
Patch Set: Convert fast/canvas Layouttests to testharness 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>
fs 2016/09/16 14:30:31 Maybe drop "chromium's" here.
Abhishek Kanike 2016/09/17 02:28:09 Done.
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 // Chromium Bug: https://bugs.webkit.org/show_bug.cgi?id=26436.
fs 2016/09/16 14:30:31 And "Chromium" here.
Abhishek Kanike 2016/09/17 02:28:10 Done.
9 </html> 9 // You must see green box with message 'This text should be seen',
10 // and black box below the green box.
11 test(function() {
12 function pixelToString(p) {
13 return "[" + p[0] + ", " + p[1] + ", " + p[2] + ", " + p[3] + "]"
14 }
15
16 var canvas = document.createElement("canvas");
17 canvas.height = 100;
18 canvas.width = 500;
19 canvas.style.height = "100";
20 canvas.style.width = "500";
21
22 document.body.appendChild(canvas);
23
24 var ctx = canvas.getContext('2d');
25 ctx.fillStyle = 'rgb(0,255,0)';
26 ctx.fillRect(0, 0, 500, 100);
27 ctx.fillStyle = 'rgb(0,0,0)';
28 ctx.fillText("This text should be seen", 20, 20);
29 ctx.translate(0, 50);
30 ctx.font = "10pt Arial";
31 ctx.fillText("This text should NOT be seen", 20, 20);
32 // If fillText resets the current context, this rectangle won't hide the tex t.
33 ctx.fillStyle = 'rgb(0,0,0)';
34 ctx.fillRect(0, 0, 500, 50);
35
36 // Pixel value at 0, 0
37 var pixel = ctx.getImageData(0, 0, 1, 1).data;
38
39 assert_equals(pixelToString(pixel), "[0, 255, 0, 255]");
fs 2016/09/16 14:30:31 assert_array_equals rather than going to string?
Abhishek Kanike 2016/09/17 02:28:09 Done.
40 });
41 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698