|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Test AudioNode#getParamFlags() |
|
6 */ |
|
7 |
|
8 function spawnTest () { |
|
9 let [target, debuggee, front] = yield initBackend(SIMPLE_NODES_URL); |
|
10 let [_, nodes] = yield Promise.all([ |
|
11 front.setup({ reload: true }), |
|
12 getN(front, "create-node", 14) |
|
13 ]); |
|
14 |
|
15 let allNodeParams = yield Promise.all(nodes.map(node => node.getParams())); |
|
16 let nodeTypes = [ |
|
17 "AudioDestinationNode", |
|
18 "AudioBufferSourceNode", "ScriptProcessorNode", "AnalyserNode", "GainNode", |
|
19 "DelayNode", "BiquadFilterNode", "WaveShaperNode", "PannerNode", "ConvolverNode", |
|
20 "ChannelSplitterNode", "ChannelMergerNode", "DynamicsCompressorNode", "OscillatorNode" |
|
21 ]; |
|
22 |
|
23 nodeTypes.forEach(function (type, i) { |
|
24 let params = allNodeParams[i]; |
|
25 params.forEach(function ({param, value, flags}) { |
|
26 |
|
27 let testFlags = yield nodes[i].getParamFlag(param); |
|
28 ok(typeof testFlags === "object", type + " has flags from #getParamFlag(" + param + ")"); |
|
29 |
|
30 if (param === "buffer") { |
|
31 is(flags.Buffer, true, "`buffer` params have Buffer flag"); |
|
32 } |
|
33 else if (param === "bufferSize" || param === "frequencyBinCount") { |
|
34 is(flags.readonly, true, param + " is readonly"); |
|
35 } |
|
36 else if (param === "curve") { |
|
37 is(flags["Float32Array"], true, "`curve` param has Float32Array flag"); |
|
38 } else { |
|
39 is(Object.keys(flags), 0, type + "-" + param + " has no flags set") |
|
40 } |
|
41 }); |
|
42 }); |
|
43 |
|
44 yield removeTab(target.tab); |
|
45 finish(); |
|
46 } |