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> | |
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 webkitAudioContext(); | |
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 analyser.minDecibels = -50.0 - (1/3); | |
54 if (analyser.minDecibels === -50.0 - (1/3)) | |
Raymond Toy
2014/03/28 16:10:06
Change lines 53-57 to
var expectedValue = -50 - (
| |
55 testPassed("minDecibels value is set to -50.333333333333336."); | |
56 else | |
57 testFailed("minDecibels value should be set to -50.333333333333336, not " + analyser.minDecibels + "."); | |
58 | |
59 analyser.maxDecibels = -40.0 - (1/3); | |
Raymond Toy
2014/03/28 16:10:06
Same as above.
| |
60 if (analyser.maxDecibels === -40.0 - (1/3)) | |
61 testPassed("maxDecibels value is set to -40.333333333333336."); | |
62 else | |
63 testFailed("maxDecibels value should be set to -40.333333333333336, not " + analyser.maxDecibels + "."); | |
64 | |
65 finishJSTest(); | |
66 } | |
67 | |
68 runTest(); | |
69 | |
70 </script> | |
71 | |
72 </body> | |
73 </html> | |
OLD | NEW |