| OLD | NEW |
| 1 // Test that constructor for the node with name |nodeName| handles the various | 1 // Test that constructor for the node with name |nodeName| handles the various |
| 2 // possible values for channelCount, channelCountMode, and | 2 // possible values for channelCount, channelCountMode, and |
| 3 // channelInterpretation. | 3 // channelInterpretation. |
| 4 function testAudioNodeOptions(context, nodeName, nodeOptions) { | 4 function testAudioNodeOptions(context, nodeName, nodeOptions) { |
| 5 if (nodeOptions === undefined) | 5 if (nodeOptions === undefined) |
| 6 nodeOptions = {}; | 6 nodeOptions = {}; |
| 7 var node; | 7 var node; |
| 8 var success = true; | 8 var success = true; |
| 9 | 9 |
| 10 // Test that we can set channelCount and that errors are thrown for invalid
values | 10 // Test that we can set channelCount and that errors are thrown for invalid
values |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 success = Should("new " + nodeName + '(c, {channelCountMode: "clamped-ma
x"}', | 105 success = Should("new " + nodeName + '(c, {channelCountMode: "clamped-ma
x"}', |
| 106 function () { | 106 function () { |
| 107 node = new window[nodeName]( | 107 node = new window[nodeName]( |
| 108 context, | 108 context, |
| 109 Object.assign({}, | 109 Object.assign({}, |
| 110 nodeOptions.additionalOptions, { | 110 nodeOptions.additionalOptions, { |
| 111 channelCountMode: "clamped-max" | 111 channelCountMode: "clamped-max" |
| 112 })); | 112 })); |
| 113 }).notThrow() && success; | 113 }).notThrow() && success; |
| 114 success = Should("node.channelCountMode", node.channelCountMode) | 114 success = Should("node.channelCountMode after invalid setter", node.chan
nelCountMode) |
| 115 .beEqualTo("clamped-max") && success; | 115 .beEqualTo("clamped-max") && success; |
| 116 | 116 |
| 117 success = Should("new " + nodeName + '(c, {channelCountMode: "explicit"}
', | 117 success = Should("new " + nodeName + '(c, {channelCountMode: "explicit"}
', |
| 118 function () { | 118 function () { |
| 119 node = new window[nodeName]( | 119 node = new window[nodeName]( |
| 120 context, | 120 context, |
| 121 Object.assign({}, | 121 Object.assign({}, |
| 122 nodeOptions.additionalOptions, { | 122 nodeOptions.additionalOptions, { |
| 123 channelCountMode: "explicit" | 123 channelCountMode: "explicit" |
| 124 })); | 124 })); |
| 125 }).notThrow() && success; | 125 }).notThrow() && success; |
| 126 success = Should("node.channelCountMode", node.channelCountMode) | 126 success = Should("node.channelCountMode", node.channelCountMode) |
| 127 .beEqualTo("explicit") && success; | 127 .beEqualTo("explicit") && success; |
| 128 | 128 |
| 129 success = Should("new " + nodeName + '(c, {channelCountMode: "foobar"}', | 129 success = Should("new " + nodeName + '(c, {channelCountMode: "foobar"}', |
| 130 function () { | 130 function () { |
| 131 node = new window[nodeName]( | 131 node = new window[nodeName]( |
| 132 context, | 132 context, |
| 133 Object.assign({}, | 133 Object.assign({}, |
| 134 nodeOptions.additionalOptions, { | 134 nodeOptions.additionalOptions, { |
| 135 channelCountMode: "foobar" | 135 channelCountMode: "foobar" |
| 136 })); | 136 })); |
| 137 }).throw("TypeError") && success; | 137 }).throw("TypeError") && success; |
| 138 success = Should("node.channelCountMode", node.channelCountMode) | 138 success = Should("node.channelCountMode after invalid setter", node.chan
nelCountMode) |
| 139 .beEqualTo("explicit") && success; | 139 .beEqualTo("explicit") && success; |
| 140 } | 140 } |
| 141 | 141 |
| 142 // Test channelInterpretation | 142 // Test channelInterpretation |
| 143 success = Should("new " + nodeName + '(c, {channelInterpretation: "speakers"
})', | 143 success = Should("new " + nodeName + '(c, {channelInterpretation: "speakers"
})', |
| 144 function () { | 144 function () { |
| 145 node = new window[nodeName]( | 145 node = new window[nodeName]( |
| 146 context, | 146 context, |
| 147 Object.assign({}, | 147 Object.assign({}, |
| 148 nodeOptions.additionalOptions, { | 148 nodeOptions.additionalOptions, { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 166 | 166 |
| 167 success = Should("new " + nodeName + '(c, {channelInterpretation: "foobar"})
', | 167 success = Should("new " + nodeName + '(c, {channelInterpretation: "foobar"})
', |
| 168 function () { | 168 function () { |
| 169 node = new window[nodeName]( | 169 node = new window[nodeName]( |
| 170 context, | 170 context, |
| 171 Object.assign({}, | 171 Object.assign({}, |
| 172 nodeOptions.additionalOptions, { | 172 nodeOptions.additionalOptions, { |
| 173 channelInterpretation: "foobar" | 173 channelInterpretation: "foobar" |
| 174 })); | 174 })); |
| 175 }).throw("TypeError") && success; | 175 }).throw("TypeError") && success; |
| 176 success = Should("node.channelInterpretation", node.channelInterpretation) | 176 success = Should("node.channelInterpretation after invalid setter", node.cha
nnelInterpretation) |
| 177 .beEqualTo("discrete") && success; | 177 .beEqualTo("discrete") && success; |
| 178 | 178 |
| 179 | 179 |
| 180 Should("AudioNodeOptions for " + nodeName, success) | 180 Should("AudioNodeOptions for " + nodeName, success) |
| 181 .summarize( | 181 .summarize( |
| 182 "were correctly handled", | 182 "were correctly handled", |
| 183 "were not correctly handled"); | 183 "were not correctly handled"); |
| 184 } | 184 } |
| OLD | NEW |