OLD | NEW |
1 library AudioContextTest; | 1 import 'dart:async'; |
2 import 'package:unittest/unittest.dart'; | |
3 import 'package:unittest/html_individual_config.dart'; | |
4 import 'dart:html'; | 2 import 'dart:html'; |
5 import 'dart:typed_data'; | 3 import 'dart:typed_data'; |
6 import 'dart:web_audio'; | 4 import 'dart:web_audio'; |
7 import 'dart:async'; | 5 |
| 6 import 'package:minitest/minitest.dart'; |
8 | 7 |
9 main() { | 8 main() { |
10 | |
11 useHtmlIndividualConfiguration(); | |
12 | |
13 var isAudioContext = | 9 var isAudioContext = |
14 predicate((x) => x is AudioContext, 'is an AudioContext'); | 10 predicate((x) => x is AudioContext, 'is an AudioContext'); |
15 | 11 |
16 group('supported', () { | 12 group('supported', () { |
17 test('supported', () { | 13 test('supported', () { |
18 expect(AudioContext.supported, true); | 14 expect(AudioContext.supported, true); |
19 }); | 15 }); |
20 }); | 16 }); |
21 | 17 |
22 group('functional', () { | 18 group('functional', () { |
23 var context; | 19 var context; |
24 if (AudioContext.supported) { | 20 if (AudioContext.supported) { |
25 context = new AudioContext(); | 21 context = new AudioContext(); |
26 } | 22 } |
27 | 23 |
28 test('constructorTest', () { | 24 test('constructorTest', () { |
29 if(AudioContext.supported) { | 25 if (AudioContext.supported) { |
30 expect(context, isNotNull); | 26 expect(context, isNotNull); |
31 expect(context, isAudioContext); | 27 expect(context, isAudioContext); |
32 } | 28 } |
33 }); | 29 }); |
34 | 30 |
35 test('audioRenames', () { | 31 test('audioRenames', () { |
36 if(AudioContext.supported) { | 32 if (AudioContext.supported) { |
37 GainNode gainNode = context.createGain(); | 33 GainNode gainNode = context.createGain(); |
38 gainNode.connectNode(context.destination); | 34 gainNode.connectNode(context.destination); |
39 expect(gainNode is GainNode, isTrue); | 35 expect(gainNode is GainNode, isTrue); |
40 | 36 |
41 expect(context.createAnalyser() is AnalyserNode, isTrue); | 37 expect(context.createAnalyser() is AnalyserNode, isTrue); |
42 expect(context.createChannelMerger() is AudioNode, isTrue); | 38 expect(context.createChannelMerger() is AudioNode, isTrue); |
43 expect(context.createChannelSplitter() is AudioNode, isTrue); | 39 expect(context.createChannelSplitter() is AudioNode, isTrue); |
44 expect(context.createOscillator() is OscillatorNode, isTrue); | 40 expect(context.createOscillator() is OscillatorNode, isTrue); |
45 expect(context.createPanner() is PannerNode, isTrue); | 41 expect(context.createPanner() is PannerNode, isTrue); |
46 expect(context.createScriptProcessor(4096) is ScriptProcessorNode, | 42 expect(context.createScriptProcessor(4096) is ScriptProcessorNode, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 expect(oscillator.type, equals('triangle')); | 86 expect(oscillator.type, equals('triangle')); |
91 | 87 |
92 // Firefox does not throw when it receives invalid values; it simply | 88 // Firefox does not throw when it receives invalid values; it simply |
93 // ignores them. | 89 // ignores them. |
94 //expect(() => oscillator.type = ['heap object not a string'], throws); | 90 //expect(() => oscillator.type = ['heap object not a string'], throws); |
95 expect(oscillator.type, equals('triangle')); | 91 expect(oscillator.type, equals('triangle')); |
96 } | 92 } |
97 }); | 93 }); |
98 }); | 94 }); |
99 } | 95 } |
OLD | NEW |