|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 "use strict"; |
|
4 |
|
5 let pickDone = false; |
|
6 |
|
7 function test() { |
|
8 if (!isTiltEnabled()) { |
|
9 info("Skipping picking test because Tilt isn't enabled."); |
|
10 return; |
|
11 } |
|
12 if (!isWebGLSupported()) { |
|
13 info("Skipping picking test because WebGL isn't supported."); |
|
14 return; |
|
15 } |
|
16 |
|
17 waitForExplicitFinish(); |
|
18 |
|
19 createTab(function() { |
|
20 createTilt({ |
|
21 onTiltOpen: function(instance) |
|
22 { |
|
23 let presenter = instance.presenter; |
|
24 let canvas = presenter.canvas; |
|
25 |
|
26 presenter._onSetupMesh = function() { |
|
27 let p = getPickablePoint(presenter); |
|
28 |
|
29 presenter.pickNode(p[0], p[1], { |
|
30 onpick: function(data) |
|
31 { |
|
32 ok(data.index > 0, |
|
33 "Simply picking a node didn't work properly."); |
|
34 |
|
35 pickDone = true; |
|
36 Services.obs.addObserver(cleanup, DESTROYED, false); |
|
37 Tilt.destroy(Tilt.currentWindowId); |
|
38 } |
|
39 }); |
|
40 }; |
|
41 } |
|
42 }, false, function suddenDeath() |
|
43 { |
|
44 info("Tilt could not be initialized properly."); |
|
45 cleanup(); |
|
46 }); |
|
47 }); |
|
48 } |
|
49 |
|
50 function cleanup() { |
|
51 if (pickDone) { Services.obs.removeObserver(cleanup, DESTROYED); } |
|
52 gBrowser.removeCurrentTab(); |
|
53 finish(); |
|
54 } |