summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webaudio/the-audio-api/the-periodicwave-interface/createPeriodicWaveInfiniteValuesThrows.html
blob: 928f45bd8feb70fbc7d59da367a08028a456477c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!doctype html>
<meta charset=utf-8>
<title>Test AudioContext.createPeriodicWave when inputs contain Infinite values</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
let ctx;
setup(() => {
  ctx = new OfflineAudioContext({length: 1, sampleRate: 24000});
});
test(() => {
  const real = new Float32Array([0, Infinity]);
  const imag = new Float32Array([0, 1]);
  assert_throws_js(TypeError, () => ctx.createPeriodicWave(real, imag));
}, "createPeriodicWave with Infinity real values should throw");

test(() => {
  const real = new Float32Array([0, 1]);
  const imag = new Float32Array([1, Infinity]);
  assert_throws_js(TypeError, () => ctx.createPeriodicWave(real, imag));
}, "createPeriodicWave with Infinity imag values should throw");
</script>