gecko/content/canvas/test/test_2d.gradient.linear.nonfinite.html

92 lines
5.3 KiB
HTML

<!DOCTYPE HTML>
<title>Canvas test: 2d.gradient.linear.nonfinite</title>
<!-- Testing: createLinearGradient() throws NOT_SUPPORTED_ERR if arguments are not finite -->
<script src="/MochiKit/MochiKit.js"></script>
<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>