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

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

Issue 2690183006: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Corrections 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-strokeRect.js"></script> 4 <script>
5 test(function(t) {
6 var ctx = document.createElement('canvas').getContext('2d');
7
8 // stroke rect with solid green
9 ctx.beginPath();
10 ctx.strokeStyle = 'green';
11 ctx.lineWidth = 100;
12 ctx.strokeRect(50, 0, 100, 100);
13 assert_array_equals(ctx.getImageData(2, 1, 1, 1).data.slice(0,3), [0, 128, 0 ]);
Justin Novosad 2017/02/21 22:03:13 I see 5 individual tests here. Could you break thi
zakerinasab 2017/02/22 15:42:43 Done.
14
15 ctx.clearRect(0, 0, 100, 100);
16
17 // stroke rect with a pattern
18 var canvas2 = document.createElement('canvas');
19 canvas2.width = 100;
20 canvas2.height = 100;
21 var ctx2 = canvas2.getContext('2d');
22 ctx2.fillStyle = 'green';
23 ctx2.fillRect(0, 0, 100, 100);
24 var pattern = ctx.createPattern(canvas2, 'repeat');
25 ctx.strokeStyle = 'pattern';
26 ctx.lineWidth = 100;
27 ctx.strokeRect(50, 0, 100, 100);
28 assert_array_equals(ctx.getImageData(2, 1, 1, 1).data.slice(0,3), [0, 128, 0 ]);
29
30 ctx.clearRect(0, 0, 100, 100);
31
32 // stroke rect with gradient
33 var gradient = ctx.createLinearGradient(0, 0, 0, 100);
34 gradient.addColorStop(0, "green");
35 gradient.addColorStop(1, "green");
36 ctx.strokeStyle = 'gradient';
37 ctx.lineWidth = 100;
38 ctx.strokeRect(50, 0, 100, 100);
39 assert_array_equals(ctx.getImageData(2, 1, 1, 1).data.slice(0,3), [0, 128, 0 ]);
40
41 ctx.clearRect(0, 0, 100, 100);
42
43 // stroke rect with height = width = 0 and lineWidth = 2.
44 ctx.strokeStyle = 'red';
45 ctx.lineWidth = 2;
46 ctx.strokeRect(0, 0, 0, 0);
47 assert_array_equals(ctx.getImageData(0, 0, 1, 1).data.slice(0,3), [0, 0, 0]) ;
48
49 // stroke rect with height = width = 0, lineWidth = 2, and shadow.
50 ctx.shadowOffsetX = 5;
51 ctx.shadowOffsetY = 5;
52 ctx.shadowColor = 'blue';
53 ctx.strokeStyle = 'red';
54 ctx.lineWidth = 2;
55 ctx.strokeRect(0, 0, 0, 0);
56 assert_array_equals(ctx.getImageData(0, 0, 1, 1).data.slice(0,3), [0, 0, 0]) ;
57
58 }, "Series of tests to ensure correct behaviour of canvas.strokeRect()");
59
60 </script>
8 </body> 61 </body>
9 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698