e1109ed077
with "experimental"). BUG= Review URL: https://codereview.chromium.org//11883025 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17105 260f80e4-7a28-3924-810f-c04153c831b5
45 lines
1.5 KiB
Dart
45 lines
1.5 KiB
Dart
library AudioContextTest;
|
|
import '../../pkg/unittest/lib/unittest.dart';
|
|
import '../../pkg/unittest/lib/html_config.dart';
|
|
import 'dart:html';
|
|
import 'dart:web_audio';
|
|
|
|
main() {
|
|
|
|
useHtmlConfiguration();
|
|
|
|
var isAudioContext =
|
|
predicate((x) => x is AudioContext, 'is an AudioContext');
|
|
|
|
test('constructorTest', () {
|
|
var ctx = new AudioContext();
|
|
expect(ctx, isNotNull);
|
|
expect(ctx, isAudioContext);
|
|
});
|
|
test('createBuffer', () {
|
|
var ctx = new AudioContext();
|
|
ArrayBufferView arrayBufferView = new Float32Array.fromList([]);
|
|
try {
|
|
// Test that native overload is chosen correctly. Native implementation
|
|
// should throw 'SyntaxError' DomException because the buffer is empty.
|
|
AudioBuffer buffer = ctx.createBuffer(arrayBufferView.buffer, false);
|
|
} catch (e) {
|
|
expect(e.name, DomException.SYNTAX);
|
|
}
|
|
});
|
|
|
|
test('audioRenames', () {
|
|
AudioContext context = new AudioContext();
|
|
GainNode gainNode = context.createGain();
|
|
gainNode.connect(context.destination, 0, 0);
|
|
expect(gainNode is GainNode, isTrue);
|
|
|
|
expect(context.createAnalyser() is AnalyserNode, isTrue);
|
|
expect(context.createChannelMerger() is ChannelMergerNode, isTrue);
|
|
expect(context.createChannelSplitter() is ChannelSplitterNode, isTrue);
|
|
expect(context.createOscillator() is OscillatorNode, isTrue);
|
|
expect(context.createPanner() is PannerNode, isTrue);
|
|
expect(context.createScriptProcessor(4096) is ScriptProcessorNode, isTrue);
|
|
});
|
|
}
|