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

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

Issue 2343793002: Convert fast/canvas Layouttests to testharness (Closed)
Patch Set: Refactor3 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 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 // Bug: https://bugs.webkit.org/show_bug.cgi?id=26436.
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 var expectedValue = [0, 255, 0, 255];
40 assert_array_equals(pixel, expectedValue);
41 });
42 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698