| OLD | NEW |
| 1 library AudioContextTest; | 1 library AudioContextTest; |
| 2 import 'package:unittest/unittest.dart'; | 2 import 'package:unittest/unittest.dart'; |
| 3 import 'package:unittest/html_individual_config.dart'; | 3 import 'package:unittest/html_individual_config.dart'; |
| 4 import 'dart:html'; | 4 import 'dart:html'; |
| 5 import 'dart:typed_data'; | 5 import 'dart:typed_data'; |
| 6 import 'dart:web_audio'; | 6 import 'dart:web_audio'; |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 main() { | 9 main() { |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 group('functional', () { | 22 group('functional', () { |
| 23 test('constructorTest', () { | 23 test('constructorTest', () { |
| 24 if(AudioContext.supported) { | 24 if(AudioContext.supported) { |
| 25 var ctx = new AudioContext(); | 25 var ctx = new AudioContext(); |
| 26 expect(ctx, isNotNull); | 26 expect(ctx, isNotNull); |
| 27 expect(ctx, isAudioContext); | 27 expect(ctx, isAudioContext); |
| 28 } | 28 } |
| 29 }); | 29 }); |
| 30 | 30 |
| 31 test('createBuffer', () { | |
| 32 if(AudioContext.supported) { | |
| 33 var ctx = new AudioContext(); | |
| 34 Float32List view = new Float32List.fromList([]); | |
| 35 try { | |
| 36 // Test that native overload is chosen correctly. Native | |
| 37 // implementation should throw 'SyntaxError' DomException because the | |
| 38 // buffer is empty. | |
| 39 AudioBuffer buffer = ctx.createBufferFromBuffer(view.buffer, false); | |
| 40 } catch (e) { | |
| 41 expect(e.name, DomException.SYNTAX); | |
| 42 } | |
| 43 } | |
| 44 }); | |
| 45 | |
| 46 test('audioRenames', () { | 31 test('audioRenames', () { |
| 47 if(AudioContext.supported) { | 32 if(AudioContext.supported) { |
| 48 AudioContext context = new AudioContext(); | 33 AudioContext context = new AudioContext(); |
| 49 GainNode gainNode = context.createGain(); | 34 GainNode gainNode = context.createGain(); |
| 50 gainNode.connectNode(context.destination); | 35 gainNode.connectNode(context.destination); |
| 51 expect(gainNode is GainNode, isTrue); | 36 expect(gainNode is GainNode, isTrue); |
| 52 | 37 |
| 53 expect(context.createAnalyser() is AnalyserNode, isTrue); | 38 expect(context.createAnalyser() is AnalyserNode, isTrue); |
| 54 expect(context.createChannelMerger() is AudioNode, isTrue); | 39 expect(context.createChannelMerger() is AudioNode, isTrue); |
| 55 expect(context.createChannelSplitter() is AudioNode, isTrue); | 40 expect(context.createChannelSplitter() is AudioNode, isTrue); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 88 |
| 104 expect(() => oscillator.type = 7, throws); | 89 expect(() => oscillator.type = 7, throws); |
| 105 expect(oscillator.type, equals('triangle')); | 90 expect(oscillator.type, equals('triangle')); |
| 106 | 91 |
| 107 expect(() => oscillator.type = ['heap object not a string'], throws); | 92 expect(() => oscillator.type = ['heap object not a string'], throws); |
| 108 expect(oscillator.type, equals('triangle')); | 93 expect(oscillator.type, equals('triangle')); |
| 109 } | 94 } |
| 110 }); | 95 }); |
| 111 }); | 96 }); |
| 112 } | 97 } |
| OLD | NEW |