OLD | NEW |
(Empty) | |
| 1 // DO NOT EDIT! This test has been generated by tools/gentest.py. |
| 2 // OffscreenCanvas test in a worker:2d.gradient.interpolate.overlap2 |
| 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 g = ctx.createLinearGradient(0, 0, 100, 0); |
| 16 var ps = [ 0, 1/10, 1/4, 1/3, 1/2, 3/4, 1 ]; |
| 17 for (var p = 0; p < ps.length; ++p) |
| 18 { |
| 19 g.addColorStop(ps[p], '#0f0'); |
| 20 for (var i = 0; i < 15; ++i) |
| 21 g.addColorStop(ps[p], '#f00'); |
| 22 g.addColorStop(ps[p], '#0f0'); |
| 23 } |
| 24 ctx.fillStyle = g; |
| 25 ctx.fillRect(0, 0, 100, 50); |
| 26 _assertPixel(offscreenCanvas, 1,25, 0,255,0,255, "1,25", "0,255,0,255"); |
| 27 _assertPixel(offscreenCanvas, 30,25, 0,255,0,255, "30,25", "0,255,0,255"); |
| 28 _assertPixel(offscreenCanvas, 40,25, 0,255,0,255, "40,25", "0,255,0,255"); |
| 29 _assertPixel(offscreenCanvas, 60,25, 0,255,0,255, "60,25", "0,255,0,255"); |
| 30 _assertPixel(offscreenCanvas, 80,25, 0,255,0,255, "80,25", "0,255,0,255"); |
| 31 |
| 32 t.done(); |
| 33 |
| 34 }); |
| 35 done(); |
OLD | NEW |