| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 | |
| 3 <html> | |
| 4 <head> | |
| 5 <script src="../resources/js-test.js"></script> | |
| 6 <script src="resources/compatibility.js"></script> | |
| 7 <script src="resources/audit-util.js"></script> | |
| 8 <script src="resources/audio-testing.js"></script> | |
| 9 </head> | |
| 10 | |
| 11 <body> | |
| 12 <div id="description"></div> | |
| 13 <div id="console"></div> | |
| 14 | |
| 15 <script> | |
| 16 description("Basic tests for DynamicsCompressorNode API."); | |
| 17 | |
| 18 var context; | |
| 19 var compressor; | |
| 20 | |
| 21 function runTest() { | |
| 22 if (window.testRunner) { | |
| 23 testRunner.dumpAsText(); | |
| 24 testRunner.waitUntilDone(); | |
| 25 } | |
| 26 | |
| 27 window.jsTestIsAsync = true; | |
| 28 | |
| 29 context = new AudioContext(); | |
| 30 compressor = context.createDynamicsCompressor(); | |
| 31 | |
| 32 try { | |
| 33 if (compressor.threshold.value == -24) | |
| 34 testPassed("threshold attribute has correct default value."); | |
| 35 else | |
| 36 testFailed("threshold attribute has incorrect default value."); | |
| 37 | |
| 38 if (compressor.knee.value == 30) | |
| 39 testPassed("knee attribute has correct default value."); | |
| 40 else | |
| 41 testFailed("knee attribute has incorrect default value."); | |
| 42 | |
| 43 if (compressor.ratio.value == 12) | |
| 44 testPassed("ratio attribute has correct default value."); | |
| 45 else | |
| 46 testFailed("ratio attribute has incorrect default value."); | |
| 47 | |
| 48 if (compressor.attack.value === Math.fround(0.003)) | |
| 49 testPassed("attack attribute has correct default value."); | |
| 50 else | |
| 51 testFailed("attack attribute has incorrect default value."); | |
| 52 | |
| 53 if (compressor.release.value === 0.25) | |
| 54 testPassed("release attribute has correct default value."); | |
| 55 else | |
| 56 testFailed("release attribute has incorrect default value."); | |
| 57 | |
| 58 if (typeof compressor.reduction === "number") { | |
| 59 testPassed("reduction attribute is a number.") | |
| 60 if (compressor.reduction == 0) | |
| 61 testPassed("reduction attribute has correct default value.") | |
| 62 } else { | |
| 63 testFailed("reduction attribute is an " + compressor.reduction.const
ructor.name + " not a number."); | |
| 64 } | |
| 65 | |
| 66 } catch(e) { | |
| 67 testFailed("Exception thrown when accessing DynamicsCompressorNode attri
butes."); | |
| 68 } | |
| 69 | |
| 70 finishJSTest(); | |
| 71 } | |
| 72 | |
| 73 runTest(); | |
| 74 | |
| 75 </script> | |
| 76 | |
| 77 </body> | |
| 78 </html> | |
| OLD | NEW |