1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/tilt/test/browser_tilt_picking.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,54 @@ 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 pickDone = false; 1.9 + 1.10 +function test() { 1.11 + if (!isTiltEnabled()) { 1.12 + info("Skipping picking test because Tilt isn't enabled."); 1.13 + return; 1.14 + } 1.15 + if (!isWebGLSupported()) { 1.16 + info("Skipping picking test because WebGL isn't supported."); 1.17 + return; 1.18 + } 1.19 + 1.20 + waitForExplicitFinish(); 1.21 + 1.22 + createTab(function() { 1.23 + createTilt({ 1.24 + onTiltOpen: function(instance) 1.25 + { 1.26 + let presenter = instance.presenter; 1.27 + let canvas = presenter.canvas; 1.28 + 1.29 + presenter._onSetupMesh = function() { 1.30 + let p = getPickablePoint(presenter); 1.31 + 1.32 + presenter.pickNode(p[0], p[1], { 1.33 + onpick: function(data) 1.34 + { 1.35 + ok(data.index > 0, 1.36 + "Simply picking a node didn't work properly."); 1.37 + 1.38 + pickDone = true; 1.39 + Services.obs.addObserver(cleanup, DESTROYED, false); 1.40 + Tilt.destroy(Tilt.currentWindowId); 1.41 + } 1.42 + }); 1.43 + }; 1.44 + } 1.45 + }, false, function suddenDeath() 1.46 + { 1.47 + info("Tilt could not be initialized properly."); 1.48 + cleanup(); 1.49 + }); 1.50 + }); 1.51 +} 1.52 + 1.53 +function cleanup() { 1.54 + if (pickDone) { Services.obs.removeObserver(cleanup, DESTROYED); } 1.55 + gBrowser.removeCurrentTab(); 1.56 + finish(); 1.57 +}