OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Canvas test: 2d.drawImage.null</title> | 2 <title>Canvas test: 2d.drawImage.null</title> |
3 <script src="../tests.js"></script> | 3 <script src="../tests.js"></script> |
4 <link rel="stylesheet" href="../tests.css"> | 4 <link rel="stylesheet" href="../tests.css"> |
5 <body> | 5 <body> |
6 <p id="passtext">Pass</p> | 6 <p id="passtext">Pass</p> |
7 <p id="failtext">Fail</p> | 7 <p id="failtext">Fail</p> |
8 <p class="output">These images should be identical:</p> | 8 <p class="output">These images should be identical:</p> |
9 <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (
fallback content)</p></canvas> | 9 <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (
fallback content)</p></canvas> |
10 | 10 |
11 <ul id="d"></ul> | 11 <ul id="d"></ul> |
12 <script> | 12 <script> |
13 _addTest(function(canvas, ctx) { | 13 _addTest(function(canvas, ctx) { |
14 | 14 |
15 try { var _thrown = false; | 15 try { var _thrown = false; |
16 ctx.drawImage(null, 0, 0); | 16 ctx.drawImage(null, 0, 0); |
17 } catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) _fail("Failed assert
ion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); _thrown =
true; } finally { _assert(_thrown, "should throw exception of type TYPE_MISMATCH
_ERR: ctx.drawImage(null, 0, 0)"); } | 17 } catch (e) { if (e.name != "TypeError") _fail("Failed assertion: expected excep
tion of type TypeError, got: "+e.name); _thrown = true; } finally { _assert(_thr
own, "should throw exception of type TypeError: ctx.drawImage(null, 0, 0)"); } |
18 | 18 |
19 | 19 |
20 }); | 20 }); |
21 </script> | 21 </script> |
22 | 22 |
OLD | NEW |