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.cap.butt</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.cap.butt</h1> |
| 9 <p class="desc">lineCap 'butt' is rendered correctly</p> |
| 10 |
| 11 |
| 12 <script> |
| 13 var t = async_test("lineCap 'butt' 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 ctx.lineCap = 'butt'; |
| 22 ctx.lineWidth = 20; |
| 23 ctx.fillStyle = '#f00'; |
| 24 ctx.strokeStyle = '#0f0'; |
| 25 ctx.fillRect(15, 15, 20, 20); |
| 26 ctx.beginPath(); |
| 27 ctx.moveTo(25, 15); |
| 28 ctx.lineTo(25, 35); |
| 29 ctx.stroke(); |
| 30 ctx.fillStyle = '#0f0'; |
| 31 ctx.strokeStyle = '#f00'; |
| 32 ctx.beginPath(); |
| 33 ctx.moveTo(75, 15); |
| 34 ctx.lineTo(75, 35); |
| 35 ctx.stroke(); |
| 36 ctx.fillRect(65, 15, 20, 20); |
| 37 _assertPixel(offscreenCanvas, 25,14, 0,255,0,255, "25,14", "0,255,0,255"); |
| 38 _assertPixel(offscreenCanvas, 25,15, 0,255,0,255, "25,15", "0,255,0,255"); |
| 39 _assertPixel(offscreenCanvas, 25,16, 0,255,0,255, "25,16", "0,255,0,255"); |
| 40 _assertPixel(offscreenCanvas, 25,34, 0,255,0,255, "25,34", "0,255,0,255"); |
| 41 _assertPixel(offscreenCanvas, 25,35, 0,255,0,255, "25,35", "0,255,0,255"); |
| 42 _assertPixel(offscreenCanvas, 25,36, 0,255,0,255, "25,36", "0,255,0,255"); |
| 43 _assertPixel(offscreenCanvas, 75,14, 0,255,0,255, "75,14", "0,255,0,255"); |
| 44 _assertPixel(offscreenCanvas, 75,15, 0,255,0,255, "75,15", "0,255,0,255"); |
| 45 _assertPixel(offscreenCanvas, 75,16, 0,255,0,255, "75,16", "0,255,0,255"); |
| 46 _assertPixel(offscreenCanvas, 75,34, 0,255,0,255, "75,34", "0,255,0,255"); |
| 47 _assertPixel(offscreenCanvas, 75,35, 0,255,0,255, "75,35", "0,255,0,255"); |
| 48 _assertPixel(offscreenCanvas, 75,36, 0,255,0,255, "75,36", "0,255,0,255"); |
| 49 |
| 50 t.done(); |
| 51 |
| 52 }); |
| 53 </script> |
OLD | NEW |