diff options
author | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
commit | ea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch) | |
tree | af67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/tests/Animation.html | |
parent | 59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff) | |
download | postrunner-ea346a785dc1b3f7c156f6fc33da634e1f1a627b.zip |
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/tests/Animation.html')
-rw-r--r-- | misc/openlayers/tests/Animation.html | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/misc/openlayers/tests/Animation.html b/misc/openlayers/tests/Animation.html new file mode 100644 index 0000000..c24ae49 --- /dev/null +++ b/misc/openlayers/tests/Animation.html @@ -0,0 +1,96 @@ +<!DOCTYPE html> +<html> + <head> + <title>Animation.js Tests</title> + <script> + + // dependencies for tests + var OpenLayers = [ + "OpenLayers/Util/vendorPrefix.js", + "OpenLayers/Animation.js" + ]; + + </script> + <script src="OLLoader.js"></script> + + <script> + + function test_all(t) { + t.plan(8); + t.ok(OpenLayers.Animation.isNative !== undefined, "isNative is set."); + + function doIt(win) { + win.requestFrame(t); + win.start(t); + win.startDuration(t); + win.stop(t); + } + + // Test in an extra window in Firefox, and directly in other browsers. + // This is needed because requestAnimationFrame does not work + // correctly in Firefox in a hidden IFrame. + if (window.mozRequestAnimationFrame) { + t.open_window("Animation.html", doIt); + } else { + doIt(window); + } + } + + function requestFrame(t) { + + t.eq(typeof OpenLayers.Animation.requestFrame, "function", "requestFrame is a function"); + + var calls = 0; + OpenLayers.Animation.requestFrame(function() { + ++calls; + }); + t.delay_call(0.1, function() { + t.ok(calls > 0, "callback called: " + calls); + }); + } + + function start(t) { + + var calls = 0; + var id = OpenLayers.Animation.start(function() { + ++calls; + }); + t.delay_call(0.1, function() { + t.ok(calls > 1, "looped: " + calls); + OpenLayers.Animation.stop(id); + }); + } + + function startDuration(t) { + + var calls = 0; + var id = OpenLayers.Animation.start(function() { + ++calls; + }, 100); + var first; + t.delay_call(0.2, function() { + first = calls; + t.ok(calls > 1, "looped: " + calls); + }); + t.delay_call(0.3, function() { + t.eq(calls, first, "not being called any more"); + }); + } + + function stop(t) { + + var calls = 0; + var id = OpenLayers.Animation.start(function() { + ++calls; + }); + var first; + t.delay_call(0.2, function() { + first = calls; + t.ok(calls > 1, "looped: " + calls); + OpenLayers.Animation.stop(id); + }); + t.delay_call(0.3, function() { + t.eq(calls, first, "not being called any more"); + }); + } + </script>
\ No newline at end of file |