|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 "use strict"; |
|
4 |
|
5 let presenter; |
|
6 |
|
7 function test() { |
|
8 if (!isTiltEnabled()) { |
|
9 info("Skipping highlight test because Tilt isn't enabled."); |
|
10 return; |
|
11 } |
|
12 if (!isWebGLSupported()) { |
|
13 info("Skipping highlight test because WebGL isn't supported."); |
|
14 return; |
|
15 } |
|
16 |
|
17 waitForExplicitFinish(); |
|
18 |
|
19 createTab(function() { |
|
20 let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); |
|
21 let target = devtools.TargetFactory.forTab(gBrowser.selectedTab); |
|
22 |
|
23 gDevTools.showToolbox(target, "inspector").then(function(toolbox) { |
|
24 let contentDocument = toolbox.target.tab.linkedBrowser.contentDocument; |
|
25 let div = contentDocument.getElementById("first-law"); |
|
26 toolbox.getCurrentPanel().selection.setNode(div); |
|
27 |
|
28 createTilt({ |
|
29 onTiltOpen: function(instance) |
|
30 { |
|
31 presenter = instance.presenter; |
|
32 whenOpen(); |
|
33 } |
|
34 }, false, function suddenDeath() |
|
35 { |
|
36 info("Tilt could not be initialized properly."); |
|
37 cleanup(); |
|
38 }); |
|
39 }); |
|
40 }); |
|
41 } |
|
42 |
|
43 function whenOpen() { |
|
44 ok(presenter._currentSelection > 0, |
|
45 "Highlighting a node didn't work properly."); |
|
46 ok(!presenter._highlight.disabled, |
|
47 "After highlighting a node, it should be highlighted. D'oh."); |
|
48 ok(!presenter.controller.arcball._resetInProgress, |
|
49 "Highlighting a node that's already visible shouldn't trigger a reset."); |
|
50 |
|
51 executeSoon(function() { |
|
52 Services.obs.addObserver(cleanup, DESTROYED, false); |
|
53 Tilt.destroy(Tilt.currentWindowId); |
|
54 }); |
|
55 } |
|
56 |
|
57 function cleanup() { |
|
58 Services.obs.removeObserver(cleanup, DESTROYED); |
|
59 gBrowser.removeCurrentTab(); |
|
60 finish(); |
|
61 } |