tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

2d.gradient.conic.invalid.inputs.worker.js (2138B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.gradient.conic.invalid.inputs
      3 // Description:Conic gradient function with invalid inputs
      4 // Note:
      5 
      6 importScripts("/resources/testharness.js");
      7 importScripts("/html/canvas/resources/canvas-tests.js");
      8 
      9 var t = async_test("Conic gradient function with invalid inputs");
     10 var t_pass = t.done.bind(t);
     11 var t_fail = t.step_func(function(reason) {
     12    throw reason;
     13 });
     14 t.step(function() {
     15 
     16  var canvas = new OffscreenCanvas(100, 50);
     17  var ctx = canvas.getContext('2d');
     18 
     19  assert_throws_js(TypeError, function() { ctx.createConicGradient(Infinity, 0, 1); });
     20  assert_throws_js(TypeError, function() { ctx.createConicGradient(-Infinity, 0, 1); });
     21  assert_throws_js(TypeError, function() { ctx.createConicGradient(NaN, 0, 1); });
     22  assert_throws_js(TypeError, function() { ctx.createConicGradient(0, Infinity, 1); });
     23  assert_throws_js(TypeError, function() { ctx.createConicGradient(0, -Infinity, 1); });
     24  assert_throws_js(TypeError, function() { ctx.createConicGradient(0, NaN, 1); });
     25  assert_throws_js(TypeError, function() { ctx.createConicGradient(0, 0, Infinity); });
     26  assert_throws_js(TypeError, function() { ctx.createConicGradient(0, 0, -Infinity); });
     27  assert_throws_js(TypeError, function() { ctx.createConicGradient(0, 0, NaN); });
     28  assert_throws_js(TypeError, function() { ctx.createConicGradient(Infinity, Infinity, 1); });
     29  assert_throws_js(TypeError, function() { ctx.createConicGradient(Infinity, Infinity, Infinity); });
     30  assert_throws_js(TypeError, function() { ctx.createConicGradient(Infinity, 0, Infinity); });
     31  assert_throws_js(TypeError, function() { ctx.createConicGradient(0, Infinity, Infinity); });
     32 
     33  const g = ctx.createConicGradient(0, 0, 25);
     34  assert_throws_js(TypeError, function() { g.addColorStop(-Infinity, '#f00'); });
     35  assert_throws_js(TypeError, function() { g.addColorStop(NaN, '#f00'); });
     36  assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, -Infinity); });
     37  assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, NaN); });
     38  t.done();
     39 });
     40 done();