| OLD | NEW |
| (Empty) |
| 1 // DO NOT EDIT! This test has been generated by tools/gentest.py. | |
| 2 // OffscreenCanvas test in a worker:2d.line.cap.square | |
| 3 // Description:lineCap 'square' is rendered correctly | |
| 4 // Note: | |
| 5 | |
| 6 importScripts("/resources/testharness.js"); | |
| 7 importScripts("/common/canvas-tests.js"); | |
| 8 | |
| 9 var t = async_test("lineCap 'square' 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 ctx.lineCap = 'square'; | |
| 18 ctx.lineWidth = 20; | |
| 19 ctx.fillStyle = '#f00'; | |
| 20 ctx.strokeStyle = '#0f0'; | |
| 21 ctx.fillRect(15, 5, 20, 40); | |
| 22 ctx.beginPath(); | |
| 23 ctx.moveTo(25, 15); | |
| 24 ctx.lineTo(25, 35); | |
| 25 ctx.stroke(); | |
| 26 ctx.fillStyle = '#0f0'; | |
| 27 ctx.strokeStyle = '#f00'; | |
| 28 ctx.beginPath(); | |
| 29 ctx.moveTo(75, 15); | |
| 30 ctx.lineTo(75, 35); | |
| 31 ctx.stroke(); | |
| 32 ctx.fillRect(65, 5, 20, 40); | |
| 33 _assertPixel(offscreenCanvas, 25,4, 0,255,0,255, "25,4", "0,255,0,255"); | |
| 34 _assertPixel(offscreenCanvas, 25,5, 0,255,0,255, "25,5", "0,255,0,255"); | |
| 35 _assertPixel(offscreenCanvas, 25,6, 0,255,0,255, "25,6", "0,255,0,255"); | |
| 36 _assertPixel(offscreenCanvas, 25,44, 0,255,0,255, "25,44", "0,255,0,255"); | |
| 37 _assertPixel(offscreenCanvas, 25,45, 0,255,0,255, "25,45", "0,255,0,255"); | |
| 38 _assertPixel(offscreenCanvas, 25,46, 0,255,0,255, "25,46", "0,255,0,255"); | |
| 39 _assertPixel(offscreenCanvas, 75,4, 0,255,0,255, "75,4", "0,255,0,255"); | |
| 40 _assertPixel(offscreenCanvas, 75,5, 0,255,0,255, "75,5", "0,255,0,255"); | |
| 41 _assertPixel(offscreenCanvas, 75,6, 0,255,0,255, "75,6", "0,255,0,255"); | |
| 42 _assertPixel(offscreenCanvas, 75,44, 0,255,0,255, "75,44", "0,255,0,255"); | |
| 43 _assertPixel(offscreenCanvas, 75,45, 0,255,0,255, "75,45", "0,255,0,255"); | |
| 44 _assertPixel(offscreenCanvas, 75,46, 0,255,0,255, "75,46", "0,255,0,255"); | |
| 45 | |
| 46 t.done(); | |
| 47 | |
| 48 }); | |
| 49 done(); | |
| OLD | NEW |