2 QUnit.module("Animation", {
6 this.cb = function(e) {
7 QUnit.ok(true, "Scene loaded");
8 var iframe = document.getElementById('daliframe');
9 that.doc = iframe.contentDocument || iframe.contentWindow.document;
10 that.doc.Module.postDaliWrapperRun = function() {
11 dali = that.doc.Module;
15 loadDocument("dali-page.html"+window.location.search, this.cb);
17 teardown : function() {
18 var v = document.getElementById("daliframe");
19 v.removeEventListener("load", this.cb, true);
23 QUnit.test( "spline path", function( assert ) {
25 var done1 = assert.async();
32 var a = new dali.Animation(0);
33 var path = new dali.Path();
41 assert.ok(compareArrays(path.points, [
47 dali.generateControlPoints(path, 0.35);
49 assert.ok(compareArrays(path.controlPoints, [
51 [-66.94940948486328, 76.16658020019531, 0],
52 [101.31224060058594, 60.66832733154297, 0],
57 a.animatePath(actor, path, [1, 0, 0], dali.AlphaFunction.LINEAR, 0, 0.1);
62 assert.ok(actor.position = path.points[2]);
70 window.setTimeout(checkPos, 200);
74 QUnit.test( "linear", function( assert ) {
76 var done1 = assert.async();
77 var done2 = assert.async();
78 var done3 = assert.async();
85 var a = new dali.Animation(0);
87 a.animateTo(actor, "position", [20, 0, 0], dali.AlphaFunction.LINEAR, 0, 0.1);
90 function checkAnimateBetween() {
91 assert.ok(actor.position = [0, 0, -30]);
98 function checkAnimateBy() {
99 assert.ok(actor.position = [120, 100, 0]);
101 a.animateBetween(actor,
102 "position", [ [ 0, [10,20,30] ],
103 [ 1.0,[0, 0, -30] ] ],
109 window.setTimeout(checkAnimateBetween, 200);
113 function checkAnimateTo() {
114 assert.ok(actor.position = [20, 0, 0]);
115 actor.position = [100, 100, 0];
117 a.clear(); // var a = new dali.Animation(0);
119 a.animateBy(actor, "position", [20, 0, 0], dali.AlphaFunction.LINEAR, 0, 0.1);
121 window.setTimeout(checkAnimateBy, 200);
125 window.setTimeout(checkAnimateTo, 200);