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

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

Issue 2678493002: 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-fillPath-shadow.js"></script> 4 <script>
5 var greenApprox = 0;
6 function testPixelShadow(pixel, reference, shouldBeTransparent) {
7 assert_equals(pixel[0], reference[0]);
8 assert_approx_equals(pixel[1], reference[1], greenApprox);
9 assert_equals(pixel[2], reference[2]);
10 if(shouldBeTransparent)
11 assert_not_equals(pixel[3], 255);
12 }
13
14 var canvas = document.createElement('canvas');
15 document.body.appendChild(canvas);
16 canvas.setAttribute('width', '700');
17 canvas.setAttribute('height', '700');
18 var ctx = canvas.getContext('2d');
19
20 ctx.beginPath();
21 ctx.moveTo(300, 300);
22 ctx.lineTo(300, 50);
23 ctx.bezierCurveTo(200, 40, 75, 150, 30, 30);
24 ctx.quadraticCurveTo(250, 75, 50, 300);
25 ctx.shadowOffsetX = 350;
26 ctx.shadowColor = 'rgba(255, 20, 0, 0.5)';
27 ctx.shadowBlur = 0;
28 ctx.fillStyle = 'rgba(0, 0, 255, 1)';
29 ctx.lineWidth = 30;
30 ctx.fill();
31
32 ctx.beginPath();
33 ctx.moveTo(300,650);
34 ctx.lineTo(300,400);
35 ctx.bezierCurveTo(200, 390, 75, 500, 30, 380);
36 ctx.quadraticCurveTo(250, 425, 50, 650);
37 ctx.shadowOffsetX = 350;
38 ctx.shadowColor = 'rgba(255, 0, 0, 0.5)';
39 ctx.shadowBlur = 30;
40 ctx.fillStyle = 'rgba(0, 0, 255, 1)';
41 ctx.lineWidth = 30;
42 ctx.fill();
43
44 testScenarios =
45 [
46 ['TestSolidShadow 1', ctx.getImageData(640, 290, 1, 1).data, [ 255, 20, 0, 0], false],
47 ['TestSolidShadow 2', ctx.getImageData(570, 85, 1, 1).data, [ 255, 20, 0, 0], false],
48 ['TestSolidShadow 4', ctx.getImageData(400, 40, 1, 1).data, [ 255, 2 0, 0, 0], false],
49
50 ['TestBlurryShadow 1', ctx.getImageData(640, 640, 1, 1).data, [ 255, 0, 0, 0], true],
51 ['TestBlurryShadow 2', ctx.getImageData(650, 400, 1, 1).data, [ 255, 0, 0, 0], true],
52 ['TestBlurryShadow 3', ctx.getImageData(380, 380, 1, 1).data, [ 255, 0, 0, 0], true],
53 ['TestBlurryShadow 4', ctx.getImageData(375, 390, 1, 1).data, [ 255, 0, 0, 0], true]
54 ];
55
56 testScenarios2 =
57 [['TestSolidShadow 3', ctx.getImageData(380, 30, 1, 1).data, [ 255, 20, 0, 0], false]];
58
59 generate_tests(testPixelShadow, testScenarios);
60 greenApprox = 3;
61 generate_tests(testPixelShadow, testScenarios2);
62 </script>
8 </body> 63 </body>
9 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698