gecko/browser/devtools/tilt/test/browser_tilt_picking_highlight02.js

53 lines
1.4 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/*global ok, is, info, waitForExplicitFinish, finish, gBrowser */
/*global isTiltEnabled, isWebGLSupported, createTab, createTilt */
/*global Services, InspectorUI, TILT_DESTROYED */
"use strict";
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)
{
let presenter = instance.presenter;
let canvas = presenter.canvas;
presenter.onSetupMesh = function() {
presenter.highlightNodeAt(canvas.width / 2, canvas.height / 2, {
onpick: function()
{
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.");
Services.obs.addObserver(cleanup, TILT_DESTROYED, false);
InspectorUI.closeInspectorUI();
}
});
};
}
});
});
}
function cleanup() {
Services.obs.removeObserver(cleanup, TILT_DESTROYED);
gBrowser.removeCurrentTab();
finish();
}