OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../resources/js-test.js"></script> |
| 5 <script src="resources/compatibility.js"></script> |
| 6 <script src="resources/audio-testing.js"></script> |
| 7 <title>Test Supported Number of Channels for ConvolverNode</title> |
| 8 </head> |
| 9 |
| 10 <body> |
| 11 <script> |
| 12 description("Test Supported Number of Channels for ConvolverNode"); |
| 13 window.jsTestIsAsync = true; |
| 14 |
| 15 var audit = Audit.createTaskRunner(); |
| 16 |
| 17 audit.defineTask("channel-count-test", function (done) { |
| 18 // Just need a context to create nodes on, so any allowed length and rat
e is ok. |
| 19 var context = new OfflineAudioContext(1, 1, 48000); |
| 20 |
| 21 var success = true; |
| 22 |
| 23 for (var count = 1; count <= 32; ++count) { |
| 24 var convolver = context.createConvolver(); |
| 25 var buffer = context.createBuffer(count, 1, context.sampleRate); |
| 26 var message = "ConvolverNode with buffer of " + count + " channels"; |
| 27 |
| 28 if (count == 1 || count == 2 || count == 4) { |
| 29 // These are the only valid channel counts for the buffer. |
| 30 success = Should(message, function () { |
| 31 convolver.buffer = buffer; |
| 32 }).notThrow() && success; |
| 33 } else { |
| 34 success = Should(message, function () { |
| 35 convolver.buffer = buffer; |
| 36 }).throw("NotSupportedError") && success; |
| 37 } |
| 38 } |
| 39 |
| 40 if (success) |
| 41 testPassed("Multiple channels for the convolver correctly handled."); |
| 42 else |
| 43 testFailed("Multiple channels for the convolver were not correctly han
dled."); |
| 44 |
| 45 done(); |
| 46 }); |
| 47 |
| 48 audit.defineTask("finish", function (done) { |
| 49 finishJSTest(); |
| 50 done(); |
| 51 }); |
| 52 |
| 53 audit.runTasks(); |
| 54 </script> |
| 55 </body> |
| 56 </html> |
OLD | NEW |