2d.reset.state.global_composite_operation.html (1112B)
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.reset.state.global_composite_operation</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.reset.state.global_composite_operation</h1> 10 <p class="desc">check that the state is reset</p> 11 12 13 <script> 14 var t = async_test("check that the state is reset"); 15 var t_pass = t.done.bind(t); 16 var t_fail = t.step_func(function(reason) { 17 throw reason; 18 }); 19 t.step(function() { 20 21 var canvas = new OffscreenCanvas(100, 50); 22 var ctx = canvas.getContext('2d'); 23 24 const default_value = ctx.globalCompositeOperation; 25 26 ctx.globalCompositeOperation = 'destination-over'; 27 _assert(ctx.globalCompositeOperation == 'destination-over', "ctx.globalCompositeOperation == 'destination-over'"); 28 29 ctx.reset(); 30 _assert(ctx.globalCompositeOperation == default_value, "ctx.globalCompositeOperation == default_value"); 31 t.done(); 32 33 }); 34 </script>