michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: "use strict"; michael@0: michael@0: let presenter; michael@0: michael@0: function test() { michael@0: if (!isTiltEnabled()) { michael@0: info("Skipping highlight test because Tilt isn't enabled."); michael@0: return; michael@0: } michael@0: if (!isWebGLSupported()) { michael@0: info("Skipping highlight test because WebGL isn't supported."); michael@0: return; michael@0: } michael@0: michael@0: waitForExplicitFinish(); michael@0: michael@0: createTab(function() { michael@0: let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); michael@0: let target = devtools.TargetFactory.forTab(gBrowser.selectedTab); michael@0: michael@0: gDevTools.showToolbox(target, "inspector").then(function(toolbox) { michael@0: let contentDocument = toolbox.target.tab.linkedBrowser.contentDocument; michael@0: let div = contentDocument.getElementById("first-law"); michael@0: toolbox.getCurrentPanel().selection.setNode(div); michael@0: michael@0: createTilt({ michael@0: onTiltOpen: function(instance) michael@0: { michael@0: presenter = instance.presenter; michael@0: whenOpen(); michael@0: } michael@0: }, false, function suddenDeath() michael@0: { michael@0: info("Tilt could not be initialized properly."); michael@0: cleanup(); michael@0: }); michael@0: }); michael@0: }); michael@0: } michael@0: michael@0: function whenOpen() { michael@0: ok(presenter._currentSelection > 0, michael@0: "Highlighting a node didn't work properly."); michael@0: ok(!presenter._highlight.disabled, michael@0: "After highlighting a node, it should be highlighted. D'oh."); michael@0: ok(!presenter.controller.arcball._resetInProgress, michael@0: "Highlighting a node that's already visible shouldn't trigger a reset."); michael@0: michael@0: executeSoon(function() { michael@0: Services.obs.addObserver(cleanup, DESTROYED, false); michael@0: Tilt.destroy(Tilt.currentWindowId); michael@0: }); michael@0: } michael@0: michael@0: function cleanup() { michael@0: Services.obs.removeObserver(cleanup, DESTROYED); michael@0: gBrowser.removeCurrentTab(); michael@0: finish(); michael@0: }