2012-01-25 00:04:15 -08:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
"use strict";
|
|
|
|
|
2012-01-19 07:48:22 -08:00
|
|
|
let presenter;
|
|
|
|
|
2012-01-25 00:04:15 -08:00
|
|
|
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() {
|
|
|
|
createTilt({
|
|
|
|
onTiltOpen: function(instance)
|
|
|
|
{
|
2012-01-19 07:48:22 -08:00
|
|
|
presenter = instance.presenter;
|
|
|
|
Services.obs.addObserver(whenHighlighting, HIGHLIGHTING, false);
|
2012-01-25 00:04:15 -08:00
|
|
|
|
2012-02-07 01:44:55 -08:00
|
|
|
presenter._onSetupMesh = function() {
|
2012-01-19 07:48:22 -08:00
|
|
|
presenter.highlightNodeFor(5); // 1 = html, 2 = body, 3 = first div
|
2012-01-25 00:04:15 -08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-01-19 07:48:22 -08:00
|
|
|
function whenHighlighting() {
|
|
|
|
ok(presenter._currentSelection > 0,
|
|
|
|
"Highlighting a node didn't work properly.");
|
2012-02-07 01:44:55 -08:00
|
|
|
ok(!presenter._highlight.disabled,
|
2012-01-19 07:48:22 -08:00
|
|
|
"After highlighting a node, it should be highlighted. D'oh.");
|
|
|
|
|
|
|
|
executeSoon(function() {
|
|
|
|
Services.obs.addObserver(whenUnhighlighting, UNHIGHLIGHTING, false);
|
|
|
|
presenter.highlightNodeFor(-1);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function whenUnhighlighting() {
|
|
|
|
ok(presenter._currentSelection < 0,
|
|
|
|
"Unhighlighting a should remove the current selection.");
|
2012-02-07 01:44:55 -08:00
|
|
|
ok(presenter._highlight.disabled,
|
2012-01-19 07:48:22 -08:00
|
|
|
"After unhighlighting a node, it shouldn't be highlighted anymore. D'oh.");
|
|
|
|
|
|
|
|
executeSoon(function() {
|
|
|
|
Services.obs.addObserver(cleanup, DESTROYED, false);
|
|
|
|
InspectorUI.closeInspectorUI();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-01-25 00:04:15 -08:00
|
|
|
function cleanup() {
|
2012-01-19 07:48:22 -08:00
|
|
|
Services.obs.removeObserver(whenHighlighting, HIGHLIGHTING);
|
|
|
|
Services.obs.removeObserver(whenUnhighlighting, UNHIGHLIGHTING);
|
|
|
|
Services.obs.removeObserver(cleanup, DESTROYED);
|
2012-01-25 00:04:15 -08:00
|
|
|
gBrowser.removeCurrentTab();
|
|
|
|
finish();
|
|
|
|
}
|