Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3 "use strict";
5 let nodeHighlighted = false;
6 let presenter;
8 function test() {
9 if (!isTiltEnabled()) {
10 info("Skipping highlight test because Tilt isn't enabled.");
11 return;
12 }
13 if (!isWebGLSupported()) {
14 info("Skipping highlight test because WebGL isn't supported.");
15 return;
16 }
18 waitForExplicitFinish();
20 createTab(function() {
21 createTilt({
22 onTiltOpen: function(instance)
23 {
24 presenter = instance.presenter;
25 Services.obs.addObserver(whenHighlighting, HIGHLIGHTING, false);
27 presenter._onInitializationFinished = function() {
28 let contentDocument = presenter.contentWindow.document;
29 let div = contentDocument.getElementById("far-far-away");
31 nodeHighlighted = true;
32 presenter.highlightNode(div);
33 };
34 }
35 }, false, function suddenDeath()
36 {
37 info("Tilt could not be initialized properly.");
38 cleanup();
39 });
40 });
41 }
43 function whenHighlighting() {
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 not already visible shouldn't trigger a reset " +
50 "without this being explicitly requested!");
52 EventUtils.sendKey("F");
53 executeSoon(whenBringingIntoView);
54 }
56 function whenBringingIntoView() {
57 ok(presenter._currentSelection > 0,
58 "The node should still be selected.");
59 ok(!presenter._highlight.disabled,
60 "The node should still be highlighted");
61 ok(presenter.controller.arcball._resetInProgress,
62 "Highlighting a node that's not already visible should trigger a reset " +
63 "when this is being explicitly requested!");
65 executeSoon(function() {
66 Services.obs.removeObserver(whenHighlighting, HIGHLIGHTING);
67 Services.obs.addObserver(cleanup, DESTROYED, false);
68 Tilt.destroy(Tilt.currentWindowId);
69 });
70 }
72 function cleanup() {
73 if (nodeHighlighted) { Services.obs.removeObserver(cleanup, DESTROYED); }
74 gBrowser.removeCurrentTab();
75 finish();
76 }