Wed, 31 Dec 2014 06:55:46 +0100
Added tag TORBROWSER_REPLICA for changeset 6474c204b198
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 pickDone = false; |
michael@0 | 6 | |
michael@0 | 7 | function test() { |
michael@0 | 8 | if (!isTiltEnabled()) { |
michael@0 | 9 | info("Skipping picking test because Tilt isn't enabled."); |
michael@0 | 10 | return; |
michael@0 | 11 | } |
michael@0 | 12 | if (!isWebGLSupported()) { |
michael@0 | 13 | info("Skipping picking test because WebGL isn't supported."); |
michael@0 | 14 | return; |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | waitForExplicitFinish(); |
michael@0 | 18 | |
michael@0 | 19 | createTab(function() { |
michael@0 | 20 | createTilt({ |
michael@0 | 21 | onTiltOpen: function(instance) |
michael@0 | 22 | { |
michael@0 | 23 | let presenter = instance.presenter; |
michael@0 | 24 | let canvas = presenter.canvas; |
michael@0 | 25 | |
michael@0 | 26 | presenter._onSetupMesh = function() { |
michael@0 | 27 | let p = getPickablePoint(presenter); |
michael@0 | 28 | |
michael@0 | 29 | presenter.pickNode(p[0], p[1], { |
michael@0 | 30 | onpick: function(data) |
michael@0 | 31 | { |
michael@0 | 32 | ok(data.index > 0, |
michael@0 | 33 | "Simply picking a node didn't work properly."); |
michael@0 | 34 | |
michael@0 | 35 | pickDone = true; |
michael@0 | 36 | Services.obs.addObserver(cleanup, DESTROYED, false); |
michael@0 | 37 | Tilt.destroy(Tilt.currentWindowId); |
michael@0 | 38 | } |
michael@0 | 39 | }); |
michael@0 | 40 | }; |
michael@0 | 41 | } |
michael@0 | 42 | }, false, function suddenDeath() |
michael@0 | 43 | { |
michael@0 | 44 | info("Tilt could not be initialized properly."); |
michael@0 | 45 | cleanup(); |
michael@0 | 46 | }); |
michael@0 | 47 | }); |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | function cleanup() { |
michael@0 | 51 | if (pickDone) { Services.obs.removeObserver(cleanup, DESTROYED); } |
michael@0 | 52 | gBrowser.removeCurrentTab(); |
michael@0 | 53 | finish(); |
michael@0 | 54 | } |