browser/devtools/tilt/test/browser_tilt_gl02.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/tilt/test/browser_tilt_gl02.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +"use strict";
     1.7 +
     1.8 +let isWebGLAvailable;
     1.9 +
    1.10 +function onWebGLFail() {
    1.11 +  isWebGLAvailable = false;
    1.12 +}
    1.13 +
    1.14 +function onWebGLSuccess() {
    1.15 +  isWebGLAvailable = true;
    1.16 +}
    1.17 +
    1.18 +function test() {
    1.19 +  if (!isWebGLSupported()) {
    1.20 +    info("Skipping tilt_gl02 because WebGL isn't supported on this hardware.");
    1.21 +    return;
    1.22 +  }
    1.23 +
    1.24 +  let canvas = createCanvas();
    1.25 +
    1.26 +  let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess);
    1.27 +  let gl = renderer.context;
    1.28 +
    1.29 +  if (!isWebGLAvailable) {
    1.30 +    return;
    1.31 +  }
    1.32 +
    1.33 +
    1.34 +  renderer.fill([1, 0, 0, 1]);
    1.35 +  ok(isApproxVec(renderer._fillColor, [1, 0, 0, 1]),
    1.36 +    "The fill color wasn't set correctly.");
    1.37 +
    1.38 +  renderer.stroke([0, 1, 0, 1]);
    1.39 +  ok(isApproxVec(renderer._strokeColor, [0, 1, 0, 1]),
    1.40 +    "The stroke color wasn't set correctly.");
    1.41 +
    1.42 +  renderer.strokeWeight(2);
    1.43 +  is(renderer._strokeWeightValue, 2,
    1.44 +    "The stroke weight wasn't set correctly.");
    1.45 +  is(gl.getParameter(gl.LINE_WIDTH), 2,
    1.46 +    "The stroke weight wasn't applied correctly.");
    1.47 +}

mercurial