context-creation-offscreen.html (819B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Canvas's ImageBitmapRenderingContext test</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#the-imagebitmap-rendering-context"> 7 <script> 8 test(function() { 9 var width = 10; 10 var height = 10; 11 var canvas = new OffscreenCanvas(width, height); 12 var ctx = canvas.getContext('bitmaprenderer'); 13 assert_true(ctx instanceof ImageBitmapRenderingContext); 14 assert_true("canvas" in ctx); 15 assert_equals(canvas, ctx.canvas); 16 }, "Test that canvas.getContext('bitmaprenderer') returns an instance of ImageBitmapRenderingContext and ctx.canvas on a ImageBitmapRenderingContext returns the original OffscreenCanvas"); 17 18 </script>