From 4d520e86dbfef8eb19037454068e41f833230fde Mon Sep 17 00:00:00 2001 From: Panayot Cankov Date: Thu, 23 Mar 2017 17:21:03 +0200 Subject: [PATCH 1/5] Added perf category in the tests suite and the synthetic properties perf app from HHristov --- apps/app/ui-tests-app/mainPage.ts | 2 + apps/app/ui-tests-app/perf/main-page.ts | 23 ++ apps/app/ui-tests-app/perf/main-page.xml | 6 + .../ui-tests-app/perf/properties/main-page.ts | 86 ++++++ .../perf/properties/main-page.xml | 7 + .../app/ui-tests-app/perf/properties/tests.ts | 289 ++++++++++++++++++ 6 files changed, 413 insertions(+) create mode 100644 apps/app/ui-tests-app/perf/main-page.ts create mode 100644 apps/app/ui-tests-app/perf/main-page.xml create mode 100644 apps/app/ui-tests-app/perf/properties/main-page.ts create mode 100644 apps/app/ui-tests-app/perf/properties/main-page.xml create mode 100644 apps/app/ui-tests-app/perf/properties/tests.ts diff --git a/apps/app/ui-tests-app/mainPage.ts b/apps/app/ui-tests-app/mainPage.ts index 296a51e2e..b2f03541b 100644 --- a/apps/app/ui-tests-app/mainPage.ts +++ b/apps/app/ui-tests-app/mainPage.ts @@ -38,6 +38,8 @@ export function pageLoaded(args: EventData) { examples.set("issues", "issues/main-page"); examples.set("page", "page/main-page"); + examples.set("perf", "perf/main-page"); + //examples.set("listview_binding", "pages/listview_binding"); //examples.set("textfield", "text-field/text-field"); diff --git a/apps/app/ui-tests-app/perf/main-page.ts b/apps/app/ui-tests-app/perf/main-page.ts new file mode 100644 index 000000000..820e8776d --- /dev/null +++ b/apps/app/ui-tests-app/perf/main-page.ts @@ -0,0 +1,23 @@ +import { EventData } from "tns-core-modules/data/observable"; +import { MainPageViewModel } from "../mainPage"; +import { WrapLayout } from "tns-core-modules/ui/layouts/wrap-layout"; +import { Page } from "tns-core-modules/ui/page"; + +export function pageLoaded(args: EventData) { + let page = args.object; + let view = require("ui/core/view"); + + let wrapLayout = view.getViewById(page, "wrapLayoutWithExamples"); + + let examples: Map = new Map(); + examples.set("properties", "perf/properties/main-page"); + + let viewModel = new SubMainPageViewModel(wrapLayout, examples); + page.bindingContext = viewModel; +} + +export class SubMainPageViewModel extends MainPageViewModel { + constructor(container: WrapLayout, examples: Map) { + super(container, examples); + } +} diff --git a/apps/app/ui-tests-app/perf/main-page.xml b/apps/app/ui-tests-app/perf/main-page.xml new file mode 100644 index 000000000..33306f0d0 --- /dev/null +++ b/apps/app/ui-tests-app/perf/main-page.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/apps/app/ui-tests-app/perf/properties/main-page.ts b/apps/app/ui-tests-app/perf/properties/main-page.ts new file mode 100644 index 000000000..5a7feb510 --- /dev/null +++ b/apps/app/ui-tests-app/perf/properties/main-page.ts @@ -0,0 +1,86 @@ +import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout"; +import { Label } from "tns-core-modules/ui/label"; +import { TextView } from "tns-core-modules/ui/text-view"; +import { Button } from "tns-core-modules/ui/button"; +import { Page } from "tns-core-modules/ui/page"; +import { Color } from "tns-core-modules/color"; +import { isIOS } from "tns-core-modules/platform"; + +import * as knownColors from "tns-core-modules/color/known-colors"; + +import * as tests from "./tests"; + +let red = new Color(knownColors.Red); +let green = new Color(knownColors.Green); +let blue = new Color(knownColors.Blue); +let purple = new Color(knownColors.Purple); + +const c = [10, 100, 1000, 10000, 100000]; + +function getStack(stack: StackLayout): StackLayout { + let p = new StackLayout(); + stack.removeChildren(); + stack.addChild(p); + return p; +} + +let runner; + +export function onNavigatingFrom() { + clearInterval(runner); +} + +export function onTap3(args) { + let btn =