diff -r 000000000000 -r 6474c204b198 browser/devtools/tilt/test/browser_tilt_picking.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/devtools/tilt/test/browser_tilt_picking.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,54 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +let pickDone = false; + +function test() { + if (!isTiltEnabled()) { + info("Skipping picking test because Tilt isn't enabled."); + return; + } + if (!isWebGLSupported()) { + info("Skipping picking test because WebGL isn't supported."); + return; + } + + waitForExplicitFinish(); + + createTab(function() { + createTilt({ + onTiltOpen: function(instance) + { + let presenter = instance.presenter; + let canvas = presenter.canvas; + + presenter._onSetupMesh = function() { + let p = getPickablePoint(presenter); + + presenter.pickNode(p[0], p[1], { + onpick: function(data) + { + ok(data.index > 0, + "Simply picking a node didn't work properly."); + + pickDone = true; + Services.obs.addObserver(cleanup, DESTROYED, false); + Tilt.destroy(Tilt.currentWindowId); + } + }); + }; + } + }, false, function suddenDeath() + { + info("Tilt could not be initialized properly."); + cleanup(); + }); + }); +} + +function cleanup() { + if (pickDone) { Services.obs.removeObserver(cleanup, DESTROYED); } + gBrowser.removeCurrentTab(); + finish(); +}