From cdce311b9cbf7a432e01c8cb845d461b396d66dc Mon Sep 17 00:00:00 2001 From: Rossen Hristov Date: Thu, 30 Jul 2015 11:35:01 +0300 Subject: [PATCH] Fixed the animation tests. --- apps/tests/ui/animation/animation-tests.ts | 260 ++++++++++----------- 1 file changed, 130 insertions(+), 130 deletions(-) diff --git a/apps/tests/ui/animation/animation-tests.ts b/apps/tests/ui/animation/animation-tests.ts index 3ae251f90..2b983a335 100644 --- a/apps/tests/ui/animation/animation-tests.ts +++ b/apps/tests/ui/animation/animation-tests.ts @@ -44,7 +44,7 @@ export var test_AnimatingProperties = function (done) { curve: label.ios ? UIViewAnimationCurve.UIViewAnimationCurveEaseIn : new android.view.animation.AccelerateInterpolator(1), }) .then(() => { - console.log("Animation finished."); + ////console.log("Animation finished."); // helper.goBack(); done(); @@ -61,45 +61,45 @@ export var test_AnimatingProperties = function (done) { // } -// export var test_CancellingAnimation = function (done) { -// var mainPage: pageModule.Page; -// var label: labelModule.Label; -// var pageFactory = function (): pageModule.Page { -// label = new labelModule.Label(); -// label.text = "label"; -// var stackLayout = new stackLayoutModule.StackLayout(); -// stackLayout.addChild(label); -// mainPage = new pageModule.Page(); -// mainPage.content = stackLayout; -// return mainPage; -// }; + export var test_CancellingAnimation = function (done) { + var mainPage: pageModule.Page; + var label: labelModule.Label; + var pageFactory = function (): pageModule.Page { + label = new labelModule.Label(); + label.text = "label"; + var stackLayout = new stackLayoutModule.StackLayout(); + stackLayout.addChild(label); + mainPage = new pageModule.Page(); + mainPage.content = stackLayout; + return mainPage; + }; -// helper.navigate(pageFactory); -// TKUnit.waitUntilReady(() => { return label.isLoaded }); + helper.navigate(pageFactory); + TKUnit.waitUntilReady(() => { return label.isLoaded }); -// // -// // # Cancelling animation -// // ``` JavaScript -// var animation1 = label.createAnimation({ translate: { x: 100, y: 100 } }); -// animation1.play().finished -// .then(() => { -// console.log("Animation finished"); -// // -// helper.goBack(); -// done(); -// // -// }) -// .catch((e) => { -// console.log("Animation cancelled"); -// // -// helper.goBack(); -// done(e); -// // -// }); -// animation1.cancel(); -// // ``` -// // -// } + // + // # Cancelling animation + // ``` JavaScript + var animation1 = label.createAnimation({ translate: { x: 100, y: 100 } }); + animation1.play().finished + .then(() => { + ////console.log("Animation finished"); + // + helper.goBack(); + done(); + // + }) + .catch((e) => { + ////console.log("Animation cancelled"); + // + helper.goBack(); + done(); + // + }); + animation1.cancel(); + // ``` + // + } export var test_ChainingAnimations = function (done) { var mainPage: pageModule.Page; @@ -128,7 +128,7 @@ export var test_ChainingAnimations = function (done) { .then(() => label.animate({ rotate: 180 })) .then(() => label.animate({ rotate: 0 })) .then(() => { - console.log("Animation finished"); + ////console.log("Animation finished"); // helper.goBack(); done(); @@ -145,99 +145,99 @@ export var test_ChainingAnimations = function (done) { // } -// export var test_ReusingAnimations = function (done) { -// var mainPage: pageModule.Page; -// var label: labelModule.Label; -// var pageFactory = function (): pageModule.Page { -// label = new labelModule.Label(); -// label.text = "label"; -// var stackLayout = new stackLayoutModule.StackLayout(); -// stackLayout.addChild(label); -// mainPage = new pageModule.Page(); -// mainPage.content = stackLayout; -// return mainPage; -// }; + export var test_ReusingAnimations = function (done) { + var mainPage: pageModule.Page; + var label: labelModule.Label; + var pageFactory = function (): pageModule.Page { + label = new labelModule.Label(); + label.text = "label"; + var stackLayout = new stackLayoutModule.StackLayout(); + stackLayout.addChild(label); + mainPage = new pageModule.Page(); + mainPage.content = stackLayout; + return mainPage; + }; -// helper.navigate(pageFactory); -// TKUnit.waitUntilReady(() => { return label.isLoaded }); + helper.navigate(pageFactory); + TKUnit.waitUntilReady(() => { return label.isLoaded }); -// // -// // # Reusing animations -// // ``` JavaScript -// var animation1 = label.createAnimation({ translate: { x: 100, y: 100 } }); -// var animation2 = label.createAnimation({ translate: { x: 0, y: 0 } }); + // + // # Reusing animations + // ``` JavaScript + var animation1 = label.createAnimation({ translate: { x: 100, y: 100 } }); + var animation2 = label.createAnimation({ translate: { x: 0, y: 0 } }); -// animation1.play().finished -// .then(() => animation2.play().finished) -// .then(() => animation1.play().finished) -// .then(() => animation2.play().finished) -// .then(() => animation1.play().finished) -// .then(() => animation2.play().finished) -// .then(() => { -// console.log("Animation finished"); -// // -// helper.goBack(); -// done(); -// // -// }) -// .catch((e) => { -// console.log(e.message); -// // -// helper.goBack(); -// done(e); -// // -// }); -// // ``` -// // -// } + animation1.play().finished + .then(() => animation1.play().finished) + .then(() => animation1.play().finished) + .then(() => animation2.play().finished) + .then(() => animation1.play().finished) + .then(() => animation2.play().finished) + .then(() => { + ////console.log("Animation finished"); + // + helper.goBack(); + done(); + // + }) + .catch((e) => { + console.log(e.message); + // + helper.goBack(); + done(e); + // + }); + // ``` + // + } -// export var test_AnimatingMultipleViews = function (done) { -// var mainPage: pageModule.Page; -// var label1: labelModule.Label; -// var label2: labelModule.Label; -// var label3: labelModule.Label; -// var pageFactory = function (): pageModule.Page { -// label1 = new labelModule.Label(); -// label1.text = "label1"; -// label2 = new labelModule.Label(); -// label2.text = "label2"; -// label3 = new labelModule.Label(); -// label3.text = "label3"; -// var stackLayout = new stackLayoutModule.StackLayout(); -// stackLayout.addChild(label1); -// stackLayout.addChild(label2); -// stackLayout.addChild(label3); -// mainPage = new pageModule.Page(); -// mainPage.content = stackLayout; -// return mainPage; -// }; -// helper.navigate(pageFactory); -// TKUnit.waitUntilReady(() => { return label1.isLoaded && label2.isLoaded }); + export var test_AnimatingMultipleViews = function (done) { + var mainPage: pageModule.Page; + var label1: labelModule.Label; + var label2: labelModule.Label; + var label3: labelModule.Label; + var pageFactory = function (): pageModule.Page { + label1 = new labelModule.Label(); + label1.text = "label1"; + label2 = new labelModule.Label(); + label2.text = "label2"; + label3 = new labelModule.Label(); + label3.text = "label3"; + var stackLayout = new stackLayoutModule.StackLayout(); + stackLayout.addChild(label1); + stackLayout.addChild(label2); + stackLayout.addChild(label3); + mainPage = new pageModule.Page(); + mainPage.content = stackLayout; + return mainPage; + }; + helper.navigate(pageFactory); + TKUnit.waitUntilReady(() => { return label1.isLoaded && label2.isLoaded }); -// // -// // # Animating multiple views simultaneously -// // ``` JavaScript -// var animations: Array = [ -// { target: label1, translate: { x: 200, y: 200 }, duration: 1000, delay: 0 }, -// { target: label2, translate: { x: 200, y: 200 }, duration: 1000, delay: 333 }, -// { target: label3, translate: { x: 200, y: 200 }, duration: 1000, delay: 666 }, -// ]; -// var animation = new animation.Animation(animations); -// animation.play().finished -// .then(() => { -// console.log("Animations finished"); -// // -// helper.goBack(); -// done(); -// // -// }) -// .catch((e) => { -// console.log(e.message); -// // -// helper.goBack(); -// done(e); -// // -// }); -// // ``` -// // -// } + // + // # Animating multiple views simultaneously + // ``` JavaScript + var animations: Array = [ + { target: label1, translate: { x: 200, y: 200 }, duration: 1000, delay: 0 }, + { target: label2, translate: { x: 200, y: 200 }, duration: 1000, delay: 333 }, + { target: label3, translate: { x: 200, y: 200 }, duration: 1000, delay: 666 }, + ]; + var a = new animation.Animation(animations); + a.play().finished + .then(() => { + ////console.log("Animations finished"); + // + helper.goBack(); + done(); + // + }) + .catch((e) => { + console.log(e.message); + // + helper.goBack(); + done(e); + // + }); + // ``` + // + }