tor-browser

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

2d.conformance.requirements.missingargs.html (8069B)


      1 <!DOCTYPE html>
      2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
      3 <meta charset="UTF-8">
      4 <title>Canvas test: 2d.conformance.requirements.missingargs</title>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/html/canvas/resources/canvas-tests.js"></script>
      8 <link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
      9 <body class="show_output">
     10 
     11 <h1>2d.conformance.requirements.missingargs</h1>
     12 <p class="desc">Missing arguments cause TypeError</p>
     13 
     14 
     15 <p class="output">Actual output:</p>
     16 <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
     17 
     18 <ul id="d"></ul>
     19 <script>
     20 var t = async_test("Missing arguments cause TypeError");
     21 _addTest(function(canvas, ctx) {
     22 
     23  assert_throws_js(TypeError, function() { ctx.scale(); });
     24  assert_throws_js(TypeError, function() { ctx.scale(1); });
     25  assert_throws_js(TypeError, function() { ctx.rotate(); });
     26  assert_throws_js(TypeError, function() { ctx.translate(); });
     27  assert_throws_js(TypeError, function() { ctx.translate(0); });
     28  if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported)
     29      assert_throws_js(TypeError, function() { ctx.transform(); });
     30      assert_throws_js(TypeError, function() { ctx.transform(1); });
     31      assert_throws_js(TypeError, function() { ctx.transform(1, 0); });
     32      assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); });
     33      assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); });
     34      assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); });
     35  }
     36  if (ctx.setTransform) {
     37      assert_throws_js(TypeError, function() { ctx.setTransform(1); });
     38      assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); });
     39      assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); });
     40      assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); });
     41      assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); });
     42  }
     43  assert_throws_js(TypeError, function() { ctx.createLinearGradient(); });
     44  assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); });
     45  assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); });
     46  assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); });
     47  assert_throws_js(TypeError, function() { ctx.createRadialGradient(); });
     48  assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); });
     49  assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); });
     50  assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); });
     51  assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); });
     52  assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); });
     53  assert_throws_js(TypeError, function() { ctx.createPattern(canvas); });
     54  assert_throws_js(TypeError, function() { ctx.clearRect(); });
     55  assert_throws_js(TypeError, function() { ctx.clearRect(0); });
     56  assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); });
     57  assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); });
     58  assert_throws_js(TypeError, function() { ctx.fillRect(); });
     59  assert_throws_js(TypeError, function() { ctx.fillRect(0); });
     60  assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); });
     61  assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); });
     62  assert_throws_js(TypeError, function() { ctx.strokeRect(); });
     63  assert_throws_js(TypeError, function() { ctx.strokeRect(0); });
     64  assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); });
     65  assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); });
     66  assert_throws_js(TypeError, function() { ctx.moveTo(); });
     67  assert_throws_js(TypeError, function() { ctx.moveTo(0); });
     68  assert_throws_js(TypeError, function() { ctx.lineTo(); });
     69  assert_throws_js(TypeError, function() { ctx.lineTo(0); });
     70  assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); });
     71  assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); });
     72  assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); });
     73  assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); });
     74  assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); });
     75  assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); });
     76  assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); });
     77  assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); });
     78  assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); });
     79  assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); });
     80  assert_throws_js(TypeError, function() { ctx.arcTo(); });
     81  assert_throws_js(TypeError, function() { ctx.arcTo(0); });
     82  assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); });
     83  assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); });
     84  assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); });
     85  assert_throws_js(TypeError, function() { ctx.rect(); });
     86  assert_throws_js(TypeError, function() { ctx.rect(0); });
     87  assert_throws_js(TypeError, function() { ctx.rect(0, 0); });
     88  assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); });
     89  assert_throws_js(TypeError, function() { ctx.arc(); });
     90  assert_throws_js(TypeError, function() { ctx.arc(0); });
     91  assert_throws_js(TypeError, function() { ctx.arc(0, 0); });
     92  assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); });
     93  assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); });
     94  // (6th argument to arc is optional)
     95  if (ctx.isPointInPath) {
     96      assert_throws_js(TypeError, function() { ctx.isPointInPath(); });
     97      assert_throws_js(TypeError, function() { ctx.isPointInPath(0); });
     98  }
     99  if (ctx.drawFocusRing) {
    100      assert_throws_js(TypeError, function() { ctx.drawFocusRing(); });
    101      assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas); });
    102      assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas, 0); });
    103  }
    104  if (ctx.fillText) {
    105      assert_throws_js(TypeError, function() { ctx.fillText(); });
    106      assert_throws_js(TypeError, function() { ctx.fillText('test'); });
    107      assert_throws_js(TypeError, function() { ctx.fillText('test', 0); });
    108      assert_throws_js(TypeError, function() { ctx.strokeText(); });
    109      assert_throws_js(TypeError, function() { ctx.strokeText('test'); });
    110      assert_throws_js(TypeError, function() { ctx.strokeText('test', 0); });
    111      assert_throws_js(TypeError, function() { ctx.measureText(); });
    112  }
    113  assert_throws_js(TypeError, function() { ctx.drawImage(); });
    114  assert_throws_js(TypeError, function() { ctx.drawImage(canvas); });
    115  assert_throws_js(TypeError, function() { ctx.drawImage(canvas, 0); });
    116  // TODO: n >= 3 args on drawImage could be either a valid overload,
    117  // or too few for another overload, or too many for another
    118  // overload - what should happen?
    119  if (ctx.createImageData) {
    120      assert_throws_js(TypeError, function() { ctx.createImageData(); });
    121      assert_throws_js(TypeError, function() { ctx.createImageData(1); });
    122  }
    123  if (ctx.getImageData) {
    124      assert_throws_js(TypeError, function() { ctx.getImageData(); });
    125      assert_throws_js(TypeError, function() { ctx.getImageData(0); });
    126      assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); });
    127      assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); });
    128  }
    129  if (ctx.putImageData) {
    130      var imgdata = ctx.getImageData(0, 0, 1, 1);
    131      assert_throws_js(TypeError, function() { ctx.putImageData(); });
    132      assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); });
    133      assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); });
    134  }
    135  var g = ctx.createLinearGradient(0, 0, 0, 0);
    136  assert_throws_js(TypeError, function() { g.addColorStop(); });
    137  assert_throws_js(TypeError, function() { g.addColorStop(0); });
    138 
    139 });
    140 </script>