OLD | NEW |
(Empty) | |
| 1 // DO NOT EDIT! This test has been generated by tools/gentest.py. |
| 2 // OffscreenCanvas test in a worker:2d.line.join.round |
| 3 // Description:lineJoin 'round' is rendered correctly |
| 4 // Note: |
| 5 |
| 6 importScripts("/resources/testharness.js"); |
| 7 importScripts("/common/canvas-tests.js"); |
| 8 |
| 9 var t = async_test("lineJoin 'round' is rendered correctly"); |
| 10 t.step(function() { |
| 11 |
| 12 var offscreenCanvas = new OffscreenCanvas(100, 50); |
| 13 var ctx = offscreenCanvas.getContext('2d'); |
| 14 |
| 15 ctx.fillStyle = '#0f0'; |
| 16 ctx.fillRect(0, 0, 100, 50); |
| 17 var tol = 1; // tolerance to avoid antialiasing artifacts |
| 18 ctx.lineJoin = 'round'; |
| 19 ctx.lineWidth = 20; |
| 20 ctx.fillStyle = '#f00'; |
| 21 ctx.strokeStyle = '#0f0'; |
| 22 ctx.fillRect(10, 10, 20, 20); |
| 23 ctx.fillRect(20, 20, 20, 20); |
| 24 ctx.beginPath(); |
| 25 ctx.moveTo(30, 20); |
| 26 ctx.arc(30, 20, 10-tol, 0, 2*Math.PI, true); |
| 27 ctx.fill(); |
| 28 ctx.beginPath(); |
| 29 ctx.moveTo(10, 20); |
| 30 ctx.lineTo(30, 20); |
| 31 ctx.lineTo(30, 40); |
| 32 ctx.stroke(); |
| 33 ctx.fillStyle = '#0f0'; |
| 34 ctx.strokeStyle = '#f00'; |
| 35 ctx.beginPath(); |
| 36 ctx.moveTo(60, 20); |
| 37 ctx.lineTo(80, 20); |
| 38 ctx.lineTo(80, 40); |
| 39 ctx.stroke(); |
| 40 ctx.fillRect(60, 10, 20, 20); |
| 41 ctx.fillRect(70, 20, 20, 20); |
| 42 ctx.beginPath(); |
| 43 ctx.moveTo(80, 20); |
| 44 ctx.arc(80, 20, 10+tol, 0, 2*Math.PI, true); |
| 45 ctx.fill(); |
| 46 _assertPixel(offscreenCanvas, 36,14, 0,255,0,255, "36,14", "0,255,0,255"); |
| 47 _assertPixel(offscreenCanvas, 36,13, 0,255,0,255, "36,13", "0,255,0,255"); |
| 48 _assertPixel(offscreenCanvas, 37,13, 0,255,0,255, "37,13", "0,255,0,255"); |
| 49 _assertPixel(offscreenCanvas, 38,13, 0,255,0,255, "38,13", "0,255,0,255"); |
| 50 _assertPixel(offscreenCanvas, 38,12, 0,255,0,255, "38,12", "0,255,0,255"); |
| 51 _assertPixel(offscreenCanvas, 86,14, 0,255,0,255, "86,14", "0,255,0,255"); |
| 52 _assertPixel(offscreenCanvas, 86,13, 0,255,0,255, "86,13", "0,255,0,255"); |
| 53 _assertPixel(offscreenCanvas, 87,13, 0,255,0,255, "87,13", "0,255,0,255"); |
| 54 _assertPixel(offscreenCanvas, 88,13, 0,255,0,255, "88,13", "0,255,0,255"); |
| 55 _assertPixel(offscreenCanvas, 88,12, 0,255,0,255, "88,12", "0,255,0,255"); |
| 56 |
| 57 t.done(); |
| 58 |
| 59 }); |
| 60 done(); |
OLD | NEW |