Tone.js/test/tests/Instruments.js

96 lines
2.3 KiB
JavaScript
Raw Normal View History

/* global it, describe */
define(["tests/Core", "chai", "Tone/instrument/DuoSynth", "Tone/instrument/MonoSynth", "Tone/instrument/FMSynth",
2014-09-20 23:24:25 +00:00
"Tone/instrument/PolySynth", "Tone/instrument/Sampler", "Tone/instrument/MultiSampler",
"tests/Common", "Tone/instrument/Instrument", "Tone/instrument/PluckSynth"],
function(Tone, chai, DuoSynth, MonoSynth, FMSynth, PolySynth, Sampler, MultiSampler, Test, Instrument, PluckSynth){
var expect = chai.expect;
Test.onlineContext();
2014-09-20 23:24:25 +00:00
function extendsInstrument(InstrumentFactory){
var inst = new InstrumentFactory();
expect(inst).to.be.instanceOf(Instrument);
inst.dispose();
}
describe("Tone.MonoSynth", function(){
it("can be created and disposed", function(){
var ms = new MonoSynth();
ms.dispose();
2014-09-20 23:24:25 +00:00
Test.wasDisposed(ms);
});
it("extends Instrument", function(){
extendsInstrument(MonoSynth);
});
});
describe("Tone.DuoSynth", function(){
it("can be created and disposed", function(){
var ds = new DuoSynth();
ds.dispose();
2014-09-20 23:24:25 +00:00
Test.wasDisposed(ds);
});
it("extends Instrument", function(){
extendsInstrument(DuoSynth);
});
});
describe("Tone.FMSynth", function(){
it("can be created and disposed", function(){
var fms = new FMSynth();
fms.dispose();
2014-09-20 23:24:25 +00:00
Test.wasDisposed(fms);
});
it("extends Instrument", function(){
extendsInstrument(FMSynth);
});
});
describe("Tone.PolySynth", function(){
it("can be created and disposed", function(){
var ps = new PolySynth();
ps.dispose();
2014-09-20 23:24:25 +00:00
Test.wasDisposed(ps);
});
it("extends Instrument", function(){
extendsInstrument(PolySynth);
});
2014-09-20 23:24:25 +00:00
});
describe("Tone.Sampler", function(){
it("can be created and disposed", function(){
var samp = new Sampler();
samp.dispose();
2014-09-20 23:24:25 +00:00
Test.wasDisposed(samp);
});
it("extends Instrument", function(){
extendsInstrument(Sampler);
});
});
describe("Tone.MultiSampler", function(){
it("can be created and disposed", function(){
var samp = new MultiSampler();
samp.dispose();
2014-09-20 23:24:25 +00:00
Test.wasDisposed(samp);
});
it("extends Instrument", function(){
extendsInstrument(MultiSampler);
});
});
describe("Tone.PluckSynth", function(){
it("can be created and disposed", function(){
var pluck = new PluckSynth();
pluck.dispose();
Test.wasDisposed(pluck);
});
it("extends Instrument", function(){
extendsInstrument(PluckSynth);
});
});
});