| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test Constructor: DynamicsCompressor</title> | 4 <title>Test Constructor: DynamicsCompressor</title> |
| 5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <script src="../resources/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
| 8 <script src="../resources/audio-testing.js"></script> | 8 <script src="../resources/audio-testing.js"></script> |
| 9 <script src="audionodeoptions.js"></script> | 9 <script src="audionodeoptions.js"></script> |
| 10 </head> | 10 </head> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 "correctly threw errors", | 41 "correctly threw errors", |
| 42 "did not throw errors in all cases"); | 42 "did not throw errors in all cases"); |
| 43 | 43 |
| 44 taskDone(); | 44 taskDone(); |
| 45 }); | 45 }); |
| 46 | 46 |
| 47 audit.defineTask("default constructor", function (taskDone) { | 47 audit.defineTask("default constructor", function (taskDone) { |
| 48 var node; | 48 var node; |
| 49 var success = true; | 49 var success = true; |
| 50 | 50 |
| 51 success = Should("node = new DynamicsCompressorNode(context)", function
() { | 51 success = Should("node0 = new DynamicsCompressorNode(context)", function
() { |
| 52 node = new DynamicsCompressorNode(context); | 52 node = new DynamicsCompressorNode(context); |
| 53 }).notThrow(); | 53 }).notThrow(); |
| 54 success = Should("node instanceof DynamicsCompressorNode", | 54 success = Should("node0 instanceof DynamicsCompressorNode", |
| 55 node instanceof DynamicsCompressorNode) | 55 node instanceof DynamicsCompressorNode) |
| 56 .beEqualTo(true) && success; | 56 .beEqualTo(true) && success; |
| 57 | 57 |
| 58 success = Should("node.threshold.value", node.threshold.value) | 58 success = Should("node0.threshold.value", node.threshold.value) |
| 59 .beEqualTo(-24) && success; | 59 .beEqualTo(-24) && success; |
| 60 success = Should("node.knee.value", node.knee.value) | 60 success = Should("node0.knee.value", node.knee.value) |
| 61 .beEqualTo(30) && success; | 61 .beEqualTo(30) && success; |
| 62 success = Should("node.ratio.value", node.ratio.value) | 62 success = Should("node0.ratio.value", node.ratio.value) |
| 63 .beEqualTo(12) && success; | 63 .beEqualTo(12) && success; |
| 64 success = Should("node.reduction", node.reduction) | 64 success = Should("node0.reduction", node.reduction) |
| 65 .beEqualTo(0) && success; | 65 .beEqualTo(0) && success; |
| 66 success = Should("node.attack.value", node.attack.value) | 66 success = Should("node0.attack.value", node.attack.value) |
| 67 .beEqualTo(Math.fround(0.003)) && success; | 67 .beEqualTo(Math.fround(0.003)) && success; |
| 68 success = Should("node.release.value", node.release.value) | 68 success = Should("node0.release.value", node.release.value) |
| 69 .beEqualTo(0.25) && success; | 69 .beEqualTo(0.25) && success; |
| 70 | 70 |
| 71 success = Should("node.channelCount", node.channelCount) | 71 success = Should("node0.channelCount", node.channelCount) |
| 72 .beEqualTo(2) && success; | 72 .beEqualTo(2) && success; |
| 73 success = Should("node.channelCountMode", node.channelCountMode) | 73 success = Should("node0.channelCountMode", node.channelCountMode) |
| 74 .beEqualTo("max") && success; | 74 .beEqualTo("max") && success; |
| 75 success = Should("node.channelInterpretation", node.channelInterpretatio
n) | 75 success = Should("node0.channelInterpretation", node.channelInterpretati
on) |
| 76 .beEqualTo("speakers") && success; | 76 .beEqualTo("speakers") && success; |
| 77 | 77 |
| 78 Should("new DynamicsCompressorNode(context)", success) | 78 Should("new DynamicsCompressorNode(context)", success) |
| 79 .summarize( | 79 .summarize( |
| 80 "constructed node with correct attributes", | 80 "constructed node with correct attributes", |
| 81 "did not construct correct node correctly") | 81 "did not construct correct node correctly") |
| 82 | 82 |
| 83 taskDone(); | 83 taskDone(); |
| 84 }); | 84 }); |
| 85 | 85 |
| 86 audit.defineTask("test AudioNodeOptions", function (taskDone) { | 86 audit.defineTask("test AudioNodeOptions", function (taskDone) { |
| 87 testAudioNodeOptions(context, "DynamicsCompressorNode"); | 87 testAudioNodeOptions(context, "DynamicsCompressorNode"); |
| 88 taskDone(); | 88 taskDone(); |
| 89 }); | 89 }); |
| 90 | 90 |
| 91 audit.defineTask("constructor with options", function (taskDone) { | 91 audit.defineTask("constructor with options", function (taskDone) { |
| 92 var node; | 92 var node; |
| 93 var success = true; | 93 var success = true; |
| 94 var options = { | 94 var options = { |
| 95 threshold: -33, | 95 threshold: -33, |
| 96 knee: 15, | 96 knee: 15, |
| 97 ratio: 7, | 97 ratio: 7, |
| 98 attack: 0.625, | 98 attack: 0.625, |
| 99 release: 0.125 | 99 release: 0.125 |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 success = Should("node = new DynamicsCompressorNode(c, " + JSON.stringif
y(options) + | 102 success = Should("node1 = new DynamicsCompressorNode(c, " + JSON.stringi
fy(options) + |
| 103 ")", | 103 ")", |
| 104 function () { | 104 function () { |
| 105 node = new DynamicsCompressorNode(context, options); | 105 node = new DynamicsCompressorNode(context, options); |
| 106 }).notThrow(); | 106 }).notThrow(); |
| 107 success = Should("node instanceof DynamicsCompressorNode", | 107 success = Should("node1 instanceof DynamicsCompressorNode", |
| 108 node instanceof DynamicsCompressorNode) | 108 node instanceof DynamicsCompressorNode) |
| 109 .beEqualTo(true) && success; | 109 .beEqualTo(true) && success; |
| 110 | 110 |
| 111 success = Should("node.threshold.value", node.threshold.value) | 111 success = Should("node1.threshold.value", node.threshold.value) |
| 112 .beEqualTo(options.threshold) && success; | 112 .beEqualTo(options.threshold) && success; |
| 113 success = Should("node.knee.value", node.knee.value) | 113 success = Should("node1.knee.value", node.knee.value) |
| 114 .beEqualTo(options.knee) && success; | 114 .beEqualTo(options.knee) && success; |
| 115 success = Should("node.ratio.value", node.ratio.value) | 115 success = Should("node1.ratio.value", node.ratio.value) |
| 116 .beEqualTo(options.ratio) && success; | 116 .beEqualTo(options.ratio) && success; |
| 117 success = Should("node.attack.value", node.attack.value) | 117 success = Should("node1.attack.value", node.attack.value) |
| 118 .beEqualTo(options.attack) && success; | 118 .beEqualTo(options.attack) && success; |
| 119 success = Should("node.release.value", node.release.value) | 119 success = Should("node1.release.value", node.release.value) |
| 120 .beEqualTo(options.release) && success; | 120 .beEqualTo(options.release) && success; |
| 121 | 121 |
| 122 success = Should("node.channelCount", node.channelCount) | 122 success = Should("node1.channelCount", node.channelCount) |
| 123 .beEqualTo(2) && success; | 123 .beEqualTo(2) && success; |
| 124 success = Should("node.channelCountMode", node.channelCountMode) | 124 success = Should("node1.channelCountMode", node.channelCountMode) |
| 125 .beEqualTo("max") && success; | 125 .beEqualTo("max") && success; |
| 126 success = Should("node.channelInterpretation", node.channelInterpretatio
n) | 126 success = Should("node1.channelInterpretation", node.channelInterpretati
on) |
| 127 .beEqualTo("speakers") && success; | 127 .beEqualTo("speakers") && success; |
| 128 | 128 |
| 129 success = Should("DynamicsCompressorNode(context) constructed with corre
ct values", | 129 success = Should("DynamicsCompressorNode(context) constructed with corre
ct values", |
| 130 success) | 130 success) |
| 131 .beEqualTo(true); | 131 .beEqualTo(true); |
| 132 | 132 |
| 133 taskDone(); | 133 taskDone(); |
| 134 }); | 134 }); |
| 135 | 135 |
| 136 | 136 |
| 137 audit.runTasks(); | 137 audit.runTasks(); |
| 138 </script> | 138 </script> |
| 139 </body> | 139 </body> |
| 140 </html> | 140 </html> |
| OLD | NEW |