michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests if the shader editor shows the appropriate UI when opened. michael@0: */ michael@0: michael@0: function spawnTest() { michael@0: let [target, debuggee, panel] = yield initWebAudioEditor(COMPLEX_CONTEXT_URL); michael@0: let { panelWin } = panel; michael@0: let { gFront, $, $$, EVENTS, WebAudioParamView } = panelWin; michael@0: let gVars = WebAudioParamView._paramsView; michael@0: michael@0: let started = once(gFront, "start-context"); michael@0: michael@0: reload(target); michael@0: michael@0: let [[dest, osc, gain], nodeIDs ]= yield Promise.all([ michael@0: getN(gFront, "create-node", 8), michael@0: getNSpread(panelWin, EVENTS.UI_ADD_NODE_LIST, 8), michael@0: waitForGraphRendered(panelWin, 8, 8) michael@0: ]); michael@0: michael@0: // Map result to only have ID, since we don't need the event name michael@0: nodeIDs = nodeIDs.map(eventResult => eventResult[1]); michael@0: let types = ["AudioDestinationNode", "OscillatorNode", "GainNode", "ScriptProcessorNode", michael@0: "OscillatorNode", "GainNode", "AudioBufferSourceNode", "BiquadFilterNode"]; michael@0: michael@0: michael@0: types.forEach((type, i) => { michael@0: ok(findGraphNode(panelWin, nodeIDs[i]).classList.contains("type-" + type), "found " + type + " with class"); michael@0: }); michael@0: michael@0: let edges = [ michael@0: [1, 2, "osc1 -> gain1"], michael@0: [1, 3, "osc1 -> proc"], michael@0: [2, 0, "gain1 -> dest"], michael@0: [4, 5, "osc2 -> gain2"], michael@0: [5, 0, "gain2 -> dest"], michael@0: [6, 7, "buf -> filter"], michael@0: [4, 7, "osc2 -> filter"], michael@0: [7, 0, "filter -> dest"], michael@0: ]; michael@0: michael@0: edges.forEach(([source, target, msg], i) => { michael@0: is(findGraphEdge(panelWin, nodeIDs[source], nodeIDs[target]).toString(), "[object SVGGElement]", michael@0: "found edge for " + msg); michael@0: }); michael@0: michael@0: yield teardown(panel); michael@0: finish(); michael@0: } michael@0: