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

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: 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/canvas-strokeRect.js"></script> 4 <script>
5
6 var ctx = document.createElement('canvas').getContext('2d');
7 var canvas2 = document.createElement('canvas');
8 canvas2.width = 100;
9 canvas2.height = 100;
10 var ctx2 = canvas2.getContext('2d');
11
12 test(function(t) {
13 ctx.beginPath();
14 ctx.strokeStyle = 'green';
15 ctx.lineWidth = 100;
16 ctx.strokeRect(50, 0, 100, 100);
17 assert_array_equals(ctx.getImageData(2, 1, 1, 1).data.slice(0,3), [0, 128, 0 ]);
18 }, "Verify the correct behaviour of canvas.strokeRect() with solid green");
19
20 test(function(t) {
21 ctx.clearRect(0, 0, 100, 100);
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 }, "Verify the correct behaviour of canvas.strokeRect() with a pattern");
30
31 test(function(t) {
32 ctx.clearRect(0, 0, 100, 100);
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 }, "Verify the correct behaviour of canvas.strokeRect() with a gradient");
41
42 test(function(t) {
43 ctx.clearRect(0, 0, 100, 100);
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 }, "Verify the correct behaviour of canvas.strokeRect() with height = width = 0 and lineWidth = 2");
49
50 test(function(t) {
51 ctx.shadowOffsetX = 5;
52 ctx.shadowOffsetY = 5;
53 ctx.shadowColor = 'blue';
54 ctx.strokeStyle = 'red';
55 ctx.lineWidth = 2;
56 ctx.strokeRect(0, 0, 0, 0);
57 assert_array_equals(ctx.getImageData(0, 0, 1, 1).data.slice(0,3), [0, 0, 0]) ;
58 }, "Verify the correct behaviour of canvas.strokeRect() with height = width = 0 , lineWidth = 2, and shadow");
59
60 </script>
8 </body> 61 </body>
9 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698