From e90e2de9273e79b7adbb26e3b38888d617937a69 Mon Sep 17 00:00:00 2001 From: Panayot Cankov Date: Mon, 19 Dec 2016 15:53:44 +0200 Subject: [PATCH] Revert tests for Length where NaN or number was used --- tests/app/pages/page11.ts | 2 +- tests/app/pages/page12.ts | 2 +- tests/app/pages/page13.ts | 16 ++--- tests/app/pages/page15.ts | 8 +-- .../activity-indicator-tests.ts | 12 ++-- tests/app/ui/frame/frame-tests.android.ts | 12 ++-- tests/app/ui/frame/frame-tests.ios.ts | 12 ++-- tests/app/ui/label/label-tests.ts | 24 +++---- tests/app/ui/layouts/absolute-layout-tests.ts | 32 ++++----- tests/app/ui/layouts/common-layout-tests.ts | 24 +++---- tests/app/ui/layouts/dock-layout-tests.ts | 28 ++++---- tests/app/ui/layouts/stack-layout-tests.ts | 36 +++++----- tests/app/ui/layouts/wrap-layout-tests.ts | 70 +++++++++---------- tests/app/ui/list-view/list-view-tests.ts | 6 +- tests/app/ui/page/page-tests-common.ts | 12 ++-- tests/app/ui/scroll-view/scroll-view-tests.ts | 20 +++--- .../app/ui/styling/style-properties-tests.ts | 24 +++---- tests/app/ui/view/view-tests-common.ts | 16 ++--- 18 files changed, 178 insertions(+), 178 deletions(-) diff --git a/tests/app/pages/page11.ts b/tests/app/pages/page11.ts index 2fe800636..84d01f50b 100644 --- a/tests/app/pages/page11.ts +++ b/tests/app/pages/page11.ts @@ -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"; diff --git a/tests/app/pages/page12.ts b/tests/app/pages/page12.ts index 37bb8d6f1..6a7745e5e 100644 --- a/tests/app/pages/page12.ts +++ b/tests/app/pages/page12.ts @@ -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); diff --git a/tests/app/pages/page13.ts b/tests/app/pages/page13.ts index f325236b1..49ad53e0a 100644 --- a/tests/app/pages/page13.ts +++ b/tests/app/pages/page13.ts @@ -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; } \ No newline at end of file diff --git a/tests/app/pages/page15.ts b/tests/app/pages/page15.ts index 01d5b0739..305f6404e 100644 --- a/tests/app/pages/page15.ts +++ b/tests/app/pages/page15.ts @@ -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(); diff --git a/tests/app/ui/activity-indicator/activity-indicator-tests.ts b/tests/app/ui/activity-indicator/activity-indicator-tests.ts index 885f3c3bb..4c5952bcf 100644 --- a/tests/app/ui/activity-indicator/activity-indicator-tests.ts +++ b/tests/app/ui/activity-indicator/activity-indicator-tests.ts @@ -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) { 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) { 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({ diff --git a/tests/app/ui/frame/frame-tests.android.ts b/tests/app/ui/frame/frame-tests.android.ts index f25b94c22..1476f4eae 100644 --- a/tests/app/ui/frame/frame-tests.android.ts +++ b/tests/app/ui/frame/frame-tests.android.ts @@ -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)); } \ No newline at end of file diff --git a/tests/app/ui/frame/frame-tests.ios.ts b/tests/app/ui/frame/frame-tests.ios.ts index e8b736287..13760cef9 100644 --- a/tests/app/ui/frame/frame-tests.ios.ts +++ b/tests/app/ui/frame/frame-tests.ios.ts @@ -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)); } diff --git a/tests/app/ui/label/label-tests.ts b/tests/app/ui/label/label-tests.ts index d54d7a497..142be3dec 100644 --- a/tests/app/ui/label/label-tests.ts +++ b/tests/app/ui/label/label-tests.ts @@ -552,8 +552,8 @@ export class LabelTest extends testModule.UITest { 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 { 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 { 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 { 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 { 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 { 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 { 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 { this.requestLayoutFixture(true, "Hello World", label => { label.textWrap = true; let host = new StackLayout(); - host.width = { value: 100, unit: "dip" }; + host.width = 100; return host; }); } diff --git a/tests/app/ui/layouts/absolute-layout-tests.ts b/tests/app/ui/layouts/absolute-layout-tests.ts index 0f21b38f7..f02c8227a 100644 --- a/tests/app/ui/layouts/absolute-layout-tests.ts +++ b/tests/app/ui/layouts/absolute-layout-tests.ts @@ -19,15 +19,15 @@ export class AbsoluteLayoutTest extends testModule.UITest> 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.UITestbtn).width = "50%"; diff --git a/tests/app/ui/layouts/common-layout-tests.ts b/tests/app/ui/layouts/common-layout-tests.ts index d15466b15..cac4f2cc5 100644 --- a/tests/app/ui/layouts/common-layout-tests.ts +++ b/tests/app/ui/layouts/common-layout-tests.ts @@ -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) { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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(); diff --git a/tests/app/ui/layouts/stack-layout-tests.ts b/tests/app/ui/layouts/stack-layout-tests.ts index 72b945cce..8953f30e5 100644 --- a/tests/app/ui/layouts/stack-layout-tests.ts +++ b/tests/app/ui/layouts/stack-layout-tests.ts @@ -92,16 +92,16 @@ export class StackLayoutTest extends testModule.UITest { } 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 { } 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 { 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"; diff --git a/tests/app/ui/layouts/wrap-layout-tests.ts b/tests/app/ui/layouts/wrap-layout-tests.ts index 70a168c07..2465b561c 100644 --- a/tests/app/ui/layouts/wrap-layout-tests.ts +++ b/tests/app/ui/layouts/wrap-layout-tests.ts @@ -19,15 +19,15 @@ export class WrapLayoutTest extends testModule.UITest { // Multiple item templates tests public test_ItemTemplateSelector_WhenWrongTemplateKeyIsSpecified_TheDefaultTemplateIsUsed() { let listView = this.testView; - listView.height = { value: 200, unit: "dip" }; + listView.height = 200; listView.itemTemplate = "