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