Skip to content

Commit

Permalink
Update animation tests to run in a popup.
Browse files Browse the repository at this point in the history
As an optimization, certain browsers (e.g. Firefox) may not execute functions sent to `requestAnimationFrame` while the window is not visible.  Because our tests run in an iframe, the tests fail unless we open a popup to run the animation methods.
  • Loading branch information
tschaub committed Jan 17, 2012
1 parent e2834e0 commit 483fe26
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions tests/Animation.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@
<script src="OLLoader.js"></script>

<script>

function test_all(t) {
t.plan(7);
t.open_window("Animation.html", function(win) {
win.requestFrame(t);
win.start(t);
win.startDuration(t);
win.stop(t);
});
}

function test_requestFrame(t) {
t.plan(2);
function requestFrame(t) {

t.eq(typeof OpenLayers.Animation.requestFrame, "function", "requestFrame is a function");

Expand All @@ -28,8 +37,7 @@
});
}

function test_start(t) {
t.plan(1);
function start(t) {

var calls = 0;
var id = OpenLayers.Animation.start(function() {
Expand All @@ -41,8 +49,7 @@
});
}

function test_start_duration(t) {
t.plan(2);
function startDuration(t) {

var calls = 0;
var id = OpenLayers.Animation.start(function() {
Expand All @@ -58,8 +65,7 @@
});
}

function test_stop(t) {
t.plan(2);
function stop(t) {

var calls = 0;
var id = OpenLayers.Animation.start(function() {
Expand Down

0 comments on commit 483fe26

Please sign in to comment.