Merge pull request #803 from ahocevar/tween-framerate

Tween: skip frames when minimum frame rate is not reached. r=@bartvde
This commit is contained in:
ahocevar
2012-12-24 06:11:11 -08:00
2 changed files with 57 additions and 2 deletions
+33
View File
@@ -74,6 +74,39 @@
tween.stop();
t.ok(tween.animationId != null, "stop method doesn't do anything if tween isn't running");
}
function test_Tween_skip(t) {
t.plan(2);
var tween = new OpenLayers.Tween();
var log = 0;
tween.start({count: 0}, {count: 10}, 10, {
callbacks: {
eachStep: function() {
log++;
}
},
minFrameRate: 10000
});
t.delay_call(0.8, function() {
t.eq(log, 0, 'all frames skipped at a frame rate of 10000');
log = 0;
tween.start({count: 0}, {count: 10}, 10, {
callbacks: {
eachStep: function() {
log++;
}
},
minFrameRate: 1
});
});
t.delay_call(1.6, function() {
t.eq(log, 11, 'no frames skipped at a frame rate of 1');
});
}
</script>
</head>