From 185b84e0ba60a414c8bc4e255ef3ac299d514502 Mon Sep 17 00:00:00 2001 From: PanayotCankov Date: Wed, 21 Dec 2016 11:38:03 +0200 Subject: [PATCH] Let about 300 non UI tests run --- tests/app/testRunner.ts | 39 ++++++++++--------- tests/app/ui/layouts/flexbox-layout-tests.ts | 6 +-- tests/package.json | 4 +- tns-core-modules/ui/core/view.android.ts | 2 +- tns-core-modules/ui/core/view.d.ts | 4 +- .../ui/html-view/html-view.ios.ts | 5 ++- .../ui/web-view/web-view-common.ts | 3 +- 7 files changed, 33 insertions(+), 30 deletions(-) diff --git a/tests/app/testRunner.ts b/tests/app/testRunner.ts index cb0e782cb..bd4c38cc4 100644 --- a/tests/app/testRunner.ts +++ b/tests/app/testRunner.ts @@ -29,28 +29,29 @@ 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["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["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["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"); diff --git a/tests/app/ui/layouts/flexbox-layout-tests.ts b/tests/app/ui/layouts/flexbox-layout-tests.ts index fc37c0f6e..b0b817a20 100644 --- a/tests/app/ui/layouts/flexbox-layout-tests.ts +++ b/tests/app/ui/layouts/flexbox-layout-tests.ts @@ -10,7 +10,7 @@ import { } from "ui/layouts/flexbox-layout"; // << flexbox-layout-require -import {View, unsetValue, Length} from "ui/core/view"; +import {View, unsetValue, Length, PercentLength} from "ui/core/view"; import {Label} from "ui/label"; import * as TKUnit from "../../TKUnit"; import * as helper from "../helper"; @@ -1844,7 +1844,7 @@ export const testWrap_childMargin_horizontal = test( ({flexbox, text1, text2, text3}) => { isBelow(text2, text1); isRightOf(text3, text2); - closeEnough(height(flexbox), height(text1) + height(text2) + Length.toDevicePixels(text2.style.marginTop, 0) + Length.toDevicePixels(text2.style.marginBottom, 0)); + closeEnough(height(flexbox), height(text1) + height(text2) + PercentLength.toDevicePixels(text2.style.marginTop, 0, Number.NaN) + PercentLength.toDevicePixels(text2.style.marginBottom, 0, Number.NaN)); } ); @@ -1907,7 +1907,7 @@ export const testWrap_childMargin_vertical = test( isRightOf(text2, text1); isBelow(text3, text2); // dips anyone? - closeEnough(width(flexbox), width(text1) + width(text2) + Length.toDevicePixels(text2.marginLeft, 0) + Length.toDevicePixels(text2.marginRight, 0)); + closeEnough(width(flexbox), width(text1) + width(text2) + PercentLength.toDevicePixels(text2.marginLeft, 0, Number.NaN) + PercentLength.toDevicePixels(text2.marginRight, 0, Number.NaN)); } ); diff --git a/tests/package.json b/tests/package.json index 0b146b679..ecbc54685 100644 --- a/tests/package.json +++ b/tests/package.json @@ -9,7 +9,7 @@ "version": "2.4.0" }, "tns-android": { - "version": "2.4.0" + "version": "2.4.1" } }, "dependencies": { @@ -24,4 +24,4 @@ "lazy": "1.0.11", "typescript": "~2.0.10" } -} \ No newline at end of file +} diff --git a/tns-core-modules/ui/core/view.android.ts b/tns-core-modules/ui/core/view.android.ts index 6063e2c15..989f24626 100644 --- a/tns-core-modules/ui/core/view.android.ts +++ b/tns-core-modules/ui/core/view.android.ts @@ -542,7 +542,7 @@ interface NativePercentLengthPropertyOptions { setPercent?: NativeSetter } function createNativePercentLengthProperty({key, auto = 0, getPixels, setPixels, setPercent = percentNotSupported}: NativePercentLengthPropertyOptions) { - Object.defineProperty(View, key, { + Object.defineProperty(View.prototype, key, { get: function (this: View) { return { value: getPixels(this.nativeView), unit: "px" } }, set: function (this: View, length: PercentLength) { if (length == "auto") { diff --git a/tns-core-modules/ui/core/view.d.ts b/tns-core-modules/ui/core/view.d.ts index 5fbfef5f8..aebeb5bb4 100644 --- a/tns-core-modules/ui/core/view.d.ts +++ b/tns-core-modules/ui/core/view.d.ts @@ -104,10 +104,10 @@ declare module "ui/core/view" { export function equals(a: Length, b: Length): boolean; /** * Converts Length unit to device pixels. - * @param length The PercentLength to convert. + * @param length The Length to convert. * @param auto Value to use for conversion of "auto". */ - export function toDevicePixels(length: PercentLength, auto: number): number; + export function toDevicePixels(length: Length, auto: number): number; } export type PercentLength = "auto" | number | { diff --git a/tns-core-modules/ui/html-view/html-view.ios.ts b/tns-core-modules/ui/html-view/html-view.ios.ts index 99cf05bde..243bcb686 100644 --- a/tns-core-modules/ui/html-view/html-view.ios.ts +++ b/tns-core-modules/ui/html-view/html-view.ios.ts @@ -3,6 +3,9 @@ import { View, layout, Property } from "ui/core/view"; export * from "ui/core/view"; +// TODO: Can we use Label.ios optimization for affectsLayout??? +export const htmlProperty = new Property({ name: "html", defaultValue: "", affectsLayout: true }); + export class HtmlView extends View implements HtmlViewDefinition { private _ios: UITextView; @@ -70,6 +73,4 @@ export class HtmlView extends View implements HtmlViewDefinition { } } -// TODO: Can we use Label.ios optimization for affectsLayout??? -export const htmlProperty = new Property({ name: "html", defaultValue: "", affectsLayout: true }); htmlProperty.register(HtmlView); \ No newline at end of file diff --git a/tns-core-modules/ui/web-view/web-view-common.ts b/tns-core-modules/ui/web-view/web-view-common.ts index f8ec37375..8f747d797 100644 --- a/tns-core-modules/ui/web-view/web-view-common.ts +++ b/tns-core-modules/ui/web-view/web-view-common.ts @@ -6,6 +6,8 @@ import { File, knownFolders, path } from "file-system"; export { File, knownFolders, path }; export * from "ui/core/view"; +export const srcProperty = new Property({ name: "url" }); + export abstract class WebViewBase extends View implements WebViewDefinition { public static loadStartedEvent = "loadStarted"; public static loadFinishedEvent = "loadFinished"; @@ -103,5 +105,4 @@ export abstract class WebViewBase extends View implements WebViewDefinition { } } -export const srcProperty = new Property({ name: "url" }); srcProperty.register(WebViewBase); \ No newline at end of file