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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-ellipse-360-winding.html

Issue 2674863003: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Addressing comments 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-ellipse-360-winding.js"></script> 4 <script>
5 test(function(t) {
6 var canvas = document.createElement('canvas');
7 document.body.appendChild(canvas)
8 canvas.setAttribute('width', '300');
9 canvas.setAttribute('height', '150');
10 var ctx = canvas.getContext('2d');
11
12 var r;
13 var anticlockwise = true;
14 ctx.beginPath();
15 for (r = 200; r >= 10; r -= 10) {
16 ctx.moveTo(150 + r, 75);
17 // Test that anticlockwise is both optional and defaults to false.
18 if (anticlockwise) {
19 ctx.ellipse(150, 75, r, r * 1.2, 0, 0, Math.PI * 2, anticlockwise);
20 } else {
21 ctx.ellipse(150, 75, r, r * 1.2, 0, 0, Math.PI * 2);
22 }
23 ctx.closePath();
24 anticlockwise = !anticlockwise;
25 }
26 ctx.fillStyle = 'rgba(0, 255, 0, 1)';
27 ctx.strokeStyle = 'rgba(0, 255, 0, 1)';
28 ctx.fill();
29 ctx.stroke();
30
31 var imageData = ctx.getImageData(297, 75, 1, 1);
32 var data = imageData.data;
33 assert_equals(data[1], 0);
34
35 imageData = ctx.getImageData(295, 144, 1, 1);
36 data = imageData.data;
37 assert_equals(data[1], 255);
38
39 imageData = ctx.getImageData(272, 144, 1, 1);
40 data = imageData.data;
41 assert_equals(data[1], 255);
42
43 imageData = ctx.getImageData(262, 144, 1, 1);
44 data = imageData.data;
45 assert_equals(data[1], 0);
46
47 imageData = ctx.getImageData(239, 144, 1, 1);
48 data = imageData.data;
49 assert_equals(data[1], 0);
50
51 imageData = ctx.getImageData(228, 144, 1, 1);
52 data = imageData.data;
53 assert_equals(data[1], 255);
54 }, "This tests canvas full arc fill with nonzero winding rule. Eight green conce ntric thick circumferences should be displayed.");
55 </script>
8 </body> 56 </body>
9 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698