browser/devtools/tilt/test/browser_tilt_gl02.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3 "use strict";
michael@0 4
michael@0 5 let isWebGLAvailable;
michael@0 6
michael@0 7 function onWebGLFail() {
michael@0 8 isWebGLAvailable = false;
michael@0 9 }
michael@0 10
michael@0 11 function onWebGLSuccess() {
michael@0 12 isWebGLAvailable = true;
michael@0 13 }
michael@0 14
michael@0 15 function test() {
michael@0 16 if (!isWebGLSupported()) {
michael@0 17 info("Skipping tilt_gl02 because WebGL isn't supported on this hardware.");
michael@0 18 return;
michael@0 19 }
michael@0 20
michael@0 21 let canvas = createCanvas();
michael@0 22
michael@0 23 let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess);
michael@0 24 let gl = renderer.context;
michael@0 25
michael@0 26 if (!isWebGLAvailable) {
michael@0 27 return;
michael@0 28 }
michael@0 29
michael@0 30
michael@0 31 renderer.fill([1, 0, 0, 1]);
michael@0 32 ok(isApproxVec(renderer._fillColor, [1, 0, 0, 1]),
michael@0 33 "The fill color wasn't set correctly.");
michael@0 34
michael@0 35 renderer.stroke([0, 1, 0, 1]);
michael@0 36 ok(isApproxVec(renderer._strokeColor, [0, 1, 0, 1]),
michael@0 37 "The stroke color wasn't set correctly.");
michael@0 38
michael@0 39 renderer.strokeWeight(2);
michael@0 40 is(renderer._strokeWeightValue, 2,
michael@0 41 "The stroke weight wasn't set correctly.");
michael@0 42 is(gl.getParameter(gl.LINE_WIDTH), 2,
michael@0 43 "The stroke weight wasn't applied correctly.");
michael@0 44 }

mercurial