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 </head> | |
7 <body> | |
8 <script> | |
9 description("Tests the OfflineAudioContext constructor"); | |
10 | |
11 var context; | |
12 // Make sure we don't crash when giving 0 as number of frames. | |
13 shouldThrow("new OfflineAudioContext(1, 0, 44100)"); | |
14 // Make sure we don't throw exceptions for supported ranges of sample rates for
an OfflineAudioContext. | |
15 shouldThrow("context = new OfflineAudioContext(2, 512, 2999)"); | |
16 shouldNotThrow("context = new OfflineAudioContext(2, 512, 3000)"); | |
17 shouldBeEqualToNumber("context.length", 512); | |
18 shouldNotThrow("context = new OfflineAudioContext(2, 1024, 384000)"); | |
19 shouldBeEqualToNumber("context.length", 1024); | |
20 shouldThrow("context = new OfflineAudioContext(2, 1024, 384001)"); | |
21 shouldNotThrow("context = new OfflineAudioContext(2, 2048, 8000)"); | |
22 shouldBeEqualToNumber("context.length", 2048); | |
23 shouldNotThrow("context = new OfflineAudioContext(2, 4096, 11025)"); | |
24 shouldBeEqualToNumber("context.length", 4096); | |
25 shouldNotThrow("context = new OfflineAudioContext(2, 512, 22050)"); | |
26 shouldBeEqualToNumber("context.length", 512); | |
27 shouldNotThrow("context = new OfflineAudioContext(2, 512, 44100)"); | |
28 shouldBeEqualToNumber("context.length", 512); | |
29 shouldNotThrow("context = new OfflineAudioContext(2, 512, 48000)"); | |
30 shouldBeEqualToNumber("context.length", 512); | |
31 shouldNotThrow("context = new OfflineAudioContext(2, 512, 88200)"); | |
32 shouldBeEqualToNumber("context.length", 512); | |
33 // Make sure length is read-only. | |
34 shouldNotThrow("context.length = 99"); | |
35 shouldBeEqualToNumber("context.length", 512); | |
36 shouldNotThrow("context = new OfflineAudioContext(2, 512, 96000)"); | |
37 // Make sure we throw exceptions for non-finite sample rates. | |
38 shouldThrow("context = new OfflineAudioContext(1, 0, NaN)"); | |
39 shouldThrow("context = new OfflineAudioContext(1, 0, Infinity)"); | |
40 // Verify channel counts and other destination attributes are set correctly. | |
41 shouldNotThrow("context = new OfflineAudioContext(7, 512, 48000)"); | |
42 shouldBeEqualToNumber("context.destination.channelCount", 7); | |
43 shouldBeEqualToNumber("context.destination.maxChannelCount", 7); | |
44 shouldBeEqualToString("context.destination.channelCountMode", "explicit"); | |
45 shouldBeEqualToString("context.destination.channelInterpretation", "speakers"); | |
46 </script> | |
47 </body> | |
48 </html> | |
OLD | NEW |