servo/tests/wpt/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.gradient.linear.nonfinite.worker.js

42 lines
2.7 KiB
JavaScript

// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.gradient.linear.nonfinite
// Description:createLinearGradient() throws TypeError if arguments are not finite
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("createLinearGradient() throws TypeError if arguments are not finite");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, 1, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(-Infinity, 0, 1, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(NaN, 0, 1, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, 1, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, -Infinity, 1, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, NaN, 1, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, Infinity, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, -Infinity, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, NaN, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1, Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1, -Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1, NaN); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, 1, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, 1, Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, Infinity, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, 1, Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, Infinity, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, 1, Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, Infinity, Infinity); });
t.done();
});
done();