test: delete PAGE.test_percent_margin_support

This case has been handled per layout.
This commit is contained in:
Vasil Chimev
2018-08-30 22:19:32 +03:00
committed by Martin Yankov
parent ea4ace61da
commit 3acf65a0a9

View File

@@ -1146,41 +1146,3 @@ export function test_percent_width_and_height_support() {
TKUnit.assertTrue(PercentLength.equals(testPage.width, "auto")); TKUnit.assertTrue(PercentLength.equals(testPage.width, "auto"));
TKUnit.assertTrue(PercentLength.equals(testPage.height, "auto")); TKUnit.assertTrue(PercentLength.equals(testPage.height, "auto"));
} }
export function test_percent_margin_support() {
const testPage = new Page();
const gridLayout = new GridLayout();
const stackLayout = new StackLayout();
stackLayout.margin = "10%";
gridLayout.addChild(stackLayout);
testPage.content = gridLayout;
helper.navigate(() => testPage);
const parentBounds = gridLayout._getCurrentLayoutBounds();
const parentWidth = parentBounds.right - parentBounds.left;
const parentHeight = parentBounds.bottom - parentBounds.top;
const marginLeft = isIOS ? Math.round(parentWidth * 0.1) : Math.floor(parentWidth * 0.1);
const marginTop = isIOS ? Math.round(parentHeight * 0.1) : Math.floor(parentHeight * 0.1);
let bounds = stackLayout._getCurrentLayoutBounds();
TKUnit.assertEqual(Math.round(bounds.left), marginLeft, "Stack LEFT position incorrect");
TKUnit.assertEqual(Math.round(bounds.top), marginTop, "Stack TOP position incorrect");
TKUnit.assertEqual(Math.round(bounds.bottom - bounds.top), parentHeight - (2 * marginTop), "Stack HEIGHT incorrect");
TKUnit.assertEqual(Math.round(bounds.right - bounds.left), parentWidth - (2 * marginLeft), "Stack WIDTH incorrect");
TKUnit.assertEqual(Math.round(bounds.right), parentWidth - marginLeft, "Stack RIGHT position incorrect");
TKUnit.assertEqual(Math.round(bounds.bottom), parentHeight - marginTop, "Stack BOTTOM position incorrect");
//reset values.
stackLayout.margin = "0";
TKUnit.waitUntilReady(() => stackLayout.isLayoutValid);
bounds = stackLayout._getCurrentLayoutBounds();
TKUnit.assertEqual(bounds.left, 0, "Stack LEFT position incorrect");
TKUnit.assertEqual(bounds.top, 0, "Stack TOP position incorrect");
TKUnit.assertEqual(bounds.bottom - bounds.top, parentHeight, "Stack HEIGHT incorrect");
TKUnit.assertEqual(bounds.right - bounds.left, parentWidth, "Stack WIDTH incorrect");
TKUnit.assertEqual(bounds.right, parentWidth, "Stack RIGHT position incorrect");
TKUnit.assertEqual(bounds.bottom, parentHeight, "Stack BOTTOM position incorrect");
}