OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> |
| 3 <title>OffscreenCanvas test: 2d.line.join.bevel</title> |
| 4 <script src="/resources/testharness.js"></script> |
| 5 <script src="/resources/testharnessreport.js"></script> |
| 6 <script src="/common/canvas-tests.js"></script> |
| 7 |
| 8 <h1>2d.line.join.bevel</h1> |
| 9 <p class="desc">lineJoin 'bevel' is rendered correctly</p> |
| 10 |
| 11 |
| 12 <script> |
| 13 var t = async_test("lineJoin 'bevel' is rendered correctly"); |
| 14 t.step(function() { |
| 15 |
| 16 var offscreenCanvas = new OffscreenCanvas(100, 50); |
| 17 var ctx = offscreenCanvas.getContext('2d'); |
| 18 |
| 19 ctx.fillStyle = '#0f0'; |
| 20 ctx.fillRect(0, 0, 100, 50); |
| 21 var tol = 1; // tolerance to avoid antialiasing artifacts |
| 22 ctx.lineJoin = 'bevel'; |
| 23 ctx.lineWidth = 20; |
| 24 ctx.fillStyle = '#f00'; |
| 25 ctx.strokeStyle = '#0f0'; |
| 26 ctx.fillRect(10, 10, 20, 20); |
| 27 ctx.fillRect(20, 20, 20, 20); |
| 28 ctx.beginPath(); |
| 29 ctx.moveTo(30, 20); |
| 30 ctx.lineTo(40-tol, 20); |
| 31 ctx.lineTo(30, 10+tol); |
| 32 ctx.fill(); |
| 33 ctx.beginPath(); |
| 34 ctx.moveTo(10, 20); |
| 35 ctx.lineTo(30, 20); |
| 36 ctx.lineTo(30, 40); |
| 37 ctx.stroke(); |
| 38 ctx.fillStyle = '#0f0'; |
| 39 ctx.strokeStyle = '#f00'; |
| 40 ctx.beginPath(); |
| 41 ctx.moveTo(60, 20); |
| 42 ctx.lineTo(80, 20); |
| 43 ctx.lineTo(80, 40); |
| 44 ctx.stroke(); |
| 45 ctx.fillRect(60, 10, 20, 20); |
| 46 ctx.fillRect(70, 20, 20, 20); |
| 47 ctx.beginPath(); |
| 48 ctx.moveTo(80, 20); |
| 49 ctx.lineTo(90+tol, 20); |
| 50 ctx.lineTo(80, 10-tol); |
| 51 ctx.fill(); |
| 52 _assertPixel(offscreenCanvas, 34,16, 0,255,0,255, "34,16", "0,255,0,255"); |
| 53 _assertPixel(offscreenCanvas, 34,15, 0,255,0,255, "34,15", "0,255,0,255"); |
| 54 _assertPixel(offscreenCanvas, 35,15, 0,255,0,255, "35,15", "0,255,0,255"); |
| 55 _assertPixel(offscreenCanvas, 36,15, 0,255,0,255, "36,15", "0,255,0,255"); |
| 56 _assertPixel(offscreenCanvas, 36,14, 0,255,0,255, "36,14", "0,255,0,255"); |
| 57 _assertPixel(offscreenCanvas, 84,16, 0,255,0,255, "84,16", "0,255,0,255"); |
| 58 _assertPixel(offscreenCanvas, 84,15, 0,255,0,255, "84,15", "0,255,0,255"); |
| 59 _assertPixel(offscreenCanvas, 85,15, 0,255,0,255, "85,15", "0,255,0,255"); |
| 60 _assertPixel(offscreenCanvas, 86,15, 0,255,0,255, "86,15", "0,255,0,255"); |
| 61 _assertPixel(offscreenCanvas, 86,14, 0,255,0,255, "86,14", "0,255,0,255"); |
| 62 |
| 63 t.done(); |
| 64 |
| 65 }); |
| 66 </script> |
OLD | NEW |