4 <script src=
"../resources/js-test.js"></script>
5 <script src=
"resources/audio-testing.js"></script>
6 <script src=
"resoruces/compatibility.js"></script>
10 <div id=
"description"></div>
11 <div id=
"console"></div>
14 description("Basic tests for AnalyserNode.");
19 if (window
.testRunner
) {
20 testRunner
.dumpAsText();
21 testRunner
.waitUntilDone();
24 window
.jsTestIsAsync
= true;
26 context
= new AudioContext();
27 var analyser
= context
.createAnalyser();
29 if (analyser
.numberOfInputs
=== 1)
30 testPassed("AnalyserNode has one input.");
32 testFailed("AnalyserNode should have one input, not " + analyser
.numberOfInputs
+ ".");
34 if (analyser
.numberOfOutputs
=== 1)
35 testPassed("AnalyserNode has one output.");
37 testFailed("AnalyserNode should have one output.");
39 if (analyser
.minDecibels
=== -100)
40 testPassed("minDecibels default value is -100.");
42 testFailed("minDecibels default value should be -100.");
44 if (analyser
.maxDecibels
=== -30)
45 testPassed("maxDecibels default value is -30.");
47 testFailed("maxDecibels default value should be -30.");
49 if (analyser
.smoothingTimeConstant
=== 0.8)
50 testPassed("smoothingTimeConstant default value is 0.8.");
52 testFailed("smoothingTimeConstant default value should be 0.8.");
54 var expectedValue
= -50 - (1/3);
55 analyser
.minDecibels
= expectedValue
;
56 if (analyser
.minDecibels
=== expectedValue
)
57 testPassed("minDecibels value is set to " + expectedValue
+ ".")
59 testFailed("minDecibels value should be set to " + expectedValue
+ ", not " + analyser
.minDecibels
+ ".");
61 expectedValue
= -40 - (1/3);
62 analyser
.maxDecibels
= expectedValue
;
63 if (analyser
.maxDecibels
=== expectedValue
)
64 testPassed("maxDecibels value is set to " + expectedValue
+ ".")
66 testFailed("maxDecibels value should be set to " + expectedValue
+ ", not " + analyser
.maxDecibels
+ ".");