Revert tests for Length where NaN or number was used

This commit is contained in:
Panayot Cankov
2016-12-19 15:53:44 +02:00
parent 6cfbaae947
commit e90e2de927
18 changed files with 178 additions and 178 deletions

View File

@@ -26,7 +26,7 @@ export function createPage() {
var sp1 = new sp.StackLayout();
sp1.orientation = "horizontal";
sp1.height = { value: 200, unit: "dip" };
sp1.height = 200;
var b1 = new button.Button();
b1.text = "nested Btn1";

View File

@@ -41,7 +41,7 @@ export function createPage() {
var txt = new tb.TextField();
txt.text = "Col: 1";
txt.width = { value: 140, unit: "dip" };
txt.width = 140;
gridLayoutModule.GridLayout.setColumn(txt, 1);
gridLayoutModule.GridLayout.setRow(txt, 0);
gridLayout.addChild(txt);

View File

@@ -7,17 +7,17 @@ export function createPage() {
var linearLayout = new layout.StackLayout();
var btn = addButton(linearLayout, "left");
btn.marginLeft = { value: 100, unit: "dip" };
btn.marginLeft = 100;
btn = addButton(linearLayout, "center");
btn.marginTop = { value: 100, unit: "dip" };
btn.marginTop = 100;
btn = addButton(linearLayout, "right");
btn.marginRight = { value: 100, unit: "dip" };
btn.marginRight = 100;
btn = addButton(linearLayout, "stretch");
btn.marginLeft = { value: 100, unit: "dip" };
btn.marginRight = { value: 100, unit: "dip" };
btn.marginTop = { value: 100, unit: "dip" };
btn.marginBottom = { value: 100, unit: "dip" };
btn.marginLeft = 100;
btn.marginRight = 100;
btn.marginTop = 100;
btn.marginBottom = 100;
page.content = linearLayout;
return page;
@@ -28,6 +28,6 @@ function addButton(layout: layout.StackLayout, text: "left" | "center" | "middle
btn.text = text;
btn.horizontalAlignment = text;
layout.addChild(btn);
layout.style.paddingLeft = { value: 5, unit: "dip" };
layout.style.paddingLeft = 5;
return btn;
}

View File

@@ -9,10 +9,10 @@ export function createPage() {
var btn1 = new buttonModule.Button();
btn1.horizontalAlignment = "left";
btn1.verticalAlignment = "top";
btn1.marginTop = { value: 10, unit: "dip" };
btn1.marginRight = { value: 0, unit: "dip" };
btn1.marginBottom = { value: 10, unit: "dip" };
btn1.marginLeft = { value: 20, unit: "dip" };
btn1.marginTop = 10;
btn1.marginRight = 0;
btn1.marginBottom = 10;
btn1.marginLeft = 20;
btn1.text = "top, left";
var btn2 = new buttonModule.Button();

View File

@@ -20,8 +20,8 @@ export function test_default_TNS_values() {
export function test_default_native_values() {
var indicator = new activityIndicatorModule.ActivityIndicator();
indicator.width = { value: 50, unit: "dip" };
indicator.height = { value: 50, unit: "dip" };
indicator.width = 50;
indicator.height = 50;
function testAction(views: Array<viewModule.View>) {
TKUnit.assertEqual(getNativeBusy(indicator), false, "Default native indicator.busy");
@@ -32,8 +32,8 @@ export function test_default_native_values() {
export function test_set_TNS_value_updates_native_value() {
var indicator = new activityIndicatorModule.ActivityIndicator();
indicator.width = { value: 50, unit: "dip" };
indicator.height = { value: 50, unit: "dip" };
indicator.width = 50;
indicator.height = 50;
function testAction(views: Array<viewModule.View>) {
indicator.busy = true;
@@ -66,8 +66,8 @@ function binding_busy_to_image() {
// >> activity-indicator-loading
var image = new imageModule.Image();
var indicator = new activityIndicatorModule.ActivityIndicator();
indicator.width = { value: 100, unit: "dip" };
indicator.height = { value: 100, unit: "dip" };
indicator.width = 100;
indicator.height = 100;
// Bind the busy property of the indicator to the isLoading property of the image
indicator.bind({

View File

@@ -26,8 +26,8 @@ export function test_percent_width_and_height_set_to_page_support() {
currentPage.height = unsetValue;
currentPage.width = unsetValue;
TKUnit.assertTrue(PercentLength.equals(currentPage.width, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(currentPage.width, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(currentPage.width, "auto"));
TKUnit.assertTrue(PercentLength.equals(currentPage.height, "auto"));
}
export function test_percent_margin_set_to_page_support() {
@@ -57,8 +57,8 @@ export function test_percent_margin_set_to_page_support() {
//reset values.
currentPage.margin = "0";
TKUnit.assertTrue(PercentLength.equals(currentPage.marginLeft, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginTop, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginRight, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginBottom, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginLeft, 0));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginTop, 0));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginRight, 0));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginBottom, 0));
}

View File

@@ -28,8 +28,8 @@ export function test_percent_width_and_height_set_to_page_support() {
currentPage.height = unsetValue;
currentPage.width = unsetValue;
TKUnit.assertTrue(PercentLength.equals(currentPage.width, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(currentPage.height, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(currentPage.width, "auto"));
TKUnit.assertTrue(PercentLength.equals(currentPage.height, "auto"));
}
export function test_percent_margin_set_to_page_support() {
@@ -59,8 +59,8 @@ export function test_percent_margin_set_to_page_support() {
//reset values.
currentPage.margin = "0";
TKUnit.assertTrue(PercentLength.equals(currentPage.marginLeft, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginTop, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginRight, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginBottom, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginLeft, 0));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginTop, 0));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginRight, 0));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginBottom, 0));
}

View File

@@ -552,8 +552,8 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
public test_SettingTextWhenInFixedSizeGridShouldNotRequestLayout() {
this.requestLayoutFixture(false, "", () => {
let host = new GridLayout();
host.width = { value: 100, unit: "dip" };
host.height = { value: 100, unit: "dip" };
host.width = 100;
host.height = 100;
return host;
});
}
@@ -561,8 +561,8 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
public test_ChangingTextWhenInFixedSizeGridShouldNotRequestLayout() {
this.requestLayoutFixture(false, "Hello World", () => {
let host = new GridLayout();
host.width = { value: 100, unit: "dip" };
host.height = { value: 100, unit: "dip" };
host.width = 100;
host.height = 100;
return host;
});
}
@@ -570,8 +570,8 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
public test_SettingTextWhenFixedWidthAndHeightDoesNotRequestLayout() {
this.requestLayoutFixture(false, "", label => {
let host = new StackLayout();
label.width = { value: 100, unit: "dip" };
label.height = { value: 100, unit: "dip" };
label.width = 100;
label.height = 100;
return host;
});
};
@@ -579,8 +579,8 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
public test_ChangingTextWhenFixedWidthAndHeightDoesNotRequestLayout() {
this.requestLayoutFixture(false, "Hello World", label => {
let host = new StackLayout();
label.width = { value: 100, unit: "dip" };
label.height = { value: 100, unit: "dip" };
label.width = 100;
label.height = 100;
return host;
});
};
@@ -604,7 +604,7 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
public test_SettingTextOnSingleLineTextWhenWidthIsSizedToParentAndHeightIsSizedToContentShouldRequestLayout() {
this.requestLayoutFixture(true, "", () => {
let host = new StackLayout();
host.width = { value: 100, unit: "dip" };
host.width = 100;
return host;
});
}
@@ -612,7 +612,7 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
public test_ChangingTextOnSingleLineTextWhenWidthIsSizedToParentAndHeightIsSizedToContentShouldNotRequestLayout() {
this.requestLayoutFixture(false, "Hello World", () => {
let host = new StackLayout();
host.width = { value: 100, unit: "dip" };
host.width = 100;
return host;
});
}
@@ -621,7 +621,7 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
this.requestLayoutFixture(true, "", label => {
label.textWrap = true;
let host = new StackLayout();
host.width = { value: 100, unit: "dip" };
host.width = 100;
return host;
});
}
@@ -630,7 +630,7 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
this.requestLayoutFixture(true, "Hello World", label => {
label.textWrap = true;
let host = new StackLayout();
host.width = { value: 100, unit: "dip" };
host.width = 100;
return host;
});
}

View File

@@ -19,15 +19,15 @@ export class AbsoluteLayoutTest extends testModule.UITest<absoluteLayoutModule.A
// >> absolute-layout-populating
var absoluteLayout = new absoluteLayoutModule.AbsoluteLayout();
absoluteLayout.width = {value: 230, unit:"dip"};
absoluteLayout.height = {value: 230, unit:"dip"};
absoluteLayout.width = 230;
absoluteLayout.height = 230;
absoluteLayout.style.backgroundColor = new colorModule.Color("LightGray");
var label = new labelModule.Label();
// In absolute layout place of an UI element is determined by 4 parameters : left, top, width and height.
absoluteLayoutModule.AbsoluteLayout.setLeft(label, 10);
absoluteLayoutModule.AbsoluteLayout.setTop(label, 10);
label.width = {value: 100, unit:"dip"};
label.height = {value: 100, unit:"dip"};
label.width = 100;
label.height = 100;
label.text = "LT";
label.id = "LT";
label.style.backgroundColor = new colorModule.Color("Red");
@@ -38,15 +38,15 @@ export class AbsoluteLayoutTest extends testModule.UITest<absoluteLayoutModule.A
public testAll() {
let absoluteLayout = this.testView;
absoluteLayout.width = { value: 230, unit: "dip" };
absoluteLayout.height = { value: 230, unit: "dip" };
absoluteLayout.width = { value: 230, unit: "px" };
absoluteLayout.height = { value: 230, unit: "px" };
absoluteLayout.style.backgroundColor = new colorModule.Color("LightGray");
let label = new labelModule.Label();
absoluteLayoutModule.AbsoluteLayout.setLeft(label, layoutHelper.dp(10));
absoluteLayoutModule.AbsoluteLayout.setTop(label, layoutHelper.dp(10));
label.width = { value: 100, unit: "dip" };
label.height = { value: 100, unit: "dip" };
label.width = { value: 100, unit: "px" };
label.height = { value: 100, unit: "px" };
label.text = "LT";
label.style.backgroundColor = new colorModule.Color("Red");
absoluteLayout.addChild(label);
@@ -64,15 +64,15 @@ export class AbsoluteLayoutTest extends testModule.UITest<absoluteLayoutModule.A
public test_padding() {
let absoluteLayout = this.testView;
absoluteLayout.width = { value: 200, unit: "dip" };
absoluteLayout.height = { value: 200, unit: "dip" };
absoluteLayout.style.paddingLeft = { value: 5, unit: "dip" };
absoluteLayout.style.paddingTop = { value: 15, unit: "dip" };
absoluteLayout.width = { value: 200, unit: "px" };
absoluteLayout.height = { value: 200, unit: "px" };
absoluteLayout.style.paddingLeft = { value: 5, unit: "px" };
absoluteLayout.style.paddingTop = { value: 15, unit: "px" };
// Left Top
let btn = new layoutHelper.MyButton();
btn.width = { value: 100, unit: "dip" };
btn.height = { value: 100, unit: "dip" };
btn.width = { value: 100, unit: "px" };
btn.height = { value: 100, unit: "px" };
absoluteLayoutModule.AbsoluteLayout.setLeft(btn, layoutHelper.dp(20));
absoluteLayoutModule.AbsoluteLayout.setTop(btn, layoutHelper.dp(20));
absoluteLayout.addChild(btn);
@@ -84,8 +84,8 @@ export class AbsoluteLayoutTest extends testModule.UITest<absoluteLayoutModule.A
public test_percent_children_support() {
let layout = this.testView;
layout.width = { value: 200, unit: "dip" };
layout.height = { value: 200, unit: "dip" };
layout.width = { value: 200, unit: "px" };
layout.height = { value: 200, unit: "px" };
let btn = new layoutHelper.MyButton();
(<any>btn).width = "50%";

View File

@@ -20,12 +20,12 @@ export function percent_support_nativeLayoutParams_are_correct(test: testModule.
}
let layout = test.testView;
layout.width = { value: 200, unit: "dip" };
layout.height = { value: 200, unit: "dip" };
layout.width = { value: 200, unit: "px" };
layout.height = { value: 200, unit: "px" };
let btn = new layoutHelper.MyButton();
btn.width = { value: 100, unit: "dip" };
btn.height = { value: 100, unit: "dip" };
btn.width = { value: 100, unit: "px" };
btn.height = { value: 100, unit: "px" };
btn.margin = "10%";
layout.addChild(btn);
@@ -77,8 +77,8 @@ export function percent_support_nativeLayoutParams_are_correct(test: testModule.
export function percent_support_children_test(test: testModule.UITest<LayoutBase>) {
let layout: LayoutBase = test.testView;
layout.removeChildren();
layout.width = { value: 200, unit: "dip" };
layout.height = { value: 200, unit: "dip" };
layout.width = { value: 200, unit: "px" };
layout.height = { value: 200, unit: "px" };
let btn = new layoutHelper.MyButton();
btn.horizontalAlignment = "left";
@@ -139,13 +139,13 @@ export function percent_support_children_test(test: testModule.UITest<LayoutBase
btn.verticalAlignment = "stretch";
btn.height = unsetValue;
TKUnit.assertTrue(PercentLength.equals(btn.marginLeft, {value: 0, unit: "dip"}));
TKUnit.assertTrue(PercentLength.equals(btn.marginTop, {value: 0, unit: "dip"}));
TKUnit.assertTrue(PercentLength.equals(btn.marginRight, {value: 0, unit: "dip"}));
TKUnit.assertTrue(PercentLength.equals(btn.marginBottom, {value: 0, unit: "dip"}));
TKUnit.assertTrue(PercentLength.equals(btn.marginLeft, 0));
TKUnit.assertTrue(PercentLength.equals(btn.marginTop, 0));
TKUnit.assertTrue(PercentLength.equals(btn.marginRight, 0));
TKUnit.assertTrue(PercentLength.equals(btn.marginBottom, 0));
TKUnit.assertTrue(PercentLength.equals(btn.width, {value: 0, unit: "dip"}));
TKUnit.assertTrue(PercentLength.equals(btn.height, {value: 0, unit: "dip"}));
TKUnit.assertTrue(PercentLength.equals(btn.width, "auto"));
TKUnit.assertTrue(PercentLength.equals(btn.height, "auto"));
test.waitUntilTestElementLayoutIsValid();

View File

@@ -19,8 +19,8 @@ export class DockLayoutTest extends testModule.UITest<DockLayout> {
public create(): DockLayout {
let rootLayout = new DockLayout();
rootLayout.height = { value: 300, unit: "dip" };
rootLayout.width = { value: 300, unit: "dip" };
rootLayout.height = { value: 300, unit: "px" };
rootLayout.width = { value: 300, unit: "px" };
return rootLayout;
}
@@ -44,7 +44,7 @@ export class DockLayoutTest extends testModule.UITest<DockLayout> {
public test_dock_left() {
var testBtn = new helper.MyButton();
testBtn.width = { value: 20, unit: "dip" }
testBtn.width = { value: 20, unit: "px" }
this.testView.stretchLastChild = false;
this.testView.addChild(testBtn);
@@ -55,7 +55,7 @@ export class DockLayoutTest extends testModule.UITest<DockLayout> {
public test_dock_right() {
var testBtn = new helper.MyButton();
testBtn.width = { value: 20, unit: "dip" };
testBtn.width = { value: 20, unit: "px" };
dockModule.DockLayout.setDock(testBtn, enums.Dock.right);
this.testView.stretchLastChild = false;
this.testView.addChild(testBtn);
@@ -67,7 +67,7 @@ export class DockLayoutTest extends testModule.UITest<DockLayout> {
public test_dock_top() {
var testBtn = new helper.MyButton();
testBtn.height = { value: 20, unit: "dip" };
testBtn.height = { value: 20, unit: "px" };
dockModule.DockLayout.setDock(testBtn, enums.Dock.top);
this.testView.stretchLastChild = false;
this.testView.addChild(testBtn);
@@ -79,7 +79,7 @@ export class DockLayoutTest extends testModule.UITest<DockLayout> {
public test_dock_button() {
var testBtn = new helper.MyButton();
testBtn.height = { value: 20, unit: "dip" };
testBtn.height = { value: 20, unit: "px" };
dockModule.DockLayout.setDock(testBtn, enums.Dock.bottom);
this.testView.stretchLastChild = false;
this.testView.addChild(testBtn);
@@ -100,21 +100,21 @@ export class DockLayoutTest extends testModule.UITest<DockLayout> {
public test_dock_left_top_righ_bottom_fill() {
var testBtnLeft = new helper.MyButton();
testBtnLeft.width = { value: 20, unit: "dip" };
testBtnLeft.width = { value: 20, unit: "px" };
this.testView.addChild(testBtnLeft);
var testBtnTop = new helper.MyButton();
testBtnTop.height = { value: 20, unit: "dip" };
testBtnTop.height = { value: 20, unit: "px" };
dockModule.DockLayout.setDock(testBtnTop, enums.Dock.top);
this.testView.addChild(testBtnTop);
var testBtnRight = new helper.MyButton();
testBtnRight.width = { value: 20, unit: "dip" }
testBtnRight.width = { value: 20, unit: "px" }
dockModule.DockLayout.setDock(testBtnRight, enums.Dock.right);
this.testView.addChild(testBtnRight);
var testBtnBottom = new helper.MyButton();
testBtnBottom.height = { value: 20, unit: "dip" }
testBtnBottom.height = { value: 20, unit: "px" }
dockModule.DockLayout.setDock(testBtnBottom, enums.Dock.bottom);
this.testView.addChild(testBtnBottom);
@@ -134,10 +134,10 @@ export class DockLayoutTest extends testModule.UITest<DockLayout> {
public test_padding() {
var testBtn = new helper.MyButton();
this.testView.addChild(testBtn);
this.testView.style.paddingLeft = { value: 10, unit: "dip" };
this.testView.style.paddingTop = { value: 20, unit: "dip" };
this.testView.style.paddingRight = { value: 30, unit: "dip" };
this.testView.style.paddingBottom = { value: 40, unit: "dip" };
this.testView.style.paddingLeft = { value: 10, unit: "px" };
this.testView.style.paddingTop = { value: 20, unit: "px" };
this.testView.style.paddingRight = { value: 30, unit: "px" };
this.testView.style.paddingBottom = { value: 40, unit: "px" };
this.waitUntilTestElementLayoutIsValid();

View File

@@ -92,16 +92,16 @@ export class StackLayoutTest extends testModule.UITest<StackLayout> {
}
public test_Padding_Vertical() {
this.rootLayout.width = { value: 300, unit: "dip" };
this.rootLayout.height = { value: 300, unit: "dip" };
this.rootLayout.width = { value: 300, unit: "px" };
this.rootLayout.height = { value: 300, unit: "px" };
this.rootLayout.style.paddingLeft = { value: 10, unit: "dip" };
this.rootLayout.style.paddingTop = { value: 20, unit: "dip" };
this.rootLayout.style.paddingRight = { value: 30, unit: "dip" };
this.rootLayout.style.paddingBottom = { value: 40, unit: "dip" };
this.rootLayout.style.paddingLeft = { value: 10, unit: "px" };
this.rootLayout.style.paddingTop = { value: 20, unit: "px" };
this.rootLayout.style.paddingRight = { value: 30, unit: "px" };
this.rootLayout.style.paddingBottom = { value: 40, unit: "px" };
this.btn1.height = { value: 50, unit: "dip" };
this.btn2.height = { value: 50, unit: "dip" };
this.btn1.height = { value: 50, unit: "px" };
this.btn2.height = { value: 50, unit: "px" };
this.waitUntilTestElementLayoutIsValid();
@@ -113,17 +113,17 @@ export class StackLayoutTest extends testModule.UITest<StackLayout> {
}
public test_Padding_Horizontal() {
this.rootLayout.width = { value: 300, unit: "dip" };
this.rootLayout.height = { value: 300, unit: "dip" };
this.rootLayout.width = { value: 300, unit: "px" };
this.rootLayout.height = { value: 300, unit: "px" };
this.rootLayout.orientation = "horizontal";
this.rootLayout.style.paddingLeft = { value: 10, unit: "dip" };
this.rootLayout.style.paddingTop = { value: 20, unit: "dip" };
this.rootLayout.style.paddingRight = { value: 30, unit: "dip" };
this.rootLayout.style.paddingBottom = { value: 40, unit: "dip" };
this.rootLayout.style.paddingLeft = { value: 10, unit: "px" };
this.rootLayout.style.paddingTop = { value: 20, unit: "px" };
this.rootLayout.style.paddingRight = { value: 30, unit: "px" };
this.rootLayout.style.paddingBottom = { value: 40, unit: "px" };
this.btn1.width = { value: 50, unit: "dip" };
this.btn2.width = { value: 50, unit: "dip" };
this.btn1.width = { value: 50, unit: "px" };
this.btn2.width = { value: 50, unit: "px" };
this.waitUntilTestElementLayoutIsValid();
@@ -190,8 +190,8 @@ export class StackLayoutTest extends testModule.UITest<StackLayout> {
private setup_percent(): layoutHelper.MyButton {
let layout = this.testView;
layout.removeChildren();
layout.width = { value: 200, unit: "dip" };
layout.height = { value: 200, unit: "dip" };
layout.width = { value: 200, unit: "px" };
layout.height = { value: 200, unit: "px" };
let btn = new layoutHelper.MyButton();
btn.horizontalAlignment = "left";

View File

@@ -19,15 +19,15 @@ export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayou
var wrapLayout = new wrapLayoutModule.WrapLayout();
// << wrap-layout-new
wrapLayout.width = { value: 200, unit: "dip" };
wrapLayout.height = { value: 200, unit: "dip" };
wrapLayout.width = { value: 200, unit: "px" };
wrapLayout.height = { value: 200, unit: "px" };
for (let i = 0; i < 2; i++) {
let label = new Label();
label.text = "" + i;
label.width = { value: 100, unit: "dip" };
label.height = { value: 100, unit: "dip" };
label.width = { value: 100, unit: "px" };
label.height = { value: 100, unit: "px" };
wrapLayout.addChild(label);
}
@@ -38,8 +38,8 @@ export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayou
let wrap = this.testView;
wrap.removeChildren();
wrap.itemWidth = { value: 40, unit: "dip" };
wrap.itemHeight = { value: 40, unit: "dip" };
wrap.itemWidth = { value: 40, unit: "px" };
wrap.itemHeight = { value: 40, unit: "px" };
let lbl1 = new layoutHelper.MyButton();
lbl1.text = "1";
@@ -47,8 +47,8 @@ export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayou
let lbl2 = new layoutHelper.MyButton();
lbl2.text = "2";
lbl2.width = { value: 80, unit: "dip" };
lbl2.height = { value: 80, unit: "dip" };
lbl2.width = { value: 80, unit: "px" };
lbl2.height = { value: 80, unit: "px" };
wrap.addChild(lbl2);
this.waitUntilTestElementLayoutIsValid();
@@ -67,12 +67,12 @@ export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayou
public testPaddingReduceAvailableSize() {
let wrap = this.testView;
wrap.removeChildren();
wrap.style.paddingLeft = wrap.style.paddingTop = wrap.style.paddingRight = wrap.style.paddingBottom = { value: 10, unit: "dip" };
wrap.style.paddingLeft = wrap.style.paddingTop = wrap.style.paddingRight = wrap.style.paddingBottom = { value: 10, unit: "px" };
let lbl1 = new layoutHelper.MyButton();
lbl1.text = "1";
lbl1.minWidth = { value: 200, unit: "dip" };
lbl1.minHeight = { value: 200, unit: "dip" };
lbl1.minWidth = { value: 200, unit: "px" };
lbl1.minHeight = { value: 200, unit: "px" };
wrap.addChild(lbl1);
this.waitUntilTestElementLayoutIsValid();
@@ -141,7 +141,7 @@ export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayou
}
public testItemWidth() {
this.testView.itemWidth = { value: 50, unit: "dip" };
this.testView.itemWidth = { value: 50, unit: "px" };
this.waitUntilTestElementLayoutIsValid();
let actualValue = this.testView.getChildAt(1)._getCurrentLayoutBounds().left;
@@ -150,7 +150,7 @@ export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayou
public testChangeItemWidth() {
this.waitUntilTestElementLayoutIsValid();
this.testView.itemWidth = { value: 50, unit: "dip" };
this.testView.itemWidth = { value: 50, unit: "px" };
this.waitUntilTestElementLayoutIsValid();
let actualValue = this.testView.getChildAt(1)._getCurrentLayoutBounds().left;
@@ -158,7 +158,7 @@ export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayou
}
public testItemWidthLargerThanTheAvailableWidth() {
this.testView.itemWidth = { value: 1000, unit: "dip" };
this.testView.itemWidth = { value: 1000, unit: "px" };
this.waitUntilTestElementLayoutIsValid();
TKUnit.assertEqual(this.testView.getChildAt(0)._getCurrentLayoutBounds().top, 0, "ActualTop on Index 0");
@@ -166,7 +166,7 @@ export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayou
}
public testItemHeight() {
this.testView.itemHeight = { value: 50, unit: "dip" };
this.testView.itemHeight = { value: 50, unit: "px" };
this.testView.orientation = "vertical";
this.waitUntilTestElementLayoutIsValid();
@@ -177,7 +177,7 @@ export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayou
public testChangeItemHeight() {
this.testView.orientation = "vertical";
this.waitUntilTestElementLayoutIsValid();
this.testView.itemHeight = { value: 50, unit: "dip" };
this.testView.itemHeight = { value: 50, unit: "px" };
this.waitUntilTestElementLayoutIsValid();
let actualValue = this.testView.getChildAt(1)._getCurrentLayoutBounds().top;
@@ -187,7 +187,7 @@ export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayou
public testItemHeightLargerThanTheAvailableHeight() {
this.testView.orientation = "vertical";
this.waitUntilTestElementLayoutIsValid();
this.testView.itemHeight = { value: 1000, unit: "dip" };
this.testView.itemHeight = { value: 1000, unit: "px" };
this.waitUntilTestElementLayoutIsValid();
TKUnit.assertEqual(this.testView.getChildAt(0)._getCurrentLayoutBounds().left, 0, "ActualLeft on Index 0");
@@ -196,12 +196,12 @@ export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayou
public testPaddingLeftAndTop() {
this.testView.removeChildren();
this.testView.style.paddingLeft = { value: 20, unit: "dip" };
this.testView.style.paddingTop = { value: 30, unit: "dip" };
this.testView.style.paddingLeft = { value: 20, unit: "px" };
this.testView.style.paddingTop = { value: 30, unit: "px" };
var btn = new layoutHelper.MyButton();
btn.width = { value: 50, unit: "dip" };
btn.height = { value: 50, unit: "dip" };
btn.width = { value: 50, unit: "px" };
btn.height = { value: 50, unit: "px" };
this.testView.addChild(btn);
this.waitUntilTestElementLayoutIsValid();
@@ -211,17 +211,17 @@ export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayou
public testPaddingRight() {
this.testView.removeChildren();
this.testView.style.paddingRight = { value: 30, unit: "dip" };
this.testView.width = { value: 200, unit: "dip" };
this.testView.style.paddingRight = { value: 30, unit: "px" };
this.testView.width = { value: 200, unit: "px" };
var btn1 = new layoutHelper.MyButton();
this.testView.addChild(btn1);
btn1.width = { value: 100, unit: "dip" };
btn1.height = { value: 50, unit: "dip" };
btn1.width = { value: 100, unit: "px" };
btn1.height = { value: 50, unit: "px" };
var btn2 = new layoutHelper.MyButton();
btn2.width = { value: 80, unit: "dip" };
btn2.height = { value: 50, unit: "dip" };
btn2.width = { value: 80, unit: "px" };
btn2.height = { value: 50, unit: "px" };
this.testView.addChild(btn2);
this.waitUntilTestElementLayoutIsValid();
@@ -237,18 +237,18 @@ export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayou
public testPaddingBottom() {
this.testView.removeChildren();
this.testView.style.paddingBottom = { value: 30, unit: "dip" };
this.testView.height = { value: 200, unit: "dip" };
this.testView.style.paddingBottom = { value: 30, unit: "px" };
this.testView.height = { value: 200, unit: "px" };
this.testView.orientation = "vertical";
var btn1 = new layoutHelper.MyButton();
this.testView.addChild(btn1);
btn1.width = { value: 50, unit: "dip" };
btn1.height = { value: 100, unit: "dip" };
btn1.width = { value: 50, unit: "px" };
btn1.height = { value: 100, unit: "px" };
var btn2 = new layoutHelper.MyButton();
btn2.width = { value: 50, unit: "dip" };
btn2.height = { value: 80, unit: "dip" };
btn2.width = { value: 50, unit: "px" };
btn2.height = { value: 80, unit: "px" };
this.testView.addChild(btn2);
this.waitUntilTestElementLayoutIsValid();
@@ -265,8 +265,8 @@ export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayou
public test_percent_children_support() {
let layout = this.testView;
layout.removeChildren();
layout.width = { value: 200, unit: "dip" };
layout.height = { value: 200, unit: "dip" };
layout.width = { value: 200, unit: "px" };
layout.height = { value: 200, unit: "px" };
let btn = new layoutHelper.MyButton();
btn.horizontalAlignment = "left";

View File

@@ -776,7 +776,7 @@ export class ListViewTest extends testModule.UITest<listViewModule.ListView> {
// Multiple item templates tests
public test_ItemTemplateSelector_WhenWrongTemplateKeyIsSpecified_TheDefaultTemplateIsUsed() {
let listView = this.testView;
listView.height = { value: 200, unit: "dip" };
listView.height = 200;
listView.itemTemplate = "<Label text='default' minHeight='100' maxHeight='100'/>";
listView.itemTemplates = this._itemTemplatesString;
@@ -840,7 +840,7 @@ export class ListViewTest extends testModule.UITest<listViewModule.ListView> {
public test_ItemTemplateSelector_CorrectTemplateIsUsed() {
let listView = this.testView;
listView.height = { value: 200, unit: "dip" };
listView.height = 200;
listView.itemTemplates = this._itemTemplatesString;
listView.itemTemplateSelector = "age % 2 === 0 ? 'red' : 'green'";
@@ -856,7 +856,7 @@ export class ListViewTest extends testModule.UITest<listViewModule.ListView> {
public test_ItemTemplateSelector_TestVirtualization() {
let listView = this.testView;
listView.height = { value: 300, unit: "dip" };
listView.height = 300;
listView.itemTemplates = this._itemTemplatesString;
listView.itemTemplateSelector = "age % 2 === 0 ? 'red' : (age % 3 === 0 ? 'blue' : 'green')";

View File

@@ -558,8 +558,8 @@ export function test_percent_width_and_height_support() {
testPage.style.height = unsetValue;
testPage.style.width = unsetValue;
TKUnit.assertTrue(PercentLength.equals(testPage.width, {value: 0, unit:"dip"}));
TKUnit.assertTrue(PercentLength.equals(testPage.height, {value: 0, unit:"dip"}));
TKUnit.assertTrue(PercentLength.equals(testPage.width, "auto"));
TKUnit.assertTrue(PercentLength.equals(testPage.height, "auto"));
}
export function test_percent_margin_support() {
@@ -585,10 +585,10 @@ export function test_percent_margin_support() {
//reset values.
testPage.margin = "0";
TKUnit.assertTrue(PercentLength.equals(testPage.marginLeft, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(testPage.marginTop, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(testPage.marginRight, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(testPage.marginBottom, { value: 0, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(testPage.marginLeft, 0));
TKUnit.assertTrue(PercentLength.equals(testPage.marginTop, 0));
TKUnit.assertTrue(PercentLength.equals(testPage.marginRight, 0));
TKUnit.assertTrue(PercentLength.equals(testPage.marginBottom, 0));
}
//export function test_ModalPage_Layout_is_Correct() {

View File

@@ -17,13 +17,13 @@ class ScrollLayoutTest extends testModule.UITest<scrollViewModule.ScrollView> {
let scrollView = new scrollViewModule.ScrollView();
scrollView.orientation = enums.Orientation.vertical;
scrollView.width = { value: 200, unit: "dip" };
scrollView.height = { value: 300, unit: "dip" };
scrollView.width = { value: 200, unit: "px" };
scrollView.height = { value: 300, unit: "px" };
let btn = new button.Button();
btn.text = "test";
btn.width = { value: 500, unit: "dip" };
btn.height = { value: 500, unit: "dip" };
btn.width = { value: 500, unit: "px" };
btn.height = { value: 500, unit: "px" };
scrollView.content = btn;
return scrollView;
@@ -66,8 +66,8 @@ class ScrollLayoutTest extends testModule.UITest<scrollViewModule.ScrollView> {
}
public test_scrollableHeight_vertical_orientation_when_content_is_small() {
this.testView.content.width = { value: 100, unit: "dip" };
this.testView.content.height = { value: 100, unit: "dip" };
this.testView.content.width = { value: 100, unit: "px" };
this.testView.content.height = { value: 100, unit: "px" };
this.waitUntilTestElementLayoutIsValid();
TKUnit.assertEqual(this.testView.scrollableHeight, 0, "this.testView.scrollableHeight");
@@ -75,7 +75,7 @@ class ScrollLayoutTest extends testModule.UITest<scrollViewModule.ScrollView> {
}
public test_scrollableHeight_vertical_orientation_when_content_is_big() {
this.testView.content.width = { value: 100, unit: "dip" };
this.testView.content.width = { value: 100, unit: "px" };
this.waitUntilTestElementLayoutIsValid();
TKUnit.assertAreClose(layoutHelper.dip(this.testView.scrollableHeight), 200, 0.4, "this.testView.scrollableHeight");
@@ -84,8 +84,8 @@ class ScrollLayoutTest extends testModule.UITest<scrollViewModule.ScrollView> {
public test_scrollableWidth_horizontal_orientation_when_content_is_small() {
this.testView.orientation = enums.Orientation.horizontal;
this.testView.content.width = { value: 100, unit: "dip" };
this.testView.content.height = { value: 100, unit: "dip" };
this.testView.content.width = { value: 100, unit: "px" };
this.testView.content.height = { value: 100, unit: "px" };
this.waitUntilTestElementLayoutIsValid();
TKUnit.assertEqual(this.testView.scrollableHeight, 0, "this.testView.scrollableHeight");
@@ -94,7 +94,7 @@ class ScrollLayoutTest extends testModule.UITest<scrollViewModule.ScrollView> {
public test_scrollableWidth_horizontal_orientation_when_content_is_big() {
this.testView.orientation = enums.Orientation.horizontal;
this.testView.content.height = { value: 100, unit: "dip" };
this.testView.content.height = { value: 100, unit: "px" };
this.waitUntilTestElementLayoutIsValid();
TKUnit.assertEqual(this.testView.scrollableHeight, 0, "this.testView.scrollableHeight");

View File

@@ -453,10 +453,10 @@ function test_border_width_shorthand_property(short: string, top: number, right:
var testView = new buttonModule.Button();
testView.style.borderWidth = short;
TKUnit.assertTrue(Length.equals(testView.style.borderTopWidth, { value: top, unit: "dip" }));
TKUnit.assertTrue(Length.equals(testView.style.borderRightWidth, { value: right, unit: "dip" }));
TKUnit.assertTrue(Length.equals(testView.style.borderBottomWidth, { value: bottom, unit: "dip" }));
TKUnit.assertTrue(Length.equals(testView.style.borderLeftWidth, { value: left, unit: "dip" }));
TKUnit.assertTrue(Length.equals(testView.style.borderTopWidth, top));
TKUnit.assertTrue(Length.equals(testView.style.borderRightWidth, right));
TKUnit.assertTrue(Length.equals(testView.style.borderBottomWidth, bottom));
TKUnit.assertTrue(Length.equals(testView.style.borderLeftWidth, left));
}
export function test_setting_border_radius_shorthand_property_sets_all_border_radii() {
@@ -487,10 +487,10 @@ function test_margin_shorthand_property(short: string, top: number, right: numbe
var testView = new buttonModule.Button();
testView.style.margin = short;
TKUnit.assertTrue(PercentLength.equals(testView.style.marginTop, { value: top, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(testView.style.marginRight, { value: right, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(testView.style.marginBottom, { value: bottom, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(testView.style.marginLeft, { value: left, unit: "dip" }));
TKUnit.assertTrue(PercentLength.equals(testView.style.marginTop, top));
TKUnit.assertTrue(PercentLength.equals(testView.style.marginRight, right));
TKUnit.assertTrue(PercentLength.equals(testView.style.marginBottom, bottom));
TKUnit.assertTrue(PercentLength.equals(testView.style.marginLeft, left));
}
export function test_setting_padding_shorthand_property_sets_all_paddings() {
@@ -504,10 +504,10 @@ function test_padding_shorthand_property(short: string, top: number, right: numb
var testView = new buttonModule.Button();
testView.style.padding = short;
TKUnit.assertTrue(Length.equals(testView.style.paddingTop, { value: top, unit: "dip" }));
TKUnit.assertTrue(Length.equals(testView.style.paddingRight, { value: right, unit: "dip" }));
TKUnit.assertTrue(Length.equals(testView.style.paddingBottom, { value: bottom, unit: "dip" }));
TKUnit.assertTrue(Length.equals(testView.style.paddingLeft, { value: left, unit: "dip" }));
TKUnit.assertTrue(Length.equals(testView.style.paddingTop, top));
TKUnit.assertTrue(Length.equals(testView.style.paddingRight, right));
TKUnit.assertTrue(Length.equals(testView.style.paddingBottom, bottom));
TKUnit.assertTrue(Length.equals(testView.style.paddingLeft, left));
}
export function test_setting_font_shorthand_property() {

View File

@@ -722,13 +722,13 @@ export var test_getLocationOnScreen_IsUndefinedWhenNotInTheVisualTree = function
var delta = 1;
export var test_getLocationRelativeToOtherView = function () {
var a1 = new absoluteLayoutModule.AbsoluteLayout();
a1.width = { value: 200, unit: "dip" };
a1.height = { value: 200, unit: "dip" };
a1.width = 200;
a1.height = 200;
a1.backgroundColor = new color.Color("red");
var a2 = new absoluteLayoutModule.AbsoluteLayout();
a2.width = { value: 100, unit: "dip" };
a2.height = { value: 100, unit: "dip" };
a2.width = 100;
a2.height = 100;
absoluteLayoutModule.AbsoluteLayout.setLeft(a2, 10);
absoluteLayoutModule.AbsoluteLayout.setTop(a2, 10);
a2.backgroundColor = new color.Color("green");
@@ -736,8 +736,8 @@ export var test_getLocationRelativeToOtherView = function () {
var label = new labelModule.Label();
label.text = "label";
label.id = "label";
label.width = { value: 70, unit: "dip" };
label.height = { value: 30, unit: "dip" };
label.width = 70;
label.height = 30;
absoluteLayoutModule.AbsoluteLayout.setLeft(label, 10);
absoluteLayoutModule.AbsoluteLayout.setTop(label, 10);
a2.backgroundColor = new color.Color("yellow");
@@ -765,8 +765,8 @@ export var test_getLocationRelativeToOtherView = function () {
export var test_getActualSize = function () {
var label = new labelModule.Label();
label.width = { value: 100, unit: "dip" };
label.height = { value: 200, unit: "dip" };
label.width = 100;
label.height = 200;
helper.buildUIAndRunTest(label, function (views: Array<viewModule.View>) {
TKUnit.waitUntilReady(() => label.isLayoutValid);
var actualSize = label.getActualSize();