blob: 6d49104614a365ccea2b164e2b1ddba6661fd531 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test.js"></script>
<script src="resources/audio-testing.js"></script>
<script src="resources/audiobuffersource-testing.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Tests that AnalyserNode validates minDecibels, maxDecibels and smoothingTimeConstant values.");
var analyser;
function runTest() {
window.jsTestIsAsync = true;
var sampleRate = 44100.0;
var numberOfFrames = 32;
var context = new webkitOfflineAudioContext(1, numberOfFrames, sampleRate);
analyser = context.createAnalyser();
analyser.connect(context.destination);
// 'minDecibels' shouldn't be greater than 'maxDecibels' which defaults to -30dB.
shouldThrowErrorName("analyser.minDecibels = -20", "IndexSizeError");
// 'maxDecibels' shouldn't be less than 'minDecibels' which defaults to -100dB.
shouldThrowErrorName("analyser.maxDecibels = -120", "IndexSizeError");
// 'smoothingTimeConstant' range is between 0 and 1.
shouldThrowErrorName("analyser.smoothingTimeConstant = 2", "IndexSizeError");
context.oncomplete = finishJSTest;
context.startRendering();
}
runTest();
</script>
</body>
</html>