2d.pattern.paint.repeat.coord2.html (980B)
1 <!DOCTYPE html> 2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> 3 <meta charset="UTF-8"> 4 <title>OffscreenCanvas test: 2d.pattern.paint.repeat.coord2</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/html/canvas/resources/canvas-tests.js"></script> 8 9 <h1>2d.pattern.paint.repeat.coord2</h1> 10 <p class="desc"></p> 11 12 13 <script> 14 promise_test(async t => { 15 16 var canvas = new OffscreenCanvas(100, 50); 17 var ctx = canvas.getContext('2d'); 18 19 var response = await fetch('/images/ggrr-256x256.png') 20 var blob = await response.blob(); 21 var img = await createImageBitmap(blob); 22 var pattern = ctx.createPattern(img, 'repeat'); 23 ctx.fillStyle = pattern; 24 ctx.fillRect(0, 0, 100, 50); 25 26 _assertPixel(canvas, 1,1, 0,255,0,255); 27 _assertPixel(canvas, 98,1, 0,255,0,255); 28 _assertPixel(canvas, 1,48, 0,255,0,255); 29 _assertPixel(canvas, 98,48, 0,255,0,255); 30 31 }, ""); 32 </script>