mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 08:38:00 +00:00
updating Player tests to new API
This commit is contained in:
parent
98e605c42a
commit
e190b58692
1 changed files with 10 additions and 10 deletions
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
define(["chai", "Tone/source/Player", "Tone/core/Master", "Tone/source/Oscillator",
|
define(["chai", "Tone/source/Player", "Tone/core/Master", "Tone/source/Oscillator",
|
||||||
"Tone/component/Recorder", "Tone/source/Noise", "tests/Core", "Tone/source/PulseOscillator", "tests/Common",
|
"Tone/component/Recorder", "Tone/source/Noise", "tests/Core", "Tone/source/PulseOscillator", "tests/Common",
|
||||||
"Tone/source/PWMOscillator", "Tone/source/OmniOscillator", "Tone/source/Microphone"],
|
"Tone/source/PWMOscillator", "Tone/source/OmniOscillator", "Tone/source/Microphone", "Tone/core/Buffer"],
|
||||||
function(chai, Player, Master, Oscillator, Recorder, Noise, core, PulseOscillator, Test,
|
function(chai, Player, Master, Oscillator, Recorder, Noise, core, PulseOscillator, Test,
|
||||||
PWMOscillator, OmniOscillator, Microphone){
|
PWMOscillator, OmniOscillator, Microphone, Buffer){
|
||||||
|
|
||||||
var expect = chai.expect;
|
var expect = chai.expect;
|
||||||
|
|
||||||
|
@ -48,7 +48,8 @@ function(chai, Player, Master, Oscillator, Recorder, Noise, core, PulseOscillato
|
||||||
});
|
});
|
||||||
|
|
||||||
it("can handle multiple restarts", function(done){
|
it("can handle multiple restarts", function(done){
|
||||||
var player = new Player("./testAudio/kick.mp3", function(){
|
var player = new Player("./testAudio/kick.mp3");
|
||||||
|
Buffer.onload = function(){
|
||||||
expect(player.state).to.equal("stopped");
|
expect(player.state).to.equal("stopped");
|
||||||
player.start();
|
player.start();
|
||||||
player.start();
|
player.start();
|
||||||
|
@ -57,20 +58,19 @@ function(chai, Player, Master, Oscillator, Recorder, Noise, core, PulseOscillato
|
||||||
expect(player.state).to.equal("stopped");
|
expect(player.state).to.equal("stopped");
|
||||||
player.dispose();
|
player.dispose();
|
||||||
done();
|
done();
|
||||||
});
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
it("can be created with an options object", function(done){
|
it("can be created with an options object", function(done){
|
||||||
var player = new Player({
|
var player = new Player({
|
||||||
"url" : "./testAudio/kick.mp3",
|
"url" : "./testAudio/kick.mp3",
|
||||||
"onload" : function(pl){
|
|
||||||
expect(pl).to.equal(player);
|
|
||||||
expect(player.loop).to.be.true;
|
|
||||||
player.dispose();
|
|
||||||
done();
|
|
||||||
},
|
|
||||||
"loop" : true
|
"loop" : true
|
||||||
});
|
});
|
||||||
|
Buffer.onload = function(){
|
||||||
|
expect(player.loop).to.be.true;
|
||||||
|
player.dispose();
|
||||||
|
done();
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
it("can be set with an options object", function(){
|
it("can be set with an options object", function(){
|
||||||
|
|
Loading…
Reference in a new issue