OLD | NEW |
| (Empty) |
1 // DO NOT EDIT! This test has been generated by tools/gentest.py. | |
2 // OffscreenCanvas test in a worker:2d.gradient.radial.cone.shape2 | |
3 // Description: | |
4 // Note: | |
5 | |
6 importScripts("/resources/testharness.js"); | |
7 importScripts("/common/canvas-tests.js"); | |
8 | |
9 var t = async_test(""); | |
10 t.step(function() { | |
11 | |
12 var offscreenCanvas = new OffscreenCanvas(100, 50); | |
13 var ctx = offscreenCanvas.getContext('2d'); | |
14 | |
15 var tol = 1; // tolerance to avoid antialiasing artifacts | |
16 ctx.fillStyle = '#0f0'; | |
17 ctx.fillRect(0, 0, 100, 50); | |
18 var g = ctx.createRadialGradient(30+10*5/2, 40, 10*3/2, 30+10*15/4, 40, 10*9/4); | |
19 g.addColorStop(0, '#f00'); | |
20 g.addColorStop(1, '#f00'); | |
21 ctx.fillStyle = g; | |
22 ctx.fillRect(0, 0, 100, 50); | |
23 ctx.fillStyle = '#0f0'; | |
24 ctx.beginPath(); | |
25 ctx.moveTo(30-tol, 40); | |
26 ctx.lineTo(110, -20-tol); | |
27 ctx.lineTo(110, 100+tol); | |
28 ctx.fill(); | |
29 _assertPixel(offscreenCanvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); | |
30 _assertPixel(offscreenCanvas, 50,1, 0,255,0,255, "50,1", "0,255,0,255"); | |
31 _assertPixel(offscreenCanvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); | |
32 _assertPixel(offscreenCanvas, 1,25, 0,255,0,255, "1,25", "0,255,0,255"); | |
33 _assertPixel(offscreenCanvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); | |
34 _assertPixel(offscreenCanvas, 98,25, 0,255,0,255, "98,25", "0,255,0,255"); | |
35 _assertPixel(offscreenCanvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); | |
36 _assertPixel(offscreenCanvas, 50,48, 0,255,0,255, "50,48", "0,255,0,255"); | |
37 _assertPixel(offscreenCanvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); | |
38 | |
39 t.done(); | |
40 | |
41 }); | |
42 done(); | |
OLD | NEW |