From 291bc3d86d0c0c8fb35184a63b60000128fead06 Mon Sep 17 00:00:00 2001 From: hshristov Date: Tue, 28 Apr 2015 13:20:06 +0300 Subject: [PATCH] Fix verticalAlignment center placement --- apps/tests/layouts/grid-layout-tests.ts | 23 +++++++++++++++++++++++ ui/core/view-common.ts | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/apps/tests/layouts/grid-layout-tests.ts b/apps/tests/layouts/grid-layout-tests.ts index e536476a8..46e15b306 100644 --- a/apps/tests/layouts/grid-layout-tests.ts +++ b/apps/tests/layouts/grid-layout-tests.ts @@ -448,6 +448,29 @@ export function test_GridLayout_ColumnWidth_when_4stars_and_width_110() { TKUnit.assertAreClose(cols[3].actualLength, 27, delta, "Column[3] actual length should be 27"); } +export function test_GridLayout_margins_and_verticalAlignment_center() { + + rootLayout.height = 200; + rootLayout.width = 200; + var btn = new helper.MyButton(); + btn.text = "btn"; + btn.height = 100; + btn.width = 100; + btn.marginBottom = 50; + btn.marginRight = 50; + rootLayout.addChild(btn); + + TKUnit.waitUntilReady(function () { + return btn.isLayoutValid; + }, ASYNC); + + var density = utils.layout.getDisplayDensity(); + var delta = Math.floor(density) !== density ? 1.1 : DELTA; + + TKUnit.assertAreClose(btn.layoutTop, 25, delta * density, "vertical margins"); + TKUnit.assertAreClose(btn.layoutLeft, 25, delta * density, "horizontal margins"); +} + export function test_GridLayout_set_columns_in_XML() { var p = builder.parse("