diff options
Diffstat (limited to 'testing/web-platform/tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquadfilternode-basic.html')
-rw-r--r-- | testing/web-platform/tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquadfilternode-basic.html | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquadfilternode-basic.html b/testing/web-platform/tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquadfilternode-basic.html new file mode 100644 index 0000000000..7e71d07302 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquadfilternode-basic.html @@ -0,0 +1,64 @@ +<!DOCTYPE html> +<html> + <head> + <title> + biquadfilternode-basic.html + </title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/webaudio/resources/audit-util.js"></script> + <script src="/webaudio/resources/audit.js"></script> + </head> + <body> + <script id="layout-test-code"> + let audit = Audit.createTaskRunner(); + + audit.define( + {label: 'test', description: 'Basic tests for BiquadFilterNode'}, + function(task, should) { + + let context = new AudioContext(); + let filter = context.createBiquadFilter(); + + should(filter.numberOfInputs, 'Number of inputs').beEqualTo(1); + + should(filter.numberOfOutputs, 'Number of outputs').beEqualTo(1); + + should(filter.type, 'Default filter type').beEqualTo('lowpass'); + + should(filter.frequency.value, 'Default frequency value') + .beEqualTo(350); + + should(filter.Q.value, 'Default Q value').beEqualTo(1); + + should(filter.gain.value, 'Default gain value').beEqualTo(0); + + // Check that all legal filter types can be set. + let filterTypeArray = [ + {type: 'lowpass'}, {type: 'highpass'}, {type: 'bandpass'}, + {type: 'lowshelf'}, {type: 'highshelf'}, {type: 'peaking'}, + {type: 'notch'}, {type: 'allpass'} + ]; + + for (let i = 0; i < filterTypeArray.length; ++i) { + should( + () => filter.type = filterTypeArray[i].type, + 'Setting filter.type to ' + filterTypeArray[i].type) + .notThrow(); + should(filter.type, 'Filter type is') + .beEqualTo(filterTypeArray[i].type); + } + + + // Check that numerical values are no longer supported + filter.type = 99; + should(filter.type, 'Setting filter.type to (invalid) 99') + .notBeEqualTo(99); + + task.done(); + }); + + audit.run(); + </script> + </body> +</html> |