2d.layer.exceptions-are-no-op.tentative.html (1330B)
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>Canvas test: 2d.layer.exceptions-are-no-op.tentative</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 <link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css"> 9 <body class="show_output"> 10 11 <h1>2d.layer.exceptions-are-no-op.tentative</h1> 12 <p class="desc">Checks that the context state is left unchanged if beginLayer throws.</p> 13 14 15 <p class="output">Actual output:</p> 16 <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> 17 18 <ul id="d"></ul> 19 <script> 20 test(t => { 21 var canvas = document.getElementById('c'); 22 var ctx = canvas.getContext('2d'); 23 24 // Get `beginLayer` to throw while parsing the filter. 25 assert_throws_js(TypeError, 26 () => ctx.beginLayer({filter: {name: 'colorMatrix', 27 values: 'foo'}})); 28 // `beginLayer` shouldn't have opened the layer, so `endLayer` should throw. 29 assert_throws_dom("InvalidStateError", () => ctx.endLayer()); 30 31 }, "Checks that the context state is left unchanged if beginLayer throws."); 32 </script>