| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/testharness.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> | 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script src="../resources/audit-util.js"></script> | 6 <script src="../resources/audit-util.js"></script> |
| 7 <script src="../resources/audio-testing.js"></script> | 7 <script src="../resources/audio-testing.js"></script> |
| 8 <script src="../resources/realtimeanalyser-testing.js"></script> | 8 <script src="../resources/realtimeanalyser-testing.js"></script> |
| 9 <script src="../resources/fft.js"></script> | 9 <script src="../resources/fft.js"></script> |
| 10 <title>Test Analyser getFloatFrequencyData and getByteFrequencyData, No Smoo
thing</title> | 10 <title>Test Analyser getFloatFrequencyData and getByteFrequencyData, No Smoo
thing</title> |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 basicTestsPassed = basicTestsPassed && comparison.success; | 170 basicTestsPassed = basicTestsPassed && comparison.success; |
| 171 var expected = comparison.expected; | 171 var expected = comparison.expected; |
| 172 | 172 |
| 173 // For the byte test to be better, check that there are some samples t
hat are outside the | 173 // For the byte test to be better, check that there are some samples t
hat are outside the |
| 174 // range of minDecibels and maxDecibels. If there aren't the test sho
uld update the | 174 // range of minDecibels and maxDecibels. If there aren't the test sho
uld update the |
| 175 // minDecibels and maxDecibels values for the analyser. | 175 // minDecibels and maxDecibels values for the analyser. |
| 176 | 176 |
| 177 var minValue = Math.min(...expected); | 177 var minValue = Math.min(...expected); |
| 178 var maxValue = Math.max(...expected); | 178 var maxValue = Math.max(...expected); |
| 179 | 179 |
| 180 basicTestsPassed = Should("Min FFT value", minValue, { | 180 basicTestsPassed = Should("Order: " + options.order + |
| 181 brief: true | 181 ": Min FFT value", minValue, { |
| 182 }) | 182 brief: true |
| 183 }) |
| 183 .beLessThanOrEqualTo(analyser.minDecibels) && basicTestsPassed; | 184 .beLessThanOrEqualTo(analyser.minDecibels) && basicTestsPassed; |
| 184 basicTestsPassed = Should("Max FFT value", maxValue, { | 185 basicTestsPassed = Should("Order: " + options.order + |
| 185 brief: true | 186 ": Max FFT value", maxValue, { |
| 186 }) | 187 brief: true |
| 188 }) |
| 187 .beGreaterThanOrEqualTo(analyser.maxDecibels) && basicTestsPassed; | 189 .beGreaterThanOrEqualTo(analyser.maxDecibels) && basicTestsPassed; |
| 188 | |
| 189 // Test the byte frequency data. | 190 // Test the byte frequency data. |
| 190 var byteFreqData = new Uint8Array(analyser.frequencyBinCount); | 191 var byteFreqData = new Uint8Array(analyser.frequencyBinCount); |
| 191 var expectedByteData = new Float32Array(analyser.frequencyBinCount); | 192 var expectedByteData = new Float32Array(analyser.frequencyBinCount); |
| 192 analyser.getByteFrequencyData(byteFreqData); | 193 analyser.getByteFrequencyData(byteFreqData); |
| 193 | 194 |
| 194 // Convert the expected float frequency data to byte data. | 195 // Convert the expected float frequency data to byte data. |
| 195 var expectedByteData = convertFloatToByte(expected, analyser.minDecibe
ls, | 196 var expectedByteData = convertFloatToByte(expected, analyser.minDecibe
ls, |
| 196 analyser.maxDecibels); | 197 analyser.maxDecibels); |
| 197 | 198 |
| 198 basicTestsPassed = Should(analyser.fftSize + "-point byte FFT", byteFr
eqData) | 199 basicTestsPassed = Should(analyser.fftSize + "-point byte FFT", byteFr
eqData) |
| 199 .beCloseToArray(expectedByteData, 0) && basicTestsPassed; | 200 .beCloseToArray(expectedByteData, 0) && basicTestsPassed; |
| 200 | 201 |
| 201 }).then(context.resume.bind(context)); | 202 }).then(context.resume.bind(context)); |
| 202 | 203 |
| 203 return context.startRendering(); | 204 return context.startRendering(); |
| 204 } | 205 } |
| 205 </script> | 206 </script> |
| 206 </body> | 207 </body> |
| 207 </html> | 208 </html> |
| OLD | NEW |