blob: fa74c0e4be4cf1433fc98e482ac3086fa687306d [file] [log] [blame]
<!DOCTYPE html>
<title>Canvas test: 2d.drawImage.wrongtype</title>
<script src="../tests.js"></script>
<link rel="stylesheet" href="../tests.css">
<body>
<p id="passtext">Pass</p>
<p id="failtext">Fail</p>
<p class="output">These images should be identical:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
_addTest(function(canvas, ctx) {
try { var _thrown = false;
ctx.drawImage(undefined, 0, 0);
} catch (e) { if (!(e instanceof TypeError)) _fail("Failed assertion: expected exception of type TypeError, got: "+e); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TypeError: ctx.drawImage(undefined, 0, 0)"); }
try { var _thrown = false;
ctx.drawImage(0, 0, 0);
} catch (e) { if (!(e instanceof TypeError)) _fail("Failed assertion: expected exception of type TypeError, got: "+e); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TypeError: ctx.drawImage(0, 0, 0)"); }
try { var _thrown = false;
ctx.drawImage("", 0, 0);
} catch (e) { if (!(e instanceof TypeError)) _fail("Failed assertion: expected exception of type TypeError, got: "+e); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TypeError: ctx.drawImage(\"\", 0, 0)"); }
try { var _thrown = false;
ctx.drawImage(document.createElement('p'), 0, 0);
} catch (e) { if (!(e instanceof TypeError)) _fail("Failed assertion: expected exception of type TypeError, got: "+e); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TypeError: ctx.drawImage(document.createElement('p'), 0, 0)"); }
});
</script>