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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/gradient-with-clip.html

Issue 2703803002: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Addressing comments Created 3 years, 9 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/gradient-with-clip.js"></script> 4 <script>
5
6 var canvas;
7 function fillWithColor(context, color) {
8 context.save();
9 context.fillStyle = color;
10 context.fillRect(0, 0, canvas.width, canvas.height);
11 context.restore();
12 }
13
14 test(function(t) {
15 canvas = document.createElement("canvas");
16 canvas.height = 100;
17 canvas.width = 100;
18 canvas.style.height = "100";
19 canvas.style.width = "100";
20
21 document.body.appendChild(canvas);
22
23 var greenImage = document.createElement("canvas");
24 greenImage.height = 10;
25 greenImage.width = 10;
26 var greenCtx = greenImage.getContext('2d');
27 fillWithColor(greenCtx, "green");
28 var greenPixel = greenCtx.getImageData(0, 0, 1, 1).data;
29
30 var ctx = canvas.getContext('2d');
31 var gradient = ctx.createLinearGradient(0, 0, 10, 0);
32 gradient.addColorStop(0, "blue");
33 gradient.addColorStop(1, "red");
34 ctx.fillStyle = gradient;
35 ctx.beginPath();
36 ctx.moveTo(0, 0);
37 ctx.lineTo(10, 5);
38 ctx.lineTo(10, 10);
39 ctx.lineTo(5, 10);
40 ctx.closePath();
41 ctx.fill();
42
43 ctx.fillStyle = "green";
44 ctx.fillRect(20, 20, 10, 10);
45
46 assert_array_equals(ctx.getImageData(20, 20, 1, 1).data, greenPixel);
47
48 }, "Test for canvas regression where gradient clips were not cleared https://bug s.webkit.org/show_bug.cgi?id=21498")
49 </script>
8 </body> 50 </body>
9 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698