| <!DOCTYPE html> |
| <!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> |
| <title>Canvas test: 2d.drawImage.zerocanvas</title> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="/2dcontext/resources/canvas-tests.js"></script> |
| <link rel="stylesheet" href="/2dcontext/resources/canvas-tests.css"> |
| <body class="show_output"> |
| |
| <h1>2d.drawImage.zerocanvas</h1> |
| <p class="desc">drawImage with zero-sized canvas as the source shoud throw exception</p> |
| |
| |
| <p class="output">Actual output:</p> |
| <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> |
| |
| <ul id="d"></ul> |
| <script> |
| var t = async_test("drawImage with zero-sized canvas as the source shoud throw exception"); |
| _addTest(function(canvas, ctx) { |
| |
| var canvas2 = document.createElement('canvas'); |
| canvas2.width = 0; |
| canvas2.height = 50; |
| assert_throws("INVALID_STATE_ERR", function() { ctx.drawImage(canvas2, 0, 0); }); |
| |
| canvas2.width = 50; |
| canvas2.height = 0; |
| assert_throws("INVALID_STATE_ERR", function() { ctx.drawImage(canvas2, 0, 0); }); |
| |
| canvas2.width = 0; |
| canvas2.height = 0; |
| assert_throws("INVALID_STATE_ERR", function() { ctx.drawImage(canvas2, 0, 0); }); |
| |
| |
| }); |
| </script> |
| |