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