Make 0 test run successfuly

This commit is contained in:
PanayotCankov
2016-12-21 10:40:47 +02:00
parent b0b3541c23
commit 25bd65d95c
6 changed files with 117 additions and 129 deletions

View File

@ -85,17 +85,10 @@ application.on(application.lowMemoryEvent, function (args: application.Applicati
});
application.on(application.uncaughtErrorEvent, function (args: application.UnhandledErrorEventData) {
if (args.android) {
// For Android applications, args.android is an NativeScriptError.
console.log("NativeScriptError: " + args.android);
} else if (args.ios) {
// For iOS applications, args.ios is NativeScriptError.
console.log("NativeScriptError: " + args.ios);
}
console.log("NativeScriptError: " + args.error);
console.log(args.error.stack);
});
// Android activity events
if (application.android) {
application.android.on(application.AndroidApplication.activityCreatedEvent, function (args: application.AndroidActivityBundleEventData) {

View File

@ -29,79 +29,79 @@ export function isRunningOnEmulator(): boolean {
export var allTests = {};
allTests["PLATFORM"] = require("./platform-tests");
allTests["FILE SYSTEM"] = require("./file-system-tests");
allTests["HTTP"] = require("./http-tests");
allTests["XHR"] = require("./xhr-tests");
allTests["FETCH"] = require("./fetch-tests");
allTests["APPLICATION SETTINGS"] = require("./application-settings-tests");
allTests["APPLICATION"] = require("./application-tests");
allTests["IMAGE SOURCE"] = require("./image-source-tests");
allTests["OBSERVABLE-ARRAY"] = require("./data/observable-array-tests");
allTests["VIRTUAL-ARRAY"] = require("./data/virtual-array-tests");
allTests["OBSERVABLE"] = require("./data/observable-tests");
allTests["TIMER"] = require("./timer-tests");
allTests["COLOR"] = require("./color-tests");
allTests["DEPENDENCY-OBSERVABLE"] = require("./ui/dependency-observable-tests");
allTests["BINDABLE"] = require("./ui/bindable-tests");
allTests["BINDING-EXPRESSIONS"] = require("./ui/binding-expressions-tests");
allTests["XML-PARSER"] = require("./xml-parser-tests/xml-parser-tests");
allTests["FORMATTEDSTRING"] = require("./text/formatted-string-tests");
allTests["FILE-SYSTEM-ACCESS"] = require("./file-system-access-tests/file-system-access-tests");
allTests["FILE-NAME-RESOLVER"] = require("./file-name-resolver-tests/file-name-resolver-tests");
allTests["WEAK-EVENTS"] = require("./weak-event-listener-tests");
allTests["CONNECTIVITY"] = require("./connectivity-tests");
// allTests["PLATFORM"] = require("./platform-tests");
// allTests["FILE SYSTEM"] = require("./file-system-tests");
// allTests["HTTP"] = require("./http-tests");
// allTests["XHR"] = require("./xhr-tests");
// allTests["FETCH"] = require("./fetch-tests");
// allTests["APPLICATION SETTINGS"] = require("./application-settings-tests");
// allTests["APPLICATION"] = require("./application-tests");
// allTests["IMAGE SOURCE"] = require("./image-source-tests");
// allTests["OBSERVABLE-ARRAY"] = require("./data/observable-array-tests");
// allTests["VIRTUAL-ARRAY"] = require("./data/virtual-array-tests");
// allTests["OBSERVABLE"] = require("./data/observable-tests");
// allTests["TIMER"] = require("./timer-tests");
// allTests["COLOR"] = require("./color-tests");
// allTests["DEPENDENCY-OBSERVABLE"] = require("./ui/dependency-observable-tests");
// allTests["BINDABLE"] = require("./ui/bindable-tests");
// allTests["BINDING-EXPRESSIONS"] = require("./ui/binding-expressions-tests");
// allTests["XML-PARSER"] = require("./xml-parser-tests/xml-parser-tests");
// allTests["FORMATTEDSTRING"] = require("./text/formatted-string-tests");
// allTests["FILE-SYSTEM-ACCESS"] = require("./file-system-access-tests/file-system-access-tests");
// allTests["FILE-NAME-RESOLVER"] = require("./file-name-resolver-tests/file-name-resolver-tests");
// allTests["WEAK-EVENTS"] = require("./weak-event-listener-tests");
// allTests["CONNECTIVITY"] = require("./connectivity-tests");
allTests["PROXY-VIEW-CONTAINER"] = require("./ui/proxy-view-container/proxy-view-container-tests")
allTests["SCROLL-VIEW"] = require("./ui/scroll-view/scroll-view-tests");
allTests["ACTION-BAR"] = require("./ui/action-bar/action-bar-tests");
allTests["XML-DECLARATION"] = require("./xml-declaration/xml-declaration-tests");
allTests["DOCKLAYOUT"] = require("./ui/layouts/dock-layout-tests");
allTests["WRAPLAYOUT"] = require("./ui/layouts/wrap-layout-tests");
allTests["ABSOLUTELAYOUT"] = require("./ui/layouts/absolute-layout-tests");
allTests["GRIDLAYOUT"] = require("./ui/layouts/grid-layout-tests");
allTests["STACKLAYOUT"] = require("./ui/layouts/stack-layout-tests");
allTests["FLEXBOXLAYOUT"] = require("./ui/layouts/flexbox-layout-tests");
allTests["STYLE-PROPERTIES"] = require("./ui/styling/style-properties-tests");
allTests["FRAME"] = require("./ui/frame/frame-tests");
allTests["VIEW"] = require("./ui/view/view-tests");
allTests["STYLE"] = require("./ui/styling/style-tests");
allTests["VISUAL-STATE"] = require("./ui/styling/visual-state-tests");
allTests["VALUE-SOURCE"] = require("./ui/styling/value-source-tests");
allTests["CSS-SELECTOR-PARSER"] = require("./ui/styling/css-selector-parser");
allTests["CSS-SELECTOR"] = require("./ui/styling/css-selector");
allTests["BUTTON"] = require("./ui/button/button-tests");
allTests["BORDER"] = require("./ui/border/border-tests");
allTests["LABEL"] = require("./ui/label/label-tests");
allTests["TAB-VIEW"] = require("./ui/tab-view/tab-view-tests");
allTests["TAB-VIEW-NAVIGATION"] = require("./ui/tab-view/tab-view-navigation-tests");
allTests["IMAGE"] = require("./ui/image/image-tests");
allTests["SLIDER"] = require("./ui/slider/slider-tests");
allTests["SWITCH"] = require("./ui/switch/switch-tests");
allTests["PROGRESS"] = require("./ui/progress/progress-tests");
allTests["PLACEHOLDER"] = require("./ui/placeholder/placeholder-tests");
allTests["PAGE"] = require("./ui/page/page-tests");
allTests["LISTVIEW"] = require("./ui/list-view/list-view-tests");
allTests["ACTIVITY-INDICATOR"] = require("./ui/activity-indicator/activity-indicator-tests");
allTests["TEXT-FIELD"] = require("./ui/text-field/text-field-tests");
allTests["TEXT-VIEW"] = require("./ui/text-view/text-view-tests");
allTests["LIST-PICKER"] = require("./ui/list-picker/list-picker-tests");
allTests["DATE-PICKER"] = require("./ui/date-picker/date-picker-tests");
allTests["TIME-PICKER"] = require("./ui/time-picker/time-picker-tests");
allTests["WEB-VIEW"] = require("./ui/web-view/web-view-tests");
allTests["HTML-VIEW"] = require("./ui/html-view/html-view-tests");
allTests["REPEATER"] = require("./ui/repeater/repeater-tests");
allTests["SEARCH-BAR"] = require('./ui/search-bar/search-bar-tests');
allTests["SEGMENTED-BAR"] = require("./ui/segmented-bar/segmented-bar-tests");
allTests["ANIMATION"] = require("./ui/animation/animation-tests");
allTests["CSS-ANIMATION"] = require("./ui/animation/css-animation-tests");
// allTests["PROXY-VIEW-CONTAINER"] = require("./ui/proxy-view-container/proxy-view-container-tests")
// allTests["SCROLL-VIEW"] = require("./ui/scroll-view/scroll-view-tests");
// allTests["ACTION-BAR"] = require("./ui/action-bar/action-bar-tests");
// allTests["XML-DECLARATION"] = require("./xml-declaration/xml-declaration-tests");
// allTests["DOCKLAYOUT"] = require("./ui/layouts/dock-layout-tests");
// allTests["WRAPLAYOUT"] = require("./ui/layouts/wrap-layout-tests");
// allTests["ABSOLUTELAYOUT"] = require("./ui/layouts/absolute-layout-tests");
// allTests["GRIDLAYOUT"] = require("./ui/layouts/grid-layout-tests");
// allTests["STACKLAYOUT"] = require("./ui/layouts/stack-layout-tests");
// allTests["FLEXBOXLAYOUT"] = require("./ui/layouts/flexbox-layout-tests");
// allTests["STYLE-PROPERTIES"] = require("./ui/styling/style-properties-tests");
// allTests["FRAME"] = require("./ui/frame/frame-tests");
// allTests["VIEW"] = require("./ui/view/view-tests");
// allTests["STYLE"] = require("./ui/styling/style-tests");
// allTests["VISUAL-STATE"] = require("./ui/styling/visual-state-tests");
// allTests["VALUE-SOURCE"] = require("./ui/styling/value-source-tests");
// allTests["CSS-SELECTOR-PARSER"] = require("./ui/styling/css-selector-parser");
// allTests["CSS-SELECTOR"] = require("./ui/styling/css-selector");
// allTests["BUTTON"] = require("./ui/button/button-tests");
// allTests["BORDER"] = require("./ui/border/border-tests");
// allTests["LABEL"] = require("./ui/label/label-tests");
// allTests["TAB-VIEW"] = require("./ui/tab-view/tab-view-tests");
// allTests["TAB-VIEW-NAVIGATION"] = require("./ui/tab-view/tab-view-navigation-tests");
// allTests["IMAGE"] = require("./ui/image/image-tests");
// allTests["SLIDER"] = require("./ui/slider/slider-tests");
// allTests["SWITCH"] = require("./ui/switch/switch-tests");
// allTests["PROGRESS"] = require("./ui/progress/progress-tests");
// allTests["PLACEHOLDER"] = require("./ui/placeholder/placeholder-tests");
// allTests["PAGE"] = require("./ui/page/page-tests");
// allTests["LISTVIEW"] = require("./ui/list-view/list-view-tests");
// allTests["ACTIVITY-INDICATOR"] = require("./ui/activity-indicator/activity-indicator-tests");
// allTests["TEXT-FIELD"] = require("./ui/text-field/text-field-tests");
// allTests["TEXT-VIEW"] = require("./ui/text-view/text-view-tests");
// allTests["LIST-PICKER"] = require("./ui/list-picker/list-picker-tests");
// allTests["DATE-PICKER"] = require("./ui/date-picker/date-picker-tests");
// allTests["TIME-PICKER"] = require("./ui/time-picker/time-picker-tests");
// allTests["WEB-VIEW"] = require("./ui/web-view/web-view-tests");
// allTests["HTML-VIEW"] = require("./ui/html-view/html-view-tests");
// allTests["REPEATER"] = require("./ui/repeater/repeater-tests");
// allTests["SEARCH-BAR"] = require('./ui/search-bar/search-bar-tests');
// allTests["SEGMENTED-BAR"] = require("./ui/segmented-bar/segmented-bar-tests");
// allTests["ANIMATION"] = require("./ui/animation/animation-tests");
// allTests["CSS-ANIMATION"] = require("./ui/animation/css-animation-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");
// allTests["TANSITIONS"] = require("./navigation/transition-tests");
}
allTests["NAVIGATION"] = require("./navigation/navigation-tests");
// allTests["NAVIGATION"] = require("./navigation/navigation-tests");
var testsWithLongDelay = {
test_Transitions: 3 * 60 * 1000,

View File

@ -34,10 +34,6 @@ export class View extends ViewCommon {
this.requestLayout();
}
get _nativeView(): UIView {
return this.ios;
}
get isLayoutRequired(): boolean {
return (this._privateFlags & PFLAG_LAYOUT_REQUIRED) === PFLAG_LAYOUT_REQUIRED;
}
@ -97,7 +93,7 @@ export class View extends ViewCommon {
}
public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void {
let view = this._nativeView;
let view = this.nativeView;
let nativeWidth = 0;
let nativeHeight = 0;
@ -157,7 +153,7 @@ export class View extends ViewCommon {
}
public layoutNativeView(left: number, top: number, right: number, bottom: number): void {
if (!this._nativeView) {
if (!this.nativeView) {
return;
}
@ -166,14 +162,14 @@ export class View extends ViewCommon {
// // When in landscape in iOS 7 there is transformation on the first subview of the window so we set frame to its subview.
// // in iOS 8 we set frame to subview again otherwise we get clipped.
// let nativeView: UIView;
// if (!this.parent && this._nativeView.subviews.count > 0 && ios.MajorVersion < 8) {
// if (!this.parent && this.nativeView.subviews.count > 0 && ios.MajorVersion < 8) {
// if (traceEnabled) {
// traceWrite(this + " has no parent. Setting frame to first child instead.", traceCategories.Layout);
// }
// nativeView = (<UIView>this._nativeView.subviews[0]);
// nativeView = (<UIView>this.nativeView.subviews[0]);
// }
// else {
let nativeView = this._nativeView;
let nativeView = this.nativeView;
// }
let frame = CGRectMake(left, top, right - left, bottom - top);
@ -194,11 +190,11 @@ export class View extends ViewCommon {
}
public getLocationInWindow(): Point {
if (!this._nativeView || !this._nativeView.window) {
if (!this.nativeView || !this.nativeView.window) {
return undefined;
}
let pointInWindow = this._nativeView.convertPointToView(this._nativeView.bounds.origin, null);
let pointInWindow = this.nativeView.convertPointToView(this.nativeView.bounds.origin, null);
return {
x: layout.toDeviceIndependentPixels(pointInWindow.x),
y: layout.toDeviceIndependentPixels(pointInWindow.y),
@ -206,12 +202,12 @@ export class View extends ViewCommon {
}
public getLocationOnScreen(): Point {
if (!this._nativeView || !this._nativeView.window) {
if (!this.nativeView || !this.nativeView.window) {
return undefined;
}
let pointInWindow = this._nativeView.convertPointToView(this._nativeView.bounds.origin, null);
let pointOnScreen = this._nativeView.window.convertPointToWindow(pointInWindow, null);
let pointInWindow = this.nativeView.convertPointToView(this.nativeView.bounds.origin, null);
let pointOnScreen = this.nativeView.window.convertPointToWindow(pointInWindow, null);
return {
x: layout.toDeviceIndependentPixels(pointOnScreen.x),
y: layout.toDeviceIndependentPixels(pointOnScreen.y),
@ -219,14 +215,14 @@ export class View extends ViewCommon {
}
public getLocationRelativeTo(otherView: ViewDefinition): Point {
if (!this._nativeView || !this._nativeView.window ||
!otherView._nativeView || !otherView._nativeView.window ||
this._nativeView.window !== otherView._nativeView.window) {
if (!this.nativeView || !this.nativeView.window ||
!otherView.nativeView || !otherView.nativeView.window ||
this.nativeView.window !== otherView.nativeView.window) {
return undefined;
}
let myPointInWindow = this._nativeView.convertPointToView(this._nativeView.bounds.origin, null);
let otherPointInWindow = otherView._nativeView.convertPointToView(otherView._nativeView.bounds.origin, null);
let myPointInWindow = this.nativeView.convertPointToView(this.nativeView.bounds.origin, null);
let otherPointInWindow = otherView.nativeView.convertPointToView(otherView.nativeView.bounds.origin, null);
return {
x: layout.toDeviceIndependentPixels(myPointInWindow.x - otherPointInWindow.x),
y: layout.toDeviceIndependentPixels(myPointInWindow.y - otherPointInWindow.y),
@ -260,26 +256,26 @@ export class View extends ViewCommon {
newTransform = CGAffineTransformTranslate(newTransform, translateX, translateY);
newTransform = CGAffineTransformRotate(newTransform, rotate * Math.PI / 180);
newTransform = CGAffineTransformScale(newTransform, scaleX === 0 ? 0.001 : scaleX, scaleY === 0 ? 0.001 : scaleY);
if (!CGAffineTransformEqualToTransform(this._nativeView.transform, newTransform)) {
this._nativeView.transform = newTransform;
this._hasTransfrom = this._nativeView && !CGAffineTransformEqualToTransform(this._nativeView.transform, CGAffineTransformIdentity);
if (!CGAffineTransformEqualToTransform(this.nativeView.transform, newTransform)) {
this.nativeView.transform = newTransform;
this._hasTransfrom = this.nativeView && !CGAffineTransformEqualToTransform(this.nativeView.transform, CGAffineTransformIdentity);
}
}
public updateOriginPoint(originX: number, originY: number) {
let newPoint = CGPointMake(originX, originY);
this._nativeView.layer.anchorPoint = newPoint;
this.nativeView.layer.anchorPoint = newPoint;
if (this._cachedFrame) {
this._setNativeViewFrame(this._nativeView, this._cachedFrame);
this._setNativeViewFrame(this.nativeView, this._cachedFrame);
}
}
public _addToSuperview(superview: any, atIndex: number = Number.POSITIVE_INFINITY): boolean {
if (superview && this._nativeView) {
if (superview && this.nativeView) {
if (atIndex >= superview.subviews.count) {
superview.addSubview(this._nativeView);
superview.addSubview(this.nativeView);
} else {
superview.insertSubviewAtIndex(this._nativeView, atIndex);
superview.insertSubviewAtIndex(this.nativeView, atIndex);
}
return true;
@ -289,8 +285,8 @@ export class View extends ViewCommon {
}
public _removeFromSuperview() {
if (this._nativeView) {
this._nativeView.removeFromSuperview();
if (this.nativeView) {
this.nativeView.removeFromSuperview();
}
}
@ -310,56 +306,56 @@ export class View extends ViewCommon {
}
get [isEnabledProperty.native](): boolean {
let nativeView = this._nativeView;
let nativeView = this.nativeView;
return nativeView instanceof UIControl ? nativeView.enabled : true;
}
set [isEnabledProperty.native](value: boolean) {
let nativeView = this._nativeView;
let nativeView = this.nativeView;
if (nativeView instanceof UIControl) {
nativeView.enabled = value;
}
}
get [originXProperty.native](): number {
return this._nativeView.layer.anchorPoint.x;
return this.nativeView.layer.anchorPoint.x;
}
set [originXProperty.native](value: number) {
this.updateOriginPoint(value, this.originY);
}
get [originYProperty.native](): number {
return this._nativeView.layer.anchorPoint.y;
return this.nativeView.layer.anchorPoint.y;
}
set [originYProperty.native](value: number) {
this.updateOriginPoint(this.originX, value);
}
get [automationTextProperty.native](): string {
return this._nativeView.accessibilityLabel;
return this.nativeView.accessibilityLabel;
}
set [automationTextProperty.native](value: string) {
this._nativeView.accessibilityIdentifier = value;
this._nativeView.accessibilityLabel = value;
this.nativeView.accessibilityIdentifier = value;
this.nativeView.accessibilityLabel = value;
}
get [isUserInteractionEnabledProperty.native](): boolean {
return this._nativeView.userInteractionEnabled;
return this.nativeView.userInteractionEnabled;
}
set [isUserInteractionEnabledProperty.native](value: boolean) {
this._nativeView.userInteractionEnabled = value;
this.nativeView.userInteractionEnabled = value;
}
get [visibilityProperty.native](): Visibility {
return this._nativeView.hidden ? Visibility.COLLAPSE : Visibility.VISIBLE;
return this.nativeView.hidden ? Visibility.COLLAPSE : Visibility.VISIBLE;
}
set [visibilityProperty.native](value: Visibility) {
switch (value) {
case Visibility.VISIBLE:
this._nativeView.hidden = false;
this.nativeView.hidden = false;
break;
case Visibility.HIDDEN:
case Visibility.COLLAPSE:
this._nativeView.hidden = true;
this.nativeView.hidden = true;
break;
default:
throw new Error(`Invalid visibility value: ${value}. Valid values are: "${Visibility.VISIBLE}", "${Visibility.HIDDEN}", "${Visibility.COLLAPSE}".`);
@ -367,10 +363,10 @@ export class View extends ViewCommon {
}
get [opacityProperty.native](): number {
return this._nativeView.alpha;
return this.nativeView.alpha;
}
set [opacityProperty.native](value: number) {
let nativeView = this._nativeView;
let nativeView = this.nativeView;
let updateSuspended = this._isPresentationLayerUpdateSuspeneded();
if (!updateSuspended) {
CATransaction.begin();
@ -420,21 +416,22 @@ export class View extends ViewCommon {
return 0;
}
set [zIndexProperty.native](value: number) {
this._nativeView.layer.zPosition = value;
this.nativeView.layer.zPosition = value;
}
get [backgroundInternalProperty.native](): UIColor {
return this._nativeView.backgroundColor;
return this.nativeView.backgroundColor;
}
set [backgroundInternalProperty.native](value: UIColor | Background) {
let updateSuspended = this._isPresentationLayerUpdateSuspeneded();
if (!updateSuspended) {
CATransaction.begin();
}
if (value instanceof UIColor) {
this._nativeView.backgroundColor = value;
this.nativeView.backgroundColor = value;
} else {
this._nativeView.backgroundColor = ios.createBackgroundUIColor(this);
this.nativeView.backgroundColor = ios.createBackgroundUIColor(this);
}
if (!updateSuspended) {
CATransaction.commit();
@ -455,10 +452,6 @@ export class CustomLayoutView extends View {
return this._view;
}
get _nativeView(): UIView {
return this._view;
}
public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void {
// Don't call super because it will set MeasureDimension. This method must be overriden and calculate its measuredDimensions.
}
@ -466,7 +459,7 @@ export class CustomLayoutView extends View {
public _addViewToNativeVisualTree(child: View, atIndex: number): boolean {
super._addViewToNativeVisualTree(child, atIndex);
return child._addToSuperview(this._nativeView, atIndex);
return child._addToSuperview(this.nativeView, atIndex);
}
public _removeViewFromNativeVisualTree(child: View): void {

View File

@ -10,7 +10,7 @@ export module ios {
return undefined;
}
let nativeView = view._nativeView;
let nativeView = view.nativeView;
// Clip-path
if (background.clipPath) {
drawClipPath(nativeView, background);

View File

@ -3,6 +3,8 @@ import { enabled as traceEnabled, write as traceWrite, categories as traceCatego
import * as fs from "file-system";
import * as utils from "utils/utils";
export * from "./font-common";
export class Font extends FontBase {
public static default = new Font(undefined, undefined, FontStyle.NORMAL, FontWeight.NORMAL);

View File

@ -99,7 +99,7 @@ export class Transition implements TransitionDefinition {
}
public toString(): string {
return `${this}@${this._id}`;
return `Transition@${this._id}`;
}
}