browser/devtools/tilt/test/browser_tilt_math03.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     3 "use strict";
     5 function test() {
     6   let m1 = mat3.create();
     8   ok(m1, "Should have created a matrix with mat3.create().");
     9   is(m1.length, 9, "A mat3 should have 9 elements.");
    11   ok(isApproxVec(m1, [1, 0, 0, 0, 1, 0, 0, 0, 1]),
    12     "When created, a mat3 should have the values default to identity.");
    14   mat3.set([1, 2, 3, 4, 5, 6, 7, 8, 9], m1);
    15   ok(isApproxVec(m1, [1, 2, 3, 4, 5, 6, 7, 8, 9]),
    16     "The mat3.set() function didn't set the values correctly.");
    18   mat3.transpose(m1);
    19   ok(isApproxVec(m1, [1, 4, 7, 2, 5, 8, 3, 6, 9]),
    20     "The mat3.transpose() function didn't set the values correctly.");
    22   mat3.identity(m1);
    23   ok(isApproxVec(m1, [1, 0, 0, 0, 1, 0, 0, 0, 1]),
    24     "The mat3.identity() function didn't set the values correctly.");
    26   let m2 = mat3.toMat4(m1);
    27   ok(isApproxVec(m2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
    28     "The mat3.toMat4() function didn't set the values correctly.");
    31   is(mat3.str([1, 2, 3, 4, 5, 6, 7, 8, 9]), "[1, 2, 3, 4, 5, 6, 7, 8, 9]",
    32     "The mat3.str() function didn't work properly.");
    33 }

mercurial