Tone.js/test/effect/Convolver.js

62 lines
1.2 KiB
JavaScript
Raw Normal View History

define(["Tone/effect/Convolver", "helper/Basic", "helper/EffectTests", "Tone/core/Buffer"],
function (Convolver, Basic, EffectTests, Buffer) {
if (window.__karma__){
Buffer.baseUrl = "/base/test/";
}
2016-08-09 18:59:38 +00:00
describe("Convolver", function(){
2015-08-28 03:02:08 +00:00
Basic(Convolver);
var ir = new Buffer();
var testFile = "./audio/sineStereo.wav";
2016-03-05 05:07:17 +00:00
before(function(done){
2016-03-05 05:07:17 +00:00
ir.load(testFile, function(){
done();
});
});
2016-11-22 18:31:06 +00:00
EffectTests(Convolver, ir);
context("API", function(){
2015-08-28 03:02:08 +00:00
it ("can pass in options in the constructor", function(){
var convolver = new Convolver({
2016-03-05 05:07:17 +00:00
"url" : testFile,
});
convolver.dispose();
});
2015-08-28 03:02:08 +00:00
it ("invokes the onload function when loaded", function(done){
var convolver = new Convolver({
2016-03-05 05:07:17 +00:00
"url" : testFile,
2015-08-28 03:02:08 +00:00
"onload" : function(){
convolver.dispose();
done();
}
});
});
2016-11-22 18:31:06 +00:00
it ("load returns a Promise", function(done){
var convolver = new Convolver();
convolver.load(testFile).then(function(){
convolver.dispose();
done();
});
});
it ("load invokes the second callback", function(done){
var convolver = new Convolver();
convolver.load(testFile, function(){
convolver.dispose();
done();
});
});
});
});
});