Bug 862435 - Tilt doesn't open if the Inspector was opened beforehand, r=dtownsend

This commit is contained in:
Victor Porof 2013-04-18 09:35:26 +03:00
parent 5b457eb0e8
commit a80895f824
3 changed files with 65 additions and 3 deletions

View File

@ -80,6 +80,7 @@ this.TiltVisualizer = function TiltVisualizer(aProperties)
* Save a reference to the top-level window.
*/
this.chromeWindow = aProperties.chromeWindow;
this.tab = aProperties.tab;
/**
* The canvas element used for rendering the visualization.
@ -99,8 +100,6 @@ this.TiltVisualizer = function TiltVisualizer(aProperties)
aProperties.onError || null,
aProperties.onLoad || null);
this.bindToInspector(aProperties.tab);
/**
* Visualization mouse and keyboard controller.
*/
@ -110,11 +109,12 @@ this.TiltVisualizer = function TiltVisualizer(aProperties)
TiltVisualizer.prototype = {
/**
* Initializes the visualizer
* Initializes the visualizer.
*/
init: function TV_init()
{
this.presenter.init();
this.bindToInspector(this.tab);
},
/**

View File

@ -41,6 +41,7 @@ MOCHITEST_BROWSER_FILES = \
browser_tilt_math06.js \
browser_tilt_math07.js \
browser_tilt_picking.js \
browser_tilt_picking_inspector.js \
browser_tilt_picking_delete.js \
browser_tilt_picking_highlight01-offs.js \
browser_tilt_picking_highlight01.js \

View File

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