| OLD | NEW |
| 1 var StereoPannerTest = (function () { | 1 var StereoPannerTest = (function () { |
| 2 | 2 |
| 3 // Constants | 3 // Constants |
| 4 var PI_OVER_TWO = Math.PI * 0.5; | 4 var PI_OVER_TWO = Math.PI * 0.5; |
| 5 | 5 |
| 6 var gSampleRate = 44100; | 6 var gSampleRate = 44100; |
| 7 | 7 |
| 8 // Time step when each panner node starts. | 8 // Time step when each panner node starts. |
| 9 var gTimeStep = 0.001; | 9 var gTimeStep = 0.001; |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 * @param {Object} options Test options | 47 * @param {Object} options Test options |
| 48 * @param {Object} options.description Test description | 48 * @param {Object} options.description Test description |
| 49 * @param {Object} options.numberOfInputChannels Number of input channels | 49 * @param {Object} options.numberOfInputChannels Number of input channels |
| 50 */ | 50 */ |
| 51 function Test(options) { | 51 function Test(options) { |
| 52 | 52 |
| 53 // Primary test flag. | 53 // Primary test flag. |
| 54 this.success = true; | 54 this.success = true; |
| 55 | 55 |
| 56 this.context = null; | 56 this.context = null; |
| 57 this.prefix = options.prefix; |
| 57 this.numberOfInputChannels = (options.numberOfInputChannels || 1); | 58 this.numberOfInputChannels = (options.numberOfInputChannels || 1); |
| 58 switch (this.numberOfInputChannels) { | 59 switch (this.numberOfInputChannels) { |
| 59 case 1: | 60 case 1: |
| 60 this.description = 'Test for mono input'; | 61 this.description = 'Test for mono input'; |
| 61 break; | 62 break; |
| 62 case 2: | 63 case 2: |
| 63 this.description = 'Test for stereo input'; | 64 this.description = 'Test for stereo input'; |
| 64 break; | 65 break; |
| 65 } | 66 } |
| 66 | 67 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 }); | 170 }); |
| 170 } | 171 } |
| 171 | 172 |
| 172 this.impulseIndex++; | 173 this.impulseIndex++; |
| 173 } | 174 } |
| 174 } | 175 } |
| 175 }; | 176 }; |
| 176 | 177 |
| 177 | 178 |
| 178 Test.prototype.showResult = function () { | 179 Test.prototype.showResult = function () { |
| 179 Should("Number of impulses found", this.impulseIndex) | 180 Should(this.prefix + "Number of impulses found", this.impulseIndex) |
| 180 .beEqualTo(gNodesToCreate); | 181 .beEqualTo(gNodesToCreate); |
| 181 | 182 |
| 182 Should("Number of impulse at the wrong offset", this.errors.length) | 183 Should(this.prefix + "Number of impulse at the wrong offset", this.errors.le
ngth) |
| 183 .beEqualTo(0); | 184 .beEqualTo(0); |
| 184 | 185 |
| 185 Should("Left channel error magnitude", this.maxErrorL) | 186 Should(this.prefix + "Left channel error magnitude", this.maxErrorL) |
| 186 .beLessThanOrEqualTo(this.maxAllowedError); | 187 .beLessThanOrEqualTo(this.maxAllowedError); |
| 187 | 188 |
| 188 Should("Right channel error magnitude", this.maxErrorR) | 189 Should(this.prefix + "Right channel error magnitude", this.maxErrorR) |
| 189 .beLessThanOrEqualTo(this.maxAllowedError); | 190 .beLessThanOrEqualTo(this.maxAllowedError); |
| 190 }; | 191 }; |
| 191 | 192 |
| 192 | 193 |
| 193 Test.prototype.finish = function () { | 194 Test.prototype.finish = function () { |
| 194 Should(this.description, this.success) | 195 Should(this.description, this.success) |
| 195 .summarize('passed', 'failed'); | 196 .summarize('passed', 'failed'); |
| 196 }; | 197 }; |
| 197 | 198 |
| 198 | 199 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 214 | 215 |
| 215 | 216 |
| 216 return { | 217 return { |
| 217 create: function (options) { | 218 create: function (options) { |
| 218 return new Test(options); | 219 return new Test(options); |
| 219 } | 220 } |
| 220 }; | 221 }; |
| 221 | 222 |
| 222 })(); | 223 })(); |
| 223 | 224 |
| OLD | NEW |