mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Skip run of problematic transitions test on android+emulator+API23
This commit is contained in:
@@ -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 });
|
||||
|
||||
75
apps/tests/navigation/transition-tests.ts
Normal file
75
apps/tests/navigation/transition-tests.ts
Normal file
@@ -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();
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user