|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Tests if the shader editor shows the appropriate UI when opened. |
|
6 */ |
|
7 |
|
8 function spawnTest() { |
|
9 let [target, debuggee, panel] = yield initWebAudioEditor(COMPLEX_CONTEXT_URL); |
|
10 let { panelWin } = panel; |
|
11 let { gFront, $, $$, EVENTS, WebAudioParamView } = panelWin; |
|
12 let gVars = WebAudioParamView._paramsView; |
|
13 |
|
14 let started = once(gFront, "start-context"); |
|
15 |
|
16 reload(target); |
|
17 |
|
18 let [[dest, osc, gain], nodeIDs ]= yield Promise.all([ |
|
19 getN(gFront, "create-node", 8), |
|
20 getNSpread(panelWin, EVENTS.UI_ADD_NODE_LIST, 8), |
|
21 waitForGraphRendered(panelWin, 8, 8) |
|
22 ]); |
|
23 |
|
24 // Map result to only have ID, since we don't need the event name |
|
25 nodeIDs = nodeIDs.map(eventResult => eventResult[1]); |
|
26 let types = ["AudioDestinationNode", "OscillatorNode", "GainNode", "ScriptProcessorNode", |
|
27 "OscillatorNode", "GainNode", "AudioBufferSourceNode", "BiquadFilterNode"]; |
|
28 |
|
29 |
|
30 types.forEach((type, i) => { |
|
31 ok(findGraphNode(panelWin, nodeIDs[i]).classList.contains("type-" + type), "found " + type + " with class"); |
|
32 }); |
|
33 |
|
34 let edges = [ |
|
35 [1, 2, "osc1 -> gain1"], |
|
36 [1, 3, "osc1 -> proc"], |
|
37 [2, 0, "gain1 -> dest"], |
|
38 [4, 5, "osc2 -> gain2"], |
|
39 [5, 0, "gain2 -> dest"], |
|
40 [6, 7, "buf -> filter"], |
|
41 [4, 7, "osc2 -> filter"], |
|
42 [7, 0, "filter -> dest"], |
|
43 ]; |
|
44 |
|
45 edges.forEach(([source, target, msg], i) => { |
|
46 is(findGraphEdge(panelWin, nodeIDs[source], nodeIDs[target]).toString(), "[object SVGGElement]", |
|
47 "found edge for " + msg); |
|
48 }); |
|
49 |
|
50 yield teardown(panel); |
|
51 finish(); |
|
52 } |
|
53 |