browser/devtools/webaudioeditor/test/browser_wa_graph_render_02.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/webaudioeditor/test/browser_wa_graph_render_02.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +/**
     1.8 + * Tests if the shader editor shows the appropriate UI when opened.
     1.9 + */
    1.10 +
    1.11 +function spawnTest() {
    1.12 +  let [target, debuggee, panel] = yield initWebAudioEditor(COMPLEX_CONTEXT_URL);
    1.13 +  let { panelWin } = panel;
    1.14 +  let { gFront, $, $$, EVENTS, WebAudioParamView } = panelWin;
    1.15 +  let gVars = WebAudioParamView._paramsView;
    1.16 +
    1.17 +  let started = once(gFront, "start-context");
    1.18 +
    1.19 +  reload(target);
    1.20 +
    1.21 +  let [[dest, osc, gain], nodeIDs ]= yield Promise.all([
    1.22 +    getN(gFront, "create-node", 8),
    1.23 +    getNSpread(panelWin, EVENTS.UI_ADD_NODE_LIST, 8),
    1.24 +    waitForGraphRendered(panelWin, 8, 8)
    1.25 +  ]);
    1.26 +
    1.27 +  // Map result to only have ID, since we don't need the event name
    1.28 +  nodeIDs = nodeIDs.map(eventResult => eventResult[1]);
    1.29 +  let types = ["AudioDestinationNode", "OscillatorNode", "GainNode", "ScriptProcessorNode",
    1.30 +               "OscillatorNode", "GainNode", "AudioBufferSourceNode", "BiquadFilterNode"];
    1.31 +
    1.32 +
    1.33 +  types.forEach((type, i) => {
    1.34 +    ok(findGraphNode(panelWin, nodeIDs[i]).classList.contains("type-" + type), "found " + type + " with class");
    1.35 +  });
    1.36 +
    1.37 +  let edges = [
    1.38 +    [1, 2, "osc1 -> gain1"],
    1.39 +    [1, 3, "osc1 -> proc"],
    1.40 +    [2, 0, "gain1 -> dest"],
    1.41 +    [4, 5, "osc2 -> gain2"],
    1.42 +    [5, 0, "gain2 -> dest"],
    1.43 +    [6, 7, "buf -> filter"],
    1.44 +    [4, 7, "osc2 -> filter"],
    1.45 +    [7, 0, "filter -> dest"],
    1.46 +  ];
    1.47 +
    1.48 +  edges.forEach(([source, target, msg], i) => {
    1.49 +    is(findGraphEdge(panelWin, nodeIDs[source], nodeIDs[target]).toString(), "[object SVGGElement]",
    1.50 +      "found edge for " + msg);
    1.51 +  });
    1.52 +
    1.53 +  yield teardown(panel);
    1.54 +  finish();
    1.55 +}
    1.56 +

mercurial