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: * Test AudioNode#getParamFlags() michael@0: */ michael@0: michael@0: function spawnTest () { michael@0: let [target, debuggee, front] = yield initBackend(SIMPLE_NODES_URL); michael@0: let [_, nodes] = yield Promise.all([ michael@0: front.setup({ reload: true }), michael@0: getN(front, "create-node", 14) michael@0: ]); michael@0: michael@0: let allNodeParams = yield Promise.all(nodes.map(node => node.getParams())); michael@0: let nodeTypes = [ michael@0: "AudioDestinationNode", michael@0: "AudioBufferSourceNode", "ScriptProcessorNode", "AnalyserNode", "GainNode", michael@0: "DelayNode", "BiquadFilterNode", "WaveShaperNode", "PannerNode", "ConvolverNode", michael@0: "ChannelSplitterNode", "ChannelMergerNode", "DynamicsCompressorNode", "OscillatorNode" michael@0: ]; michael@0: michael@0: nodeTypes.forEach(function (type, i) { michael@0: let params = allNodeParams[i]; michael@0: params.forEach(function ({param, value, flags}) { michael@0: michael@0: let testFlags = yield nodes[i].getParamFlag(param); michael@0: ok(typeof testFlags === "object", type + " has flags from #getParamFlag(" + param + ")"); michael@0: michael@0: if (param === "buffer") { michael@0: is(flags.Buffer, true, "`buffer` params have Buffer flag"); michael@0: } michael@0: else if (param === "bufferSize" || param === "frequencyBinCount") { michael@0: is(flags.readonly, true, param + " is readonly"); michael@0: } michael@0: else if (param === "curve") { michael@0: is(flags["Float32Array"], true, "`curve` param has Float32Array flag"); michael@0: } else { michael@0: is(Object.keys(flags), 0, type + "-" + param + " has no flags set") michael@0: } michael@0: }); michael@0: }); michael@0: michael@0: yield removeTab(target.tab); michael@0: finish(); michael@0: }