Tests for requestAnimationFrame and cancelAnimationFrame

This commit is contained in:
Ian Gilman 2013-05-23 09:48:53 -07:00
parent 8f53c564da
commit 1c60f90ee5

View File

@ -62,4 +62,30 @@
});
});
// ----------
asyncTest("requestAnimationFrame", function() {
var timeWatcher = Util.timeWatcher();
OpenSeadragon.requestAnimationFrame(function() {
ok(true, 'frame fired');
timeWatcher.done();
});
});
// ----------
asyncTest("cancelAnimationFrame", function() {
var frameFired = false;
setTimeout(function() {
strictEqual(frameFired, false, 'the frame never fired');
start();
}, 150);
var frameId = OpenSeadragon.requestAnimationFrame(function() {
frameFired = true;
});
OpenSeadragon.cancelAnimationFrame(frameId);
});
})();