| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,6 +33,12 @@ export function closeEnough(a: number, b: number, message?: string) { | |||
| 33 | 33 | message ? TKUnit.assertTrue(Math.abs(a - b) <= EPS, message) : TKUnit.assertTrue(Math.abs(a - b) <= EPS); | |
| 34 | 34 | } | |
| 35 | 35 | ||
| 36 | + export function lessOrCloseEnough(a: number, b: number, message?: string) { | ||
| 37 | + const less = a < b; | ||
| 38 | + const close = Math.abs(a - b) <= EPS; | ||
| 39 | + message ? TKUnit.assertTrue(less || close, message) : TKUnit.assertTrue(less || close); | ||
| 40 | + } | ||
| 41 | + | ||
| 36 | 42 | export function notEqual<T>(a: T, b: T, message?: string) { | |
| 37 | 43 | message ? TKUnit.assertNotEqual(a, b, message) : TKUnit.assertNotEqual(a, b); | |
| 38 | 44 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,24 +1,15 @@ | |||
| 1 | - import { Page } from "tns-core-modules/ui/page"; | ||
| 2 | - import { GridLayout, ItemSpec } from "tns-core-modules/ui/layouts/grid-layout"; | ||
| 3 | - import { Button } from "tns-core-modules/ui/button"; | ||
| 1 | + import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout"; | ||
| 4 | 2 | import * as TKUnit from "../../TKUnit"; | |
| 5 | 3 | import * as view from "tns-core-modules/ui/core/view"; | |
| 6 | - import { unsetValue } from "tns-core-modules/ui/core/view"; | ||
| 7 | - import * as builder from "tns-core-modules/ui/builder"; | ||
| 8 | 4 | import * as testModule from "../../ui-test"; | |
| 9 | - import * as layoutHelper from "./layout-helper"; | ||
| 10 | 5 | import * as platform from "tns-core-modules/platform"; | |
| 11 | 6 | import { ios as iosUtils } from "tns-core-modules/utils/utils"; | |
| 12 | - import * as commonTests from "./common-layout-tests"; | ||
| 13 | 7 | import * as helper from "../helper"; | |
| 14 | 8 | import { parse } from "tns-core-modules/ui/builder"; | |
| 15 | 9 | import { | |
| 16 | 10 | dipToDp, left, top, right, bottom, height, width, | |
| 17 | - paddingLeft, paddingTop, paddingRight, paddingBottom, | ||
| 18 | - equal, closeEnough, notEqual, check, | ||
| 19 | - heightEqual, widthEqual, | ||
| 11 | + equal, closeEnough, lessOrCloseEnough, check, | ||
| 20 | 12 | isLeftAlignedWith, isRightAlignedWith, isTopAlignedWith, isBottomAlignedWith, | |
| 21 | - isLeftOf, isRightOf, isBelow, isAbove, | ||
| 22 | 13 | isLeftWith, isAboveWith, isRightWith, isBelowWith | |
| 23 | 14 | } from "./layout-tests-helper"; | |
| 24 | 15 | ||
@@ -960,12 +951,12 @@ export class SafeAreaTests extends testModule.UITest<any> { | |||
| 960 | 951 | isAboveWith(cells[2][2], grid, insets.bottom); | |
| 961 | 952 | ||
| 962 | 953 | closeEnough(height(cells[0][1]), height(cells[1][1]), `cell height should be equal - cell01<${height(cells[0][1])}> - cell11<${height(cells[1][1])}>`); | |
| 963 | - equal(height(cells[1][1]), height(cells[2][1]), `cell height should be equal - cell11<${height(cells[1][1])}> - cell21<${height(cells[2][1])}>`); | ||
| 954 | + closeEnough(height(cells[1][1]), height(cells[2][1]), `cell height should be equal - cell11<${height(cells[1][1])}> - cell21<${height(cells[2][1])}>`); | ||
| 964 | 955 | const sumOfLabelHeightAndInsets = insets.top + height(cells[0][1]) + height(cells[1][1]) + height(cells[2][1]) + insets.bottom; | |
| 965 | 956 | closeEnough(height(grid), sumOfLabelHeightAndInsets, `grid height<${height(grid)}> sum of labels height and insets<${sumOfLabelHeightAndInsets}>`); | |
| 966 | 957 | ||
| 967 | - equal(width(cells[1][0]), width(cells[1][1]), `cell width should be equal - cell10<${width(cells[1][0])}> - cell11<${width(cells[1][1])}>`); | ||
| 968 | - equal(width(cells[1][1]), width(cells[1][2]), `cell width should be equal - cell11<${width(cells[1][1])}> - cell12<${width(cells[1][2])}>`); | ||
| 958 | + closeEnough(width(cells[1][0]), width(cells[1][1]), `cell width should be equal - cell10<${width(cells[1][0])}> - cell11<${width(cells[1][1])}>`); | ||
| 959 | + closeEnough(width(cells[1][1]), width(cells[1][2]), `cell width should be equal - cell11<${width(cells[1][1])}> - cell12<${width(cells[1][2])}>`); | ||
| 969 | 960 | const sumOfLabelWidthsAndInsets = insets.left + width(cells[1][0]) + width(cells[1][1]) + width(cells[1][2]) + insets.right; | |
| 970 | 961 | equal(width(grid), sumOfLabelWidthsAndInsets, `grid width<${width(grid)}> sum of nested grids width and insets<${sumOfLabelWidthsAndInsets}>`); | |
| 971 | 962 | }, | |
@@ -1021,7 +1012,7 @@ export class SafeAreaTests extends testModule.UITest<any> { | |||
| 1021 | 1012 | isBottomAlignedWith(grid, cells[2][2]); | |
| 1022 | 1013 | ||
| 1023 | 1014 | check(height(cells[0][1]) >= height(cells[1][1]), `cell01 height<${height(cells[0][1])}> not greater or equal cell11 height<${height(cells[1][1])}>`); | |
| 1024 | - check(height(cells[1][1]) <= height(cells[2][1]), `cell11 height<${height(cells[1][1])}> not less or equal cell21 height<${height(cells[2][1])}>`); | ||
| 1015 | + lessOrCloseEnough(height(cells[1][1]), height(cells[2][1]), `cell11 height<${height(cells[1][1])}> not less or equal cell21 height<${height(cells[2][1])}>`); | ||
| 1025 | 1016 | const sumOfNestedGridHeights = height(cells[0][1]) + height(cells[1][1]) + height(cells[2][1]); | |
| 1026 | 1017 | equal(height(grid), sumOfNestedGridHeights, `grid height<${height(grid)}> sum of nested grids height <${sumOfNestedGridHeights}>`); | |
| 1027 | 1018 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ import { ViewModel } from "./list-view-view-model"; | |||
| 9 | 9 | import { UITest } from "../../ui-test"; | |
| 10 | 10 | import { | |
| 11 | 11 | dipToDp, left, top, right, bottom, height, width, | |
| 12 | - equal, check, | ||
| 12 | + equal, check, lessOrCloseEnough, | ||
| 13 | 13 | isLeftAlignedWith, isRightAlignedWith, isTopAlignedWith | |
| 14 | 14 | } from "../layouts/layout-tests-helper"; | |
| 15 | 15 | ||
@@ -183,7 +183,7 @@ export class ListViewSafeAreaTest extends UITest<ListView> { | |||
| 183 | 183 | isRightAlignedWith(root, cells[2][2]); | |
| 184 | 184 | ||
| 185 | 185 | check(height(cells[0][1]) >= height(cells[1][1]), `cell01 height<${height(cells[0][1])}> not greater or equal cell11 height<${height(cells[1][1])}>`); | |
| 186 | - check(height(cells[1][1]) <= height(cells[2][1]), `cell11 height<${height(cells[1][1])}> not less or equal cell21 height<${height(cells[2][1])}>`); | ||
| 186 | + lessOrCloseEnough(height(cells[1][1]), height(cells[2][1]), `cell11 height<${height(cells[1][1])}> not less or equal cell21 height<${height(cells[2][1])}>`); | ||
| 187 | 187 | const sumOfNestedListViewHeights = height(cells[0][1]) + height(cells[1][1]) + height(cells[2][1]); | |
| 188 | 188 | equal(height(root), sumOfNestedListViewHeights, `grid height<${height(root)}> sum of nested list views height <${sumOfNestedListViewHeights}>`); | |
| 189 | 189 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ import * as helper from "../helper"; | |||
| 10 | 10 | import { parse } from "tns-core-modules/ui/builder"; | |
| 11 | 11 | import { | |
| 12 | 12 | dipToDp, left, top, right, bottom, height, width, | |
| 13 | - equal, check, | ||
| 13 | + equal, check, lessOrCloseEnough, | ||
| 14 | 14 | isLeftAlignedWith, isRightAlignedWith, isTopAlignedWith, isBottomAlignedWith, | |
| 15 | 15 | isLeftWith, isRightWith, isBelowWith | |
| 16 | 16 | } from "../layouts/layout-tests-helper"; | |
@@ -426,7 +426,7 @@ class ScrollLayoutSafeAreaTest extends UITest<ScrollView> { | |||
| 426 | 426 | isBottomAlignedWith(grid, cells[2][2]); | |
| 427 | 427 | ||
| 428 | 428 | check(height(cells[0][1]) >= height(cells[1][1]), `cell01 height<${height(cells[0][1])}> not greater or equal cell11 height<${height(cells[1][1])}>`); | |
| 429 | - check(height(cells[1][1]) <= height(cells[2][1]), `cell11 height<${height(cells[1][1])}> not less or equal cell21 height<${height(cells[2][1])}>`); | ||
| 429 | + lessOrCloseEnough(height(cells[1][1]), height(cells[2][1]), `cell11 height<${height(cells[1][1])}> not less or equal cell21 height<${height(cells[2][1])}>`); | ||
| 430 | 430 | const sumOfNestedScrollViewHeights = height(cells[0][1]) + height(cells[1][1]) + height(cells[2][1]); | |
| 431 | 431 | equal(height(grid), sumOfNestedScrollViewHeights, `grid height<${height(grid)}> sum of nested scroll views height <${sumOfNestedScrollViewHeights}>`); | |
| 432 | 432 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1003,8 +1003,8 @@ export class FlexboxLayout extends FlexboxLayoutBase { | |||
| 1003 | 1003 | childRight = width - paddingRight; | |
| 1004 | 1004 | break; | |
| 1005 | 1005 | case JustifyContent.FLEX_END: | |
| 1006 | - childLeft = width - flexLine._mainSize - paddingRight; | ||
| 1007 | - childRight = flexLine._mainSize + paddingLeft; | ||
| 1006 | + childLeft = width - flexLine._mainSize + paddingRight; | ||
| 1007 | + childRight = flexLine._mainSize - paddingLeft; | ||
| 1008 | 1008 | break; | |
| 1009 | 1009 | case JustifyContent.CENTER: | |
| 1010 | 1010 | childLeft = paddingLeft + (width - insets.left - insets.right - flexLine._mainSize) / 2.0; | |
@@ -1164,8 +1164,8 @@ export class FlexboxLayout extends FlexboxLayoutBase { | |||
| 1164 | 1164 | childBottom = height - paddingBottom; | |
| 1165 | 1165 | break; | |
| 1166 | 1166 | case JustifyContent.FLEX_END: | |
| 1167 | - childTop = height - flexLine._mainSize - paddingBottom; | ||
| 1168 | - childBottom = flexLine._mainSize + paddingTop; | ||
| 1167 | + childTop = height - flexLine._mainSize + paddingBottom; | ||
| 1168 | + childBottom = flexLine._mainSize - paddingTop; | ||
| 1169 | 1169 | break; | |
| 1170 | 1170 | case JustifyContent.CENTER: | |
| 1171 | 1171 | childTop = paddingTop + (height - insets.top - insets.bottom - flexLine._mainSize) / 2.0; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments