OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <script src="../resources/js-test.js"></script> | |
5 <script src="resources/audio-testing.js"></script> | |
Raymond Toy
2014/03/31 16:47:55
Add
<script src="resoruces/compatibility.js"></sc
KhNo
2014/03/31 17:13:19
Done.
| |
6 </head> | |
7 | |
8 <body> | |
9 <div id="description"></div> | |
10 <div id="console"></div> | |
11 | |
12 <script> | |
13 description("Basic tests for AnalyserNode."); | |
14 | |
15 var context = 0; | |
16 | |
17 function runTest() { | |
18 if (window.testRunner) { | |
19 testRunner.dumpAsText(); | |
20 testRunner.waitUntilDone(); | |
21 } | |
22 | |
23 window.jsTestIsAsync = true; | |
24 | |
25 context = new AudioContext(); | |
26 var analyser = context.createAnalyser(); | |
27 | |
28 if (analyser.numberOfInputs === 1) | |
29 testPassed("AnalyserNode has one input."); | |
30 else | |
31 testFailed("AnalyserNode should have one input, not " + analyser.numberO fInputs + "."); | |
32 | |
33 if (analyser.numberOfOutputs === 1) | |
34 testPassed("AnalyserNode has one output."); | |
35 else | |
36 testFailed("AnalyserNode should have one output."); | |
37 | |
38 if (analyser.minDecibels === -100) | |
39 testPassed("minDecibels default value is -100."); | |
40 else | |
41 testFailed("minDecibels default value should be -100."); | |
42 | |
43 if (analyser.maxDecibels === -30) | |
44 testPassed("maxDecibels default value is -30."); | |
45 else | |
46 testFailed("maxDecibels default value should be -30."); | |
47 | |
48 if (analyser.smoothingTimeConstant === 0.8) | |
49 testPassed("smoothingTimeConstant default value is 0.8."); | |
50 else | |
51 testFailed("smoothingTimeConstant default value should be 0.8."); | |
52 | |
53 var expectedValue = -50 - (1/3); | |
54 analyser.minDecibels = expectedValue; | |
55 if (analyser.minDecibels === expectedValue) | |
56 testPassed("minDecibels value is set to " + expectedValue + ".") | |
57 else | |
58 testFailed("minDecibels value should be set to " + expectedValue + ", no t " + analyser.minDecibels + "."); | |
59 | |
60 expectedValue = -40 - (1/3); | |
61 analyser.maxDecibels = expectedValue; | |
62 if (analyser.maxDecibels === expectedValue) | |
63 testPassed("maxDecibels value is set to " + expectedValue + ".") | |
64 else | |
65 testFailed("maxDecibels value should be set to " + expectedValue + ", no t " + analyser.maxDecibels + "."); | |
66 | |
67 finishJSTest(); | |
68 } | |
69 | |
70 runTest(); | |
71 | |
72 </script> | |
73 | |
74 </body> | |
75 </html> | |
OLD | NEW |