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

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

Issue 2676493005: 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!doctype html> 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-fill-rule.js"></script> 4 <script>
5
6 var tmpimg = document.createElement('canvas');
7 tmpimg.width = 200;
8 tmpimg.height = 200;
9 ctx = tmpimg.getContext('2d');
10
11 // Create the image for blending test with images.
12 var img = document.createElement('canvas');
13 img.width = 100;
14 img.height = 100;
15 var imgCtx = img.getContext('2d');
16
17 function checkResult(expectedColors, sigma) {
18 var pixel = ctx.getImageData(50, 50, 1, 1).data;
19 for (var i = 0; i < 4; i++)
20 assert_approx_equals(pixel[i], expectedColors[i], sigma);
21 }
22
23 test(function(t) {
24 // Testing default fill
25 ctx.fillStyle = 'rgb(255,0,0)';
26 ctx.beginPath();
27 ctx.fillRect(0, 0, 100, 100);
28 ctx.fillStyle = 'rgb(0,255,0)';
29 ctx.beginPath();
30 ctx.rect(0, 0, 100, 100);
31 ctx.rect(25, 25, 50, 50);
32 ctx.fill();
33 checkResult([0, 255, 0, 255], 5);
34
35 // Testing nonzero fill
36 ctx.fillStyle = 'rgb(255,0,0)';
37 ctx.beginPath();
38 ctx.fillRect(0, 0, 100, 100);
39 ctx.fillStyle = 'rgb(0,255,0)';
40 ctx.beginPath();
41 ctx.rect(0, 0, 100, 100);
42 ctx.rect(25, 25, 50, 50);
43 ctx.fill('nonzero');
44 checkResult([0, 255, 0, 255], 5);
45
46 // Testing evenodd fill
47 ctx.fillStyle = 'rgb(255,0,0)';
48 ctx.beginPath();
49 ctx.fillRect(0, 0, 100, 100);
50 ctx.fillStyle = 'rgb(0,255,0)';
51 ctx.beginPath();
52 ctx.rect(0, 0, 100, 100);
53 ctx.rect(25, 25, 50, 50);
54 ctx.fill('evenodd');
55 checkResult([255, 0, 0, 255], 5);
56 }, "Series of tests to ensure correct results of the winding rule.");
57 </script>
8 </body> 58 </body>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698