Bug 878497 - Add a test case for AudioParam.setValueAtTime; r=roc

This commit is contained in:
Ehsan Akhgari 2013-06-02 09:25:16 -04:00
parent 2926cba94f
commit 7bb5a36eda
2 changed files with 53 additions and 0 deletions

View File

@ -35,6 +35,7 @@ MOCHITEST_FILES := \
test_audioParamSetCurveAtTime.html \
test_audioParamSetCurveAtTimeZeroDuration.html \
test_audioParamSetTargetAtTime.html \
test_audioParamSetValueAtTime.html \
test_audioParamTimelineDestinationOffset.html \
test_audioBufferSourceNode.html \
test_audioBufferSourceNodeEnded.html \

View File

@ -0,0 +1,52 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test AudioParam.linearRampToValue</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="webaudio.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var V0 = 0.1;
var V1 = 0.9;
var T0 = 0;
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
var sourceBuffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
sourceBuffer.getChannelData(0)[i] = 1;
}
var source = context.createBufferSource();
source.buffer = sourceBuffer;
var gain = context.createGain();
gain.gain.value = 0;
gain.gain.setValueAtTime(V0, 1024/context.sampleRate);
source.connect(gain);
source.start(0);
return gain;
},
createExpectedBuffers: function(context) {
var expectedBuffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 1024; i < 2048; ++i) {
expectedBuffer.getChannelData(0)[i] = 0.1;
}
return expectedBuffer;
},
};
runTest();
</script>
</pre>
</body>
</html>