tor-browser

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

2d.line.invalid.strokestyle.html (1291B)


      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.line.invalid.strokestyle</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.line.invalid.strokestyle</h1>
     12 <p class="desc">Verify correct behavior of canvas on an invalid strokeStyle()</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("Verify correct behavior of canvas on an invalid strokeStyle()");
     21 _addTest(function(canvas, ctx) {
     22 
     23  ctx.strokeStyle = 'rgb(0, 255, 0)';
     24  ctx.strokeStyle = 'nonsense';
     25  ctx.lineWidth = 200;
     26  ctx.moveTo(0,100);
     27  ctx.lineTo(200,100);
     28  ctx.stroke();
     29  var imageData = ctx.getImageData(0, 0, 200, 200);
     30  var imgdata = imageData.data;
     31  _assert(imgdata[4] == 0, "imgdata[\""+(4)+"\"] == 0");
     32  _assert(imgdata[5] == 255, "imgdata[\""+(5)+"\"] == 255");
     33  _assert(imgdata[6] == 0, "imgdata[\""+(6)+"\"] == 0");
     34 
     35 });
     36 </script>