From 2e2467ce5d26c4bc683bb3070d22307c299139df Mon Sep 17 00:00:00 2001 From: Hristo Hristov Date: Mon, 6 Nov 2017 17:02:44 +0200 Subject: [PATCH] Fixed two android tests to account for small emulator screens and floating density --- tests/app/ui/layouts/grid-layout-tests.ts | 20 +++++++++---------- tests/app/ui/scroll-view/scroll-view-tests.ts | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/app/ui/layouts/grid-layout-tests.ts b/tests/app/ui/layouts/grid-layout-tests.ts index fd2ee333e..a872d6c67 100644 --- a/tests/app/ui/layouts/grid-layout-tests.ts +++ b/tests/app/ui/layouts/grid-layout-tests.ts @@ -681,10 +681,10 @@ export class GridLayoutTest extends testModule.UITest } public test_columns_widths() { - this.testView.width = { value: 400, unit: "px" }; - this.testView.height = { value: 600, unit: "px" }; + this.testView.width = { value: 300, unit: "px" }; + this.testView.height = { value: 400, unit: "px" }; - let grid = new GridLayout(); + const grid = new GridLayout(); this.testView.addChild(grid); grid.horizontalAlignment = "left"; grid.verticalAlignment = "top"; @@ -697,23 +697,23 @@ export class GridLayoutTest extends testModule.UITest grid.addRow(new ItemSpec(layoutHelper.dp(100), "pixel")); grid.addRow(new ItemSpec(2, "star")); - let btn = new Button(); - btn.width = { value: 300, unit: "px" }; - btn.height = { value: 500, unit: "px" }; + const btn = new Button(); + btn.width = { value: 200, unit: "px" }; + btn.height = { value: 300, unit: "px" }; grid.addChild(btn); GridLayout.setColumnSpan(btn, 3); GridLayout.setRowSpan(btn, 3); this.waitUntilTestElementLayoutIsValid(); var cols = grid.getColumns(); - TKUnit.assertAreClose(cols[0].actualLength, layoutHelper.dp(67), DELTA, "Column[0] actual length should be 67"); + TKUnit.assertAreClose(cols[0].actualLength, layoutHelper.dp(33), DELTA, "Column[0] actual length should be 67"); TKUnit.assertAreClose(cols[1].actualLength, layoutHelper.dp(100), DELTA, "Column[1] actual length should be 100"); - TKUnit.assertAreClose(cols[2].actualLength, layoutHelper.dp(133), DELTA, "Column[2] actual length should be 133"); + TKUnit.assertAreClose(cols[2].actualLength, layoutHelper.dp(67), DELTA, "Column[2] actual length should be 133"); var rows = grid.getRows(); - TKUnit.assertAreClose(rows[0].actualLength, layoutHelper.dp(133), DELTA, "Row[0] actual length should be 133"); + TKUnit.assertAreClose(rows[0].actualLength, layoutHelper.dp(67), DELTA, "Row[0] actual length should be 133"); TKUnit.assertAreClose(rows[1].actualLength, layoutHelper.dp(100), DELTA, "Row[1] actual length should be 100"); - TKUnit.assertAreClose(rows[2].actualLength, layoutHelper.dp(267), DELTA, "Row[2] actual length should be 267"); + TKUnit.assertAreClose(rows[2].actualLength, layoutHelper.dp(133), DELTA, "Row[2] actual length should be 267"); } } diff --git a/tests/app/ui/scroll-view/scroll-view-tests.ts b/tests/app/ui/scroll-view/scroll-view-tests.ts index 37d752cbb..8c53f3928 100644 --- a/tests/app/ui/scroll-view/scroll-view-tests.ts +++ b/tests/app/ui/scroll-view/scroll-view-tests.ts @@ -172,7 +172,7 @@ class ScrollLayoutTest extends UITest { helper.goBack(); // Check horizontalOffset after navigation - TKUnit.assertEqual(this.testView.horizontalOffset, 100, "this.testView.horizontalOffset after navigation"); + TKUnit.assertEqual(this.testView.horizontalOffset, offset, "this.testView.horizontalOffset after navigation"); } public test_scrollView_vertical_raised_scroll_event() {