mirror of
https://github.com/servo/servo.git
synced 2025-08-18 20:05:34 +01:00
Update web-platform-tests to revision 346d5b51a122f7bb1c7747064499ef281a0200f7
This commit is contained in:
parent
581c8ba1c8
commit
79b1e6c40c
1728 changed files with 20243 additions and 5349 deletions
|
@ -0,0 +1,59 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test the IIRFilterNode Interface</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script>
|
||||
test(function(t) {
|
||||
var ac = new AudioContext();
|
||||
|
||||
function check_args(arg1, arg2, err, desc) {
|
||||
test(function() {
|
||||
assert_throws(err, function() {
|
||||
ac.createIIRFilter(arg1, arg2)
|
||||
})
|
||||
}, desc)
|
||||
}
|
||||
|
||||
check_args([], [1.0], 'NotSupportedError',
|
||||
'feedforward coefficients can not be empty');
|
||||
|
||||
check_args([1.0], [], 'NotSupportedError',
|
||||
'feedback coefficients can not be empty');
|
||||
|
||||
var coeff = new Float32Array(21)
|
||||
coeff[0] = 1.0;
|
||||
|
||||
check_args(coeff, [1.0], 'NotSupportedError',
|
||||
'more than 20 feedforward coefficients can not be used');
|
||||
|
||||
check_args([1.0], coeff, 'NotSupportedError',
|
||||
'more than 20 feedback coefficients can not be used');
|
||||
|
||||
check_args([0.0, 0.0], [1.0], 'InvalidStateError',
|
||||
'at least one feedforward coefficient must be non-zero');
|
||||
|
||||
check_args([0.5, 0.5], [0.0], 'InvalidStateError',
|
||||
'the first feedback coefficient must be non-zero');
|
||||
|
||||
}, "IIRFilterNode coefficients are checked properly");
|
||||
|
||||
test(function(t) {
|
||||
var ac = new AudioContext();
|
||||
|
||||
var frequencies = new Float32Array([-1.0, ac.sampleRate*0.5 - 1.0, ac.sampleRate]);
|
||||
var magResults = new Float32Array(3);
|
||||
var phaseResults = new Float32Array(3);
|
||||
|
||||
var filter = ac.createIIRFilter([0.5, 0.5], [1.0]);
|
||||
filter.getFrequencyResponse(frequencies, magResults, phaseResults);
|
||||
|
||||
assert_true(isNaN(magResults[0]), "Invalid input frequency should give NaN magnitude response");
|
||||
assert_true(!isNaN(magResults[1]), "Valid input frequency should not give NaN magnitude response");
|
||||
assert_true(isNaN(magResults[2]), "Invalid input frequency should give NaN magnitude response");
|
||||
assert_true(isNaN(phaseResults[0]), "Invalid input frequency should give NaN phase response");
|
||||
assert_true(!isNaN(phaseResults[1]), "Valid input frequency should not give NaN phase response");
|
||||
assert_true(isNaN(phaseResults[2]), "Invalid input frequency should give NaN phase response");
|
||||
|
||||
}, "IIRFilterNode getFrequencyResponse handles invalid frequencies properly");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue