2008-08-10 21:01:14 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<title>Canvas test: 2d.gradient.linear.nonfinite</title>
|
|
|
|
<!-- Testing: createLinearGradient() throws NOT_SUPPORTED_ERR if arguments are not finite -->
|
2009-05-06 13:46:04 -07:00
|
|
|
<script src="/MochiKit/packed.js"></script>
|
2008-08-10 21:01:14 -07:00
|
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
|
|
|
<body>
|
|
|
|
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
|
|
|
<script>
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
MochiKit.DOM.addLoadEvent(function () {
|
|
|
|
|
|
|
|
var canvas = document.getElementById('c');
|
|
|
|
var ctx = canvas.getContext('2d');
|
|
|
|
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(Infinity, 0, 1, 0);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(-Infinity, 0, 1, 0);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(NaN, 0, 1, 0);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(0, Infinity, 1, 0);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(0, -Infinity, 1, 0);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(0, NaN, 1, 0);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(0, 0, Infinity, 0);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(0, 0, -Infinity, 0);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(0, 0, NaN, 0);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(0, 0, 1, Infinity);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(0, 0, 1, -Infinity);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(0, 0, 1, NaN);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(Infinity, Infinity, 1, 0);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(Infinity, Infinity, Infinity, 0);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(Infinity, Infinity, Infinity, Infinity);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(Infinity, Infinity, 1, Infinity);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(Infinity, 0, Infinity, 0);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(Infinity, 0, Infinity, Infinity);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(Infinity, 0, 1, Infinity);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(0, Infinity, Infinity, 0);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(0, Infinity, Infinity, Infinity);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(0, Infinity, 1, Infinity);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
var _thrown = undefined; try {
|
|
|
|
ctx.createLinearGradient(0, 0, Infinity, Infinity);
|
|
|
|
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
|
|
|
|
|
|
|
|
SimpleTest.finish();
|
|
|
|
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|