tor-browser

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

2d.path.stroke.skew.html (1848B)


      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>OffscreenCanvas test: 2d.path.stroke.skew</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 
      9 <h1>2d.path.stroke.skew</h1>
     10 <p class="desc">Strokes lines are skewed by the current transformation matrix</p>
     11 
     12 
     13 <script>
     14 var t = async_test("Strokes lines are skewed by the current transformation matrix");
     15 var t_pass = t.done.bind(t);
     16 var t_fail = t.step_func(function(reason) {
     17    throw reason;
     18 });
     19 t.step(function() {
     20 
     21  var canvas = new OffscreenCanvas(100, 50);
     22  var ctx = canvas.getContext('2d');
     23 
     24  ctx.fillStyle = '#f00';
     25  ctx.fillRect(0, 0, 100, 50);
     26 
     27  ctx.save();
     28  ctx.beginPath();
     29  ctx.moveTo(49, -50);
     30  ctx.lineTo(201, -50);
     31  ctx.rotate(Math.PI/4);
     32  ctx.scale(1, 283);
     33  ctx.strokeStyle = '#0f0';
     34  ctx.stroke();
     35  ctx.restore();
     36 
     37  ctx.save();
     38  ctx.beginPath();
     39  ctx.translate(-150, 0);
     40  ctx.moveTo(49, -50);
     41  ctx.lineTo(199, -50);
     42  ctx.rotate(Math.PI/4);
     43  ctx.scale(1, 142);
     44  ctx.strokeStyle = '#f00';
     45  ctx.stroke();
     46  ctx.restore();
     47 
     48  ctx.save();
     49  ctx.beginPath();
     50  ctx.translate(-150, 0);
     51  ctx.moveTo(49, -50);
     52  ctx.lineTo(199, -50);
     53  ctx.rotate(Math.PI/4);
     54  ctx.scale(1, 142);
     55  ctx.strokeStyle = '#f00';
     56  ctx.stroke();
     57  ctx.restore();
     58 
     59  _assertPixel(canvas, 0,0, 0,255,0,255);
     60  _assertPixel(canvas, 50,0, 0,255,0,255);
     61  _assertPixel(canvas, 99,0, 0,255,0,255);
     62  _assertPixel(canvas, 0,25, 0,255,0,255);
     63  _assertPixel(canvas, 50,25, 0,255,0,255);
     64  _assertPixel(canvas, 99,25, 0,255,0,255);
     65  _assertPixel(canvas, 0,49, 0,255,0,255);
     66  _assertPixel(canvas, 50,49, 0,255,0,255);
     67  _assertPixel(canvas, 99,49, 0,255,0,255);
     68  t.done();
     69 
     70 });
     71 </script>