3 <script src="../lib/OpenLayers.js"></script>
4 <script type="text/javascript">
6 function test_Tween_constructor(t) {
9 var tween = new OpenLayers.Tween();
10 t.ok(tween instanceof OpenLayers.Tween,
11 "new OpenLayers.Tween returns object" );
12 t.eq(typeof tween.easing, "function",
13 "constructor sets easing correctly");
14 t.eq(typeof tween.start, "function", "tween has a start function");
17 function test_Tween_start(t) {
20 var tween = new OpenLayers.Tween();
22 var start = {foo: 0, bar: 10};
23 var finish = {foo: 10, bar: 0};
26 var _eachStep = false;
34 eachStep: function() {
38 tween.start(start, finish, 10, {callbacks: callbacks});
39 t.ok(tween.interval != null, "interval correctly set");
40 t.delay_call(0.8, function() {
41 t.eq(_start, true, "start callback called");
42 t.eq(_done, true, "finish callback called");
43 t.eq(_eachStep, true, "eachStep callback called");
44 t.eq(tween.time, 11, "Number of steps reached is correct");
48 function test_Tween_stop(t) {
51 var tween = new OpenLayers.Tween();
52 tween.interval = window.setInterval(function() {}, 10);
55 t.eq(tween.interval, null, "tween correctly stopped");
57 tween.interval = window.setInterval(function() {}, 10);
58 tween.playing = false;
60 t.ok(tween.interval != null, "stop method doesn't do anything if tween isn't running");
66 <div id="map" style="width:500px;height:500px"></div>