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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-style-intact-after-text.html

Issue 2695963004: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: 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-style-intact-after-text.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, 1, 1);
10
11 assert_equals(ctx.fillStyle, '#ff0000');
12 var imageData = ctx.getImageData(0, 0, 2, 1).data;
13 assert_array_equals(imageData.slice(0,4), [255, 0, 0, 255]);
14 assert_array_equals(imageData.slice(4), [0, 0, 0, 0]);
15
16 ctx.strokeStyle = 'green';
17 ctx.lineWidth = 10;
18 ctx.fillStyle = 'red';
19 ctx.fillText("X", 0, 0);
20 assert_equals(ctx.strokeStyle, '#008000');
21 ctx.beginPath();
22 ctx.moveTo(0, 0);
23 ctx.lineTo(10, 10);
24 ctx.stroke();
25 imageData = ctx.getImageData(2, 2, 1, 1).data;
26 assert_array_equals(imageData, [0, 128, 0, 255]);
27
28 ctx.strokeStyle = 'red';
29 ctx.lineWidth = 100;
30 ctx.fillStyle = 'green';
31 ctx.strokeText("X", 0, 0);
32 assert_equals(ctx.fillStyle, '#008000');
33 ctx.fillRect(0, 0, 10, 10);
34 imageData = ctx.getImageData(2, 2, 1, 1).data;
35 assert_array_equals(imageData, [0, 128, 0, 255]);
36 }, "Test that the rendering context's strokeStyle and fillStyle are intact after calling strokeText() and fillText()");
37 </script>
8 </body> 38 </body>
9 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698