From 8cbed85cb811a50b614859570ed25ac09a2c10a4 Mon Sep 17 00:00:00 2001 From: vakrilov Date: Mon, 15 Feb 2016 10:39:12 +0200 Subject: [PATCH 1/3] styles fix --- ui/tab-view/tab-view.android.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/tab-view/tab-view.android.ts b/ui/tab-view/tab-view.android.ts index 5eec24a2c..5305b28cb 100644 --- a/ui/tab-view/tab-view.android.ts +++ b/ui/tab-view/tab-view.android.ts @@ -173,7 +173,7 @@ function ensurePageChangedListenerClass() { function selectedColorPropertyChanged(data: dependencyObservable.PropertyChangeData) { var tabLayout = (data.object)._getAndroidTabView(); if (tabLayout && data.newValue instanceof color.Color) { - tabLayout.setSelectedIndicatorColors([data.newValue._nativeView]); + tabLayout.setSelectedIndicatorColors([data.newValue.android]); } } (common.TabView.selectedColorProperty.metadata).onSetNativeValue = selectedColorPropertyChanged; @@ -181,7 +181,7 @@ function selectedColorPropertyChanged(data: dependencyObservable.PropertyChangeD function tabsBackgroundColorPropertyChanged(data: dependencyObservable.PropertyChangeData) { var tabLayout = (data.object)._getAndroidTabView(); if (tabLayout && data.newValue instanceof color.Color) { - tabLayout.setBackgroundColor(data.newValue._nativeView); + tabLayout.setBackgroundColor(data.newValue.android); } } (common.TabView.tabsBackgroundColorProperty.metadata).onSetNativeValue = tabsBackgroundColorPropertyChanged; From d730db9516bdfdddfd03b46fa5b2993038cec928 Mon Sep 17 00:00:00 2001 From: vakrilov Date: Mon, 15 Feb 2016 11:58:16 +0200 Subject: [PATCH 2/3] Skip run of problematic transitions test on android+emulator+API23 --- CrossPlatformModules.csproj | 4 +- apps/tests/navigation/navigation-tests.ts | 68 -------------------- apps/tests/navigation/transition-tests.ts | 75 +++++++++++++++++++++++ apps/tests/testRunner.ts | 5 ++ tsconfig.json | 1 + 5 files changed, 82 insertions(+), 71 deletions(-) create mode 100644 apps/tests/navigation/transition-tests.ts diff --git a/CrossPlatformModules.csproj b/CrossPlatformModules.csproj index 760e382c0..c8e6ec077 100644 --- a/CrossPlatformModules.csproj +++ b/CrossPlatformModules.csproj @@ -84,15 +84,13 @@ - - list-view.xml - + modal-page.xml diff --git a/apps/tests/navigation/navigation-tests.ts b/apps/tests/navigation/navigation-tests.ts index 44c2ec8b7..a53c285b6 100644 --- a/apps/tests/navigation/navigation-tests.ts +++ b/apps/tests/navigation/navigation-tests.ts @@ -1,6 +1,5 @@ import TKUnit = require("../TKUnit"); import platform = require("platform"); -import transitionModule = require("ui/transition"); import {Frame, Page, topmost as topmostFrame, NavigationEntry, NavigationTransition, AnimationCurve, WrapLayout, Button} from "ui"; import color = require("color"); import helper = require("../ui/helper"); @@ -14,73 +13,6 @@ var pageFactory = function(): Page { return page; }; -function _testTransition(navigationTransition: NavigationTransition) { - var testId = `Transition[${JSON.stringify(navigationTransition)}]`; - trace.write(`Testing ${testId}`, trace.categories.Test); - var navigationEntry: NavigationEntry = { - create: function (): Page { - var page = new Page(); - page.id = testId; - page.style.backgroundColor = new color.Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255)); - return page; - }, - animated: true, - transition: navigationTransition - } - - helper.navigateWithEntry(navigationEntry); - TKUnit.wait(0.100); - helper.goBack(); - TKUnit.wait(0.100); - utils.GC(); -} - -// Extremely slow. Run only if needed. -export var test_Transitions = function () { - helper.navigate(() => { - var page = new Page(); - page.id = "TransitionsTestPage_MAIN" - page.style.backgroundColor = new color.Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255)); - return page; - }); - - var transitions; - if (platform.device.os === platform.platformNames.ios) { - transitions = ["curl"]; - } - else { - var _sdkVersion = parseInt(platform.device.sdkVersion); - transitions = _sdkVersion >= 21 ? ["explode"] : []; - } - transitions = transitions.concat(["fade", "flip", "slide"]); - var durations = [undefined, 500]; - var curves = [undefined, AnimationCurve.easeIn]; - - // Built-in transitions - var t, d, c; - var tlen = transitions.length; - var dlen = durations.length; - var clen = curves.length; - for (t = 0; t < tlen; t++) { - for (d = 0; d < dlen; d++) { - for (c = 0; c < clen; c++) { - _testTransition({ - name: transitions[t], - duration: durations[d], - curve: curves[c] - }); - } - } - } - - // Custom transition - var customTransitionModule = require("./custom-transition"); - var customTransition = new customTransitionModule.CustomTransition(); - _testTransition({ instance: customTransition }); - - helper.goBack(); -} - export var test_backstackVisible = function () { var mainTestPage = topmostFrame().currentPage; topmostFrame().navigate({ create: pageFactory }); diff --git a/apps/tests/navigation/transition-tests.ts b/apps/tests/navigation/transition-tests.ts new file mode 100644 index 000000000..f7e249465 --- /dev/null +++ b/apps/tests/navigation/transition-tests.ts @@ -0,0 +1,75 @@ +import TKUnit = require("../TKUnit"); +import platform = require("platform"); +import transitionModule = require("ui/transition"); +import color = require("color"); +import helper = require("../ui/helper"); +import utils = require("utils/utils"); +import trace = require("trace"); +import {Frame, Page, topmost as topmostFrame, NavigationEntry, NavigationTransition, AnimationCurve, WrapLayout, Button} from "ui"; + +function _testTransition(navigationTransition: NavigationTransition) { + var testId = `Transition[${JSON.stringify(navigationTransition)}]`; + trace.write(`Testing ${testId}`, trace.categories.Test); + var navigationEntry: NavigationEntry = { + create: function (): Page { + var page = new Page(); + page.id = testId; + page.style.backgroundColor = new color.Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255)); + return page; + }, + animated: true, + transition: navigationTransition + } + + helper.navigateWithEntry(navigationEntry); + TKUnit.wait(0.100); + helper.goBack(); + TKUnit.wait(0.100); + utils.GC(); +} + +// Extremely slow. Run only if needed. +export var test_Transitions = function () { + helper.navigate(() => { + var page = new Page(); + page.id = "TransitionsTestPage_MAIN" + page.style.backgroundColor = new color.Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255)); + return page; + }); + + var transitions; + if (platform.device.os === platform.platformNames.ios) { + transitions = ["curl"]; + } + else { + var _sdkVersion = parseInt(platform.device.sdkVersion); + transitions = _sdkVersion >= 21 ? ["explode"] : []; + } + transitions = transitions.concat(["fade", "flip", "slide"]); + var durations = [undefined, 500]; + var curves = [undefined, AnimationCurve.easeIn]; + + // Built-in transitions + var t, d, c; + var tlen = transitions.length; + var dlen = durations.length; + var clen = curves.length; + for (t = 0; t < tlen; t++) { + for (d = 0; d < dlen; d++) { + for (c = 0; c < clen; c++) { + _testTransition({ + name: transitions[t], + duration: durations[d], + curve: curves[c] + }); + } + } + } + + // Custom transition + var customTransitionModule = require("./custom-transition"); + var customTransition = new customTransitionModule.CustomTransition(); + _testTransition({ instance: customTransition }); + + helper.goBack(); +} diff --git a/apps/tests/testRunner.ts b/apps/tests/testRunner.ts index fa0f8299b..e4df69132 100644 --- a/apps/tests/testRunner.ts +++ b/apps/tests/testRunner.ts @@ -94,6 +94,11 @@ if (!isRunningOnEmulator()) { // Navigation tests should always be last. allTests["NAVIGATION"] = require("./navigation/navigation-tests"); +// Skip transitions on android emulators with API 23 +if (!(platform.device.os === platform.platformNames.android && parseInt(platform.device.sdkVersion) === 23 && isRunningOnEmulator())) { + allTests["TANSITIONS"] = require("./navigation/transition-tests"); +} + var testsWithLongDelay = { test_Transitions: 3 * 60 * 1000, testLocation: 10000, diff --git a/tsconfig.json b/tsconfig.json index 261d57187..6c9e3a662 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -186,6 +186,7 @@ "apps/tests/navigation/custom-transition.android.ts", "apps/tests/navigation/custom-transition.ios.ts", "apps/tests/navigation/navigation-tests.ts", + "apps/tests/navigation/transition-tests.ts", "apps/tests/observable-array-tests.ts", "apps/tests/observable-tests.ts", "apps/tests/pages/app.ts", From 57fee972af8f091e431e8eca29e95dac7d86f9e6 Mon Sep 17 00:00:00 2001 From: vakrilov Date: Mon, 15 Feb 2016 15:15:03 +0200 Subject: [PATCH 3/3] Test swap --- apps/tests/testRunner.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/tests/testRunner.ts b/apps/tests/testRunner.ts index e4df69132..d23d81701 100644 --- a/apps/tests/testRunner.ts +++ b/apps/tests/testRunner.ts @@ -91,14 +91,14 @@ if (!isRunningOnEmulator()) { allTests["LOCATION"] = require("./location-tests"); } -// Navigation tests should always be last. -allTests["NAVIGATION"] = require("./navigation/navigation-tests"); - // Skip transitions on android emulators with API 23 if (!(platform.device.os === platform.platformNames.android && parseInt(platform.device.sdkVersion) === 23 && isRunningOnEmulator())) { allTests["TANSITIONS"] = require("./navigation/transition-tests"); } +// Navigation tests should always be last. +allTests["NAVIGATION"] = require("./navigation/navigation-tests"); + var testsWithLongDelay = { test_Transitions: 3 * 60 * 1000, testLocation: 10000,