tor-browser

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

DOMMatrix-002.html (3798B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4    <title>Geometry Interfaces: DOMMatrixReadOnly methods do not mutate the object</title>
      5    <link href="mailto:peter.hall@algomi.com" rel="author" title="Peter Hall">
      6    <link rel="help" href="https://drafts.fxtf.org/geometry-1/#DOMMatrix">
      7    <script src="support/dommatrix-test-util.js"></script>
      8    <script src="/resources/testharness.js"></script>
      9    <script src="/resources/testharnessreport.js"></script>
     10 </head>
     11 <body>
     12    <p>Test DOMMatrixReadOnly methods do not mutate the object</p>
     13    <div id="log"></div>
     14    <script>
     15 
     16        function initialMatrix(){
     17          return DOMMatrixReadOnly.fromMatrix(
     18            {
     19              m11:1,   m12:-0.5, m13: 0.5,  m14:0,
     20              m21:0.5, m22:2,    m23: -0.5, m24:0,
     21              m31:0,   m32:0,    m33: 1,    m34:0,
     22              m41:0,   m42:0,    m43: 0,    m44:1,
     23              is2D: false
     24            }
     25          );
     26        }
     27 
     28        test(function() {
     29          var matrix = initialMatrix();
     30          matrix.translate(1,5,3);
     31          checkMatrix(matrix, initialMatrix());
     32        },"test translate() doesn't mutate");
     33 
     34        test(function() {
     35          var matrix = initialMatrix();
     36          matrix.scale(1,5,3,0,1,3);
     37          checkMatrix(matrix, initialMatrix());
     38        },"test scale() doesn't mutate");
     39 
     40        test(function() {
     41          var matrix = initialMatrix();
     42          matrix.scaleNonUniform(1,5);
     43          checkMatrix(matrix, initialMatrix());
     44        },"test scaleNonUniform() doesn't mutate");
     45 
     46        test(function() {
     47          var matrix = initialMatrix();
     48          matrix.scale3d(3,2,1,1);
     49          checkMatrix(matrix, initialMatrix());
     50        },"test scale3d() doesn't mutate");
     51 
     52        test(function() {
     53          var matrix = initialMatrix();
     54          matrix.rotate(Math.PI, Math.PI/2, Math.PI/6);
     55          checkMatrix(matrix, initialMatrix());
     56        },"test rotate() doesn't mutate");
     57 
     58        test(function() {
     59          var matrix = initialMatrix();
     60          matrix.rotateFromVector(10,-4);
     61          checkMatrix(matrix, initialMatrix());
     62        },"test rotateFromVector() doesn't mutate");
     63 
     64        test(function() {
     65          var matrix = initialMatrix();
     66          matrix.rotateAxisAngle(3,4,5, Math.PI/6);
     67          checkMatrix(matrix, initialMatrix());
     68        },"test rotateAxisAngle() doesn't mutate");
     69 
     70        test(function() {
     71          var matrix = initialMatrix();
     72          matrix.skewX(20);
     73          checkMatrix(matrix, initialMatrix());
     74        },"test skewX() doesn't mutate");
     75 
     76        test(function() {
     77          var matrix = initialMatrix();
     78          matrix.skewY(20);
     79          checkMatrix(matrix, initialMatrix());
     80        },"test skewY() doesn't mutate");
     81 
     82        test(function() {
     83          var matrix = initialMatrix();
     84          matrix.multiply({ m11:1, m12:2, m13: 0, m14:0,
     85                            m21:-1, m22:2, m23: -1, m24:0,
     86                            m31:0, m32:0, m33: 1, m34:0,
     87                            m41:5, m42:0, m43: 2, m44:1,
     88                            is2D: false,
     89                            isIdentity:false });
     90          checkMatrix(matrix, initialMatrix());
     91        },"test multiply() doesn't mutate");
     92 
     93        test(function() {
     94          var matrix = initialMatrix();
     95          matrix.flipX();
     96          checkMatrix(matrix, initialMatrix());
     97        },"test flipX() doesn't mutate");
     98 
     99        test(function() {
    100          var matrix = initialMatrix();
    101          matrix.flipY();
    102          checkMatrix(matrix, initialMatrix());
    103        },"test flipY() doesn't mutate");
    104 
    105        test(function() {
    106          var matrix = initialMatrix();
    107          matrix.inverse();
    108          checkMatrix(matrix, initialMatrix());
    109        },"test inverse() doesn't mutate");
    110 
    111    </script>
    112 </body>
    113 </html>