LibWeb: Implement OscillatorNode.setPeriodicWave()

This commit is contained in:
Tim Ledbetter 2025-01-03 18:07:01 +00:00 committed by Tim Ledbetter
commit 8c4e4ec31b
Notes: github-actions[bot] 2025-01-04 10:13:24 +00:00
6 changed files with 205 additions and 18 deletions

View file

@ -0,0 +1,67 @@
Harness status: OK
Found 62 tests
62 Pass
Pass # AUDIT TASK RUNNER STARTED.
Pass Executing "initialize"
Pass Executing "invalid constructor"
Pass Executing "default constructor"
Pass Executing "test AudioNodeOptions"
Pass Executing "constructor options"
Pass Audit report
Pass > [initialize]
Pass context = new OfflineAudioContext(...) did not throw an exception.
Pass < [initialize] All assertions passed. (total 1 assertions)
Pass > [invalid constructor]
Pass new OscillatorNode() threw TypeError: "OscillatorNode() needs one argument".
Pass new OscillatorNode(1) threw TypeError: "Not an object of type BaseAudioContext".
Pass new OscillatorNode(context, 42) threw TypeError: "Not an object of type OscillatorOptions".
Pass < [invalid constructor] All assertions passed. (total 3 assertions)
Pass > [default constructor]
Pass node0 = new OscillatorNode(context) did not throw an exception.
Pass node0 instanceof OscillatorNode is equal to true.
Pass node0.numberOfInputs is equal to 0.
Pass node0.numberOfOutputs is equal to 1.
Pass node0.channelCount is equal to 2.
Pass node0.channelCountMode is equal to max.
Pass node0.channelInterpretation is equal to speakers.
Pass node0.type is equal to sine.
Pass node0.frequency.value is equal to 440.
Pass < [default constructor] All assertions passed. (total 9 assertions)
Pass > [test AudioNodeOptions]
Pass new OscillatorNode(c, {channelCount: 17}) did not throw an exception.
Pass node.channelCount is equal to 17.
Pass new OscillatorNode(c, {channelCount: 0}) threw NotSupportedError: "Invalid channel count".
Pass new OscillatorNode(c, {channelCount: 99}) threw NotSupportedError: "Invalid channel count".
Pass new OscillatorNode(c, {channelCountMode: "max"} did not throw an exception.
Pass node.channelCountMode is equal to max.
Pass new OscillatorNode(c, {channelCountMode: "max"}) did not throw an exception.
Pass node.channelCountMode after valid setter is equal to max.
Pass new OscillatorNode(c, {channelCountMode: "clamped-max"}) did not throw an exception.
Pass node.channelCountMode after valid setter is equal to clamped-max.
Pass new OscillatorNode(c, {channelCountMode: "explicit"}) did not throw an exception.
Pass node.channelCountMode after valid setter is equal to explicit.
Pass new OscillatorNode(c, {channelCountMode: "foobar"} threw TypeError: "Invalid value 'foobar' for enumeration type 'ChannelCountMode'".
Pass node.channelCountMode after invalid setter is equal to explicit.
Pass new OscillatorNode(c, {channelInterpretation: "speakers"}) did not throw an exception.
Pass node.channelInterpretation is equal to speakers.
Pass new OscillatorNode(c, {channelInterpretation: "discrete"}) did not throw an exception.
Pass node.channelInterpretation is equal to discrete.
Pass new OscillatorNode(c, {channelInterpretation: "foobar"}) threw TypeError: "Invalid value 'foobar' for enumeration type 'ChannelInterpretation'".
Pass node.channelInterpretation after invalid setter is equal to discrete.
Pass < [test AudioNodeOptions] All assertions passed. (total 20 assertions)
Pass > [constructor options]
Pass node1 = new OscillatorNode(c, {"type":"sawtooth","detune":7,"frequency":918}) did not throw an exception.
Pass node1.type is equal to sawtooth.
Pass node1.detune.value is equal to 7.
Pass node1.frequency.value is equal to 918.
Pass node1.channelCount is equal to 2.
Pass node1.channelCountMode is equal to max.
Pass node1.channelInterpretation is equal to speakers.
Pass new OscillatorNode(c, {"type":"sine","periodicWave":{}}) did not throw an exception.
Pass new OscillatorNode(c, {"type":"custom"}) threw InvalidStateError: "Oscillator node type 'custom' requires PeriodicWave to be provided".
Pass new OscillatorNode(c, {"type":"custom","periodicWave":{}}) did not throw an exception.
Pass new OscillatorNode(c, {periodicWave: null} threw TypeError: "Not an object of type PeriodicWave".
Pass < [constructor options] All assertions passed. (total 11 assertions)
Pass # AUDIT TASK RUNNER FINISHED: 5 tasks ran successfully.