mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
clean-up
This commit is contained in:

committed by
SvetoslavTsenov

parent
4d520e86db
commit
25129de985
@ -1,20 +1,9 @@
|
||||
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 {
|
||||
|
@ -9,8 +9,9 @@ const colors = ['red', 'green'];
|
||||
export function addRemove(counts: Array<number>, parent: LayoutBase): string {
|
||||
let result = `addRemove`;
|
||||
counts.forEach((count) => {
|
||||
if (count > 10000)
|
||||
if (count > 10000) {
|
||||
return;
|
||||
}
|
||||
|
||||
const lbl = new Label();
|
||||
const time = executeTest(() => {
|
||||
@ -30,7 +31,6 @@ export function setText(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setText ${parent ? 'with nativeView' : ''}`;
|
||||
counts.forEach((count) => {
|
||||
const lbl = setup(parent);
|
||||
const style = lbl.style;
|
||||
const time = executeTest(() => {
|
||||
for (let i = 0; i < count; i++) {
|
||||
lbl.text = colors[i % 2];
|
||||
@ -45,8 +45,10 @@ export function setText(counts: Array<number>, parent?: LayoutBase): string {
|
||||
export function setBackgroundColor(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setBackgroundColor ${parent ? 'with nativeView' : ''}`;
|
||||
counts.forEach((count) => {
|
||||
if (parent && count > 10000)
|
||||
if (parent && count > 10000) {
|
||||
return;
|
||||
}
|
||||
|
||||
const lbl = setup(parent);
|
||||
const style = lbl.style;
|
||||
const time = executeTest(() => {
|
||||
@ -64,8 +66,9 @@ const borders = [1, 2, 3];
|
||||
export function setBorderWidths(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setBorderWidths ${parent ? 'with nativeView' : ''}`;
|
||||
counts.forEach((count) => {
|
||||
if (count > 10000 && parent)
|
||||
if (count > 10000 && parent) {
|
||||
return;
|
||||
}
|
||||
|
||||
const lbl = setup(parent);
|
||||
const style = lbl.style;
|
||||
@ -103,8 +106,10 @@ export function setColorWithParents(counts: Array<number>, parent: LayoutBase):
|
||||
let result = `setColorWithParents`;
|
||||
const style = parent.style;
|
||||
counts.forEach((count) => {
|
||||
if (count > 10000)
|
||||
if (count > 10000) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupParents(parent);
|
||||
const time = executeTest(() => {
|
||||
for (let i = 0; i < count; i++) {
|
||||
@ -138,8 +143,10 @@ export function setFontSizeWithParents(counts: Array<number>, parent: LayoutBase
|
||||
let result = `setFontSizeWithParents`;
|
||||
const style = parent.style;
|
||||
counts.forEach((count) => {
|
||||
if (count > 1000)
|
||||
if (count > 1000) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupParents(parent);
|
||||
const time = executeTest(() => {
|
||||
for (let i = 0; i < count; i++) {
|
||||
@ -172,8 +179,10 @@ export function setFontWeightWithParents(counts: Array<number>, parent: LayoutBa
|
||||
let result = `setFontWeightWithParents`;
|
||||
const style = parent.style;
|
||||
counts.forEach((count) => {
|
||||
if (count > 1000)
|
||||
if (count > 1000) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupParents(parent);
|
||||
const time = executeTest(() => {
|
||||
for (let i = 0; i < count; i++) {
|
||||
@ -204,8 +213,9 @@ export function setBindingContext(counts: Array<number>, parent?: LayoutBase): s
|
||||
export function setBindingContextWithParents(counts: Array<number>, parent: LayoutBase): string {
|
||||
let result = `setBindingContextWithParents`;
|
||||
counts.forEach((count) => {
|
||||
if (count > 10000)
|
||||
if (count > 10000) {
|
||||
return;
|
||||
}
|
||||
setupParents(parent);
|
||||
const time = executeTest(() => {
|
||||
for (let i = 0; i < count; i++) {
|
||||
@ -221,8 +231,10 @@ export function setBindingContextWithParents(counts: Array<number>, parent: Layo
|
||||
export function setBindingContextWithParentsBound(counts: Array<number>, parent: LayoutBase): string {
|
||||
let result = `setBindingContextWithParentsBound`;
|
||||
counts.forEach((count) => {
|
||||
if (count > 1000)
|
||||
if (count > 1000) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupParents(parent, true);
|
||||
const time = executeTest(() => {
|
||||
for (let i = 0; i < count; i++) {
|
||||
|
Reference in New Issue
Block a user