mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Remove Action property from Intent class.
Location tests are not executed on emulator. Label test made for iOS only. Change frame.android.action property to method. Image measured widht/height are now floor (like in android runtime).
This commit is contained in:
1
android17.d.ts
vendored
1
android17.d.ts
vendored
@ -85563,7 +85563,6 @@ declare module android {
|
|||||||
static class: java.lang.Class<android.content.Intent>;
|
static class: java.lang.Class<android.content.Intent>;
|
||||||
Type: string;
|
Type: string;
|
||||||
Data: android.net.Uri;
|
Data: android.net.Uri;
|
||||||
Action: string;
|
|
||||||
SourceBounds: android.graphics.Rect;
|
SourceBounds: android.graphics.Rect;
|
||||||
ClipData: android.content.ClipData;
|
ClipData: android.content.ClipData;
|
||||||
Package: string;
|
Package: string;
|
||||||
|
@ -4,6 +4,16 @@ import trace = require("trace");
|
|||||||
import frameModule = require("ui/frame");
|
import frameModule = require("ui/frame");
|
||||||
frameModule.Frame.defaultAnimatedNavigation = false;
|
frameModule.Frame.defaultAnimatedNavigation = false;
|
||||||
|
|
||||||
|
function isRunningOnEmulator(): boolean {
|
||||||
|
// This checks are not good enough to be added to modules but keeps unittests green.
|
||||||
|
|
||||||
|
return android.os.Build.FINGERPRINT.indexOf("generic") > -1 ||
|
||||||
|
android.os.Build.HARDWARE.toLowerCase() === "goldfish" ||
|
||||||
|
android.os.Build.HARDWARE.toLowerCase() === "donatello" || // VS Emulator
|
||||||
|
android.os.Build.PRODUCT.toLocaleLowerCase().indexOf("sdk") > -1 ||
|
||||||
|
android.os.Build.PRODUCT.toLocaleLowerCase().indexOf("emulator") > -1; // VS Emulator
|
||||||
|
}
|
||||||
|
|
||||||
export var allTests = {};
|
export var allTests = {};
|
||||||
allTests["DOCKLAYOUT"] = require("./layouts/dock-layout-tests");
|
allTests["DOCKLAYOUT"] = require("./layouts/dock-layout-tests");
|
||||||
allTests["WRAPLAYOUT"] = require("./layouts/wrap-layout-tests");
|
allTests["WRAPLAYOUT"] = require("./layouts/wrap-layout-tests");
|
||||||
@ -16,7 +26,6 @@ allTests["SCROLL-VIEW"] = require("./ui/scroll-view/scroll-view-tests");
|
|||||||
allTests["APPLICATION"] = require("./application-tests");
|
allTests["APPLICATION"] = require("./application-tests");
|
||||||
allTests["FILE SYSTEM"] = require("./file-system-tests");
|
allTests["FILE SYSTEM"] = require("./file-system-tests");
|
||||||
allTests["HTTP"] = require("./http-tests");
|
allTests["HTTP"] = require("./http-tests");
|
||||||
allTests["LOCATION"] = require("./location-tests");
|
|
||||||
allTests["LOCAL SETTINGS"] = require("./local-settings-tests");
|
allTests["LOCAL SETTINGS"] = require("./local-settings-tests");
|
||||||
allTests["IMAGE SOURCE"] = require("./image-source-tests");
|
allTests["IMAGE SOURCE"] = require("./image-source-tests");
|
||||||
allTests["TIMER"] = require("./timer-tests");
|
allTests["TIMER"] = require("./timer-tests");
|
||||||
@ -51,6 +60,9 @@ allTests["LIST-PICKER"] = require("./ui/list-picker/list-picker-tests");
|
|||||||
allTests["DATE-PICKER"] = require("./ui/date-picker/date-picker-tests");
|
allTests["DATE-PICKER"] = require("./ui/date-picker/date-picker-tests");
|
||||||
allTests["TIME-PICKER"] = require("./ui/time-picker/time-picker-tests");
|
allTests["TIME-PICKER"] = require("./ui/time-picker/time-picker-tests");
|
||||||
allTests["WEB-VIEW"] = require("./ui/web-view/web-view-tests");
|
allTests["WEB-VIEW"] = require("./ui/web-view/web-view-tests");
|
||||||
|
if (!isRunningOnEmulator()) {
|
||||||
|
allTests["LOCATION"] = require("./location-tests");
|
||||||
|
}
|
||||||
|
|
||||||
var testsWithLongDelay = {
|
var testsWithLongDelay = {
|
||||||
testLocation: 10000,
|
testLocation: 10000,
|
||||||
|
@ -93,6 +93,8 @@ export var test_measuredWidth_is_not_clipped = function () {
|
|||||||
label.text = "i";
|
label.text = "i";
|
||||||
label.fontSize = 9;
|
label.fontSize = 9;
|
||||||
|
|
||||||
|
if (label.ios) {
|
||||||
|
|
||||||
var test = function (views: Array<view.View>) {
|
var test = function (views: Array<view.View>) {
|
||||||
|
|
||||||
TKUnit.waitUntilReady(() => { return label.isLayoutValid; });
|
TKUnit.waitUntilReady(() => { return label.isLayoutValid; });
|
||||||
@ -104,6 +106,7 @@ export var test_measuredWidth_is_not_clipped = function () {
|
|||||||
|
|
||||||
helper.buildUIAndRunTest(label, test);
|
helper.buildUIAndRunTest(label, test);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export var test_Set_TextWrap_TNS = function () {
|
export var test_Set_TextWrap_TNS = function () {
|
||||||
// <snippet module="ui/label" title="Label">
|
// <snippet module="ui/label" title="Label">
|
||||||
|
@ -624,7 +624,7 @@ class AndroidFrame extends observable.Observable implements definition.AndroidFr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// can go back only if it is not the main one.
|
// can go back only if it is not the main one.
|
||||||
return this._activity.getIntent().Action !== android.content.Intent.ACTION_MAIN;
|
return this._activity.getIntent().getAction() !== android.content.Intent.ACTION_MAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public reset() {
|
public reset() {
|
||||||
@ -682,7 +682,7 @@ function findPageForFragment(fragment: android.app.Fragment, frame: Frame) {
|
|||||||
|
|
||||||
function startActivity(activity: android.app.Activity, entry: definition.NavigationEntry) {
|
function startActivity(activity: android.app.Activity, entry: definition.NavigationEntry) {
|
||||||
var intent = new android.content.Intent(activity, (<any>com).tns.NativeScriptActivity.class);
|
var intent = new android.content.Intent(activity, (<any>com).tns.NativeScriptActivity.class);
|
||||||
intent.Action = android.content.Intent.ACTION_DEFAULT;
|
intent.setAction(android.content.Intent.ACTION_DEFAULT);
|
||||||
// TODO: Put the navigation context (if any) in the intent
|
// TODO: Put the navigation context (if any) in the intent
|
||||||
activity.startActivity(intent);
|
activity.startActivity(intent);
|
||||||
}
|
}
|
@ -138,8 +138,8 @@ export class Image extends view.View implements definition.Image {
|
|||||||
|
|
||||||
if (nativeWidth !== 0 && nativeHeight !== 0 && (finiteWidth || finiteHeight)) {
|
if (nativeWidth !== 0 && nativeHeight !== 0 && (finiteWidth || finiteHeight)) {
|
||||||
var scale = Image.computeScaleFactor(width, height, finiteWidth, finiteHeight, nativeWidth, nativeHeight, this.stretch);
|
var scale = Image.computeScaleFactor(width, height, finiteWidth, finiteHeight, nativeWidth, nativeHeight, this.stretch);
|
||||||
var resultW = nativeWidth * scale.width;
|
var resultW = Math.floor(nativeWidth * scale.width);
|
||||||
var resultH = nativeHeight * scale.height;
|
var resultH = Math.floor(nativeHeight * scale.height);
|
||||||
|
|
||||||
measureWidth = finiteWidth ? Math.min(resultW, width) : resultW;
|
measureWidth = finiteWidth ? Math.min(resultW, width) : resultW;
|
||||||
measureHeight = finiteHeight ? Math.min(resultH, height) : resultH;
|
measureHeight = finiteHeight ? Math.min(resultH, height) : resultH;
|
||||||
|
Reference in New Issue
Block a user