blob: dd0da29c2db592c61f5d3cf6c8cecb6c49aca247 [file] [log] [blame]
<!DOCTYPE html>
<title>Canvas test: 2d.missingargs</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.scale();
} 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.scale()"); }
try { var _thrown = false;
ctx.scale(1);
} 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.scale(1)"); }
try { var _thrown = false;
ctx.rotate();
} 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.rotate()"); }
try { var _thrown = false;
ctx.translate();
} 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.translate()"); }
try { var _thrown = false;
ctx.translate(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.translate(0)"); }
if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported)
try { var _thrown = false;
ctx.transform();
} 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.transform()"); }
try { var _thrown = false;
ctx.transform(1);
} 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.transform(1)"); }
try { var _thrown = false;
ctx.transform(1, 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.transform(1, 0)"); }
try { var _thrown = false;
ctx.transform(1, 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.transform(1, 0, 0)"); }
try { var _thrown = false;
ctx.transform(1, 0, 0, 1);
} 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.transform(1, 0, 0, 1)"); }
try { var _thrown = false;
ctx.transform(1, 0, 0, 1, 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.transform(1, 0, 0, 1, 0)"); }
}
if (ctx.setTransform) {
try { var _thrown = false;
ctx.setTransform(1);
} 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.setTransform(1)"); }
try { var _thrown = false;
ctx.setTransform(1, 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.setTransform(1, 0)"); }
try { var _thrown = false;
ctx.setTransform(1, 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.setTransform(1, 0, 0)"); }
try { var _thrown = false;
ctx.setTransform(1, 0, 0, 1);
} 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.setTransform(1, 0, 0, 1)"); }
try { var _thrown = false;
ctx.setTransform(1, 0, 0, 1, 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.setTransform(1, 0, 0, 1, 0)"); }
}
try { var _thrown = false;
ctx.createLinearGradient();
} 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.createLinearGradient()"); }
try { var _thrown = false;
ctx.createLinearGradient(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.createLinearGradient(0)"); }
try { var _thrown = false;
ctx.createLinearGradient(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.createLinearGradient(0, 0)"); }
try { var _thrown = false;
ctx.createLinearGradient(0, 0, 1);
} 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.createLinearGradient(0, 0, 1)"); }
try { var _thrown = false;
ctx.createRadialGradient();
} 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.createRadialGradient()"); }
try { var _thrown = false;
ctx.createRadialGradient(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.createRadialGradient(0)"); }
try { var _thrown = false;
ctx.createRadialGradient(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.createRadialGradient(0, 0)"); }
try { var _thrown = false;
ctx.createRadialGradient(0, 0, 1);
} 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.createRadialGradient(0, 0, 1)"); }
try { var _thrown = false;
ctx.createRadialGradient(0, 0, 1, 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.createRadialGradient(0, 0, 1, 0)"); }
try { var _thrown = false;
ctx.createRadialGradient(0, 0, 1, 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.createRadialGradient(0, 0, 1, 0, 0)"); }
try { var _thrown = false;
ctx.createPattern(canvas);
} 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.createPattern(canvas)"); }
try { var _thrown = false;
ctx.clearRect();
} 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.clearRect()"); }
try { var _thrown = false;
ctx.clearRect(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.clearRect(0)"); }
try { var _thrown = false;
ctx.clearRect(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.clearRect(0, 0)"); }
try { var _thrown = false;
ctx.clearRect(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.clearRect(0, 0, 0)"); }
try { var _thrown = false;
ctx.fillRect();
} 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.fillRect()"); }
try { var _thrown = false;
ctx.fillRect(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.fillRect(0)"); }
try { var _thrown = false;
ctx.fillRect(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.fillRect(0, 0)"); }
try { var _thrown = false;
ctx.fillRect(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.fillRect(0, 0, 0)"); }
try { var _thrown = false;
ctx.strokeRect();
} 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.strokeRect()"); }
try { var _thrown = false;
ctx.strokeRect(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.strokeRect(0)"); }
try { var _thrown = false;
ctx.strokeRect(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.strokeRect(0, 0)"); }
try { var _thrown = false;
ctx.strokeRect(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.strokeRect(0, 0, 0)"); }
try { var _thrown = false;
ctx.moveTo();
} 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.moveTo()"); }
try { var _thrown = false;
ctx.moveTo(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.moveTo(0)"); }
try { var _thrown = false;
ctx.lineTo();
} 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.lineTo()"); }
try { var _thrown = false;
ctx.lineTo(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.lineTo(0)"); }
try { var _thrown = false;
ctx.quadraticCurveTo();
} 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.quadraticCurveTo()"); }
try { var _thrown = false;
ctx.quadraticCurveTo(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.quadraticCurveTo(0)"); }
try { var _thrown = false;
ctx.quadraticCurveTo(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.quadraticCurveTo(0, 0)"); }
try { var _thrown = false;
ctx.quadraticCurveTo(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.quadraticCurveTo(0, 0, 0)"); }
try { var _thrown = false;
ctx.bezierCurveTo();
} 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.bezierCurveTo()"); }
try { var _thrown = false;
ctx.bezierCurveTo(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.bezierCurveTo(0)"); }
try { var _thrown = false;
ctx.bezierCurveTo(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.bezierCurveTo(0, 0)"); }
try { var _thrown = false;
ctx.bezierCurveTo(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.bezierCurveTo(0, 0, 0)"); }
try { var _thrown = false;
ctx.bezierCurveTo(0, 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.bezierCurveTo(0, 0, 0, 0)"); }
try { var _thrown = false;
ctx.bezierCurveTo(0, 0, 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.bezierCurveTo(0, 0, 0, 0, 0)"); }
try { var _thrown = false;
ctx.arcTo();
} 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.arcTo()"); }
try { var _thrown = false;
ctx.arcTo(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.arcTo(0)"); }
try { var _thrown = false;
ctx.arcTo(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.arcTo(0, 0)"); }
try { var _thrown = false;
ctx.arcTo(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.arcTo(0, 0, 0)"); }
try { var _thrown = false;
ctx.arcTo(0, 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.arcTo(0, 0, 0, 0)"); }
try { var _thrown = false;
ctx.rect();
} 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.rect()"); }
try { var _thrown = false;
ctx.rect(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.rect(0)"); }
try { var _thrown = false;
ctx.rect(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.rect(0, 0)"); }
try { var _thrown = false;
ctx.rect(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.rect(0, 0, 0)"); }
try { var _thrown = false;
ctx.arc();
} 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.arc()"); }
try { var _thrown = false;
ctx.arc(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.arc(0)"); }
try { var _thrown = false;
ctx.arc(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.arc(0, 0)"); }
try { var _thrown = false;
ctx.arc(0, 0, 1);
} 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.arc(0, 0, 1)"); }
try { var _thrown = false;
ctx.arc(0, 0, 1, 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.arc(0, 0, 1, 0)"); }
// (5th argument to arc is optional)
if (ctx.isPointInPath) {
try { var _thrown = false;
ctx.isPointInPath();
} 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.isPointInPath()"); }
try { var _thrown = false;
ctx.isPointInPath(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.isPointInPath(0)"); }
}
if (ctx.drawFocusRing) {
try { var _thrown = false;
ctx.drawFocusRing();
} 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.drawFocusRing()"); }
try { var _thrown = false;
ctx.drawFocusRing(canvas);
} 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.drawFocusRing(canvas)"); }
try { var _thrown = false;
ctx.drawFocusRing(canvas, 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.drawFocusRing(canvas, 0)"); }
}
if (ctx.fillText) {
try { var _thrown = false;
ctx.fillText();
} 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.fillText()"); }
try { var _thrown = false;
ctx.fillText('test');
} 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.fillText('test')"); }
try { var _thrown = false;
ctx.fillText('test', 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.fillText('test', 0)"); }
try { var _thrown = false;
ctx.strokeText();
} 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.strokeText()"); }
try { var _thrown = false;
ctx.strokeText('test');
} 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.strokeText('test')"); }
try { var _thrown = false;
ctx.strokeText('test', 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.strokeText('test', 0)"); }
try { var _thrown = false;
ctx.measureText();
} 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.measureText()"); }
}
try { var _thrown = false;
ctx.drawImage();
} 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()"); }
try { var _thrown = false;
ctx.drawImage(canvas);
} 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(canvas)"); }
try { var _thrown = false;
ctx.drawImage(canvas, 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(canvas, 0)"); }
// TODO: n >= 3 args on drawImage could be either a valid overload,
// or too few for another overload, or too many for another
// overload - what should happen?
if (ctx.createImageData) {
try { var _thrown = false;
ctx.createImageData();
} 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.createImageData()"); }
try { var _thrown = false;
ctx.createImageData(1);
} 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.createImageData(1)"); }
}
if (ctx.getImageData) {
try { var _thrown = false;
ctx.getImageData();
} 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.getImageData()"); }
try { var _thrown = false;
ctx.getImageData(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.getImageData(0)"); }
try { var _thrown = false;
ctx.getImageData(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.getImageData(0, 0)"); }
try { var _thrown = false;
ctx.getImageData(0, 0, 1);
} 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.getImageData(0, 0, 1)"); }
}
if (ctx.putImageData) {
var imgdata = ctx.getImageData(0, 0, 1, 1);
try { var _thrown = false;
ctx.putImageData();
} 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.putImageData()"); }
try { var _thrown = false;
ctx.putImageData(imgdata);
} 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.putImageData(imgdata)"); }
try { var _thrown = false;
ctx.putImageData(imgdata, 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.putImageData(imgdata, 0)"); }
}
var g = ctx.createLinearGradient(0, 0, 0, 0);
try { var _thrown = false;
g.addColorStop();
} 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: g.addColorStop()"); }
try { var _thrown = false;
g.addColorStop(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: g.addColorStop(0)"); }
});
</script>