tor-browser

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

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


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