diff --git a/test/utils.js b/test/utils.js index 3b7d6c49..7489f03b 100644 --- a/test/utils.js +++ b/test/utils.js @@ -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); + }); + })();