diff --git a/tests/app/ui/layouts/safe-area-tests.ts b/tests/app/ui/layouts/safe-area-tests.ts index af5c5ff3e..60c643fe3 100644 --- a/tests/app/ui/layouts/safe-area-tests.ts +++ b/tests/app/ui/layouts/safe-area-tests.ts @@ -88,7 +88,6 @@ export class SafeAreaTests extends testModule.UITest { ); } - public test_absolute_children_components_in_safe_area() { const snippet = ` @@ -572,6 +571,167 @@ export class SafeAreaTests extends testModule.UITest { } ); } + + // Wrap + private getWrapViews(template: string) { + let root = parse(template); + return { + root, + child0: root.getViewById("child0") as view.View, + child1: root.getViewById("child1") as view.View, + }; + }; + + public test_wrap_in_full_screen() { + const snippet = ` + + `; + + this.executeSnippet( + this.getWrapViews(snippet), + this.noop, + ({ root }) => { this.layout_in_full_screen_test(root); } + ); + } + + public test_wrap_horizontal_children_components_in_safe_area() { + const snippet = ` + + + + + `; + + this.executeSnippet( + this.getWrapViews(snippet), + this.noop, + ({ root, child0, child1 }) => { + const insets = root.getSafeAreaInsets(); + equal(left(child0), insets.left, `${child0}.left - actual: ${left(child0)} expected: ${insets.left}`); + equal(top(child0), insets.top, `${child0}.top - actual: ${top(child0)} expected: ${insets.top}`); + equal(right(child0), width(root) - insets.right, `${child0}.right - actual: ${right(child0)} expected: ${width(root) - insets.right}`); + equal(bottom(child0), height(root) - insets.bottom, `${child0}.bottom - actual: ${bottom(child0)} expected: ${height(root) - insets.bottom}`); + equal(height(child1), 0, `${child1} has been laid out, but should not`); + equal(width(child1), 0, `${child1} has been laid out, but should not`); + } + ); + } + + public test_wrap_vertical_children_components_in_safe_area() { + const snippet = ` + + + + + `; + + this.executeSnippet( + this.getWrapViews(snippet), + this.noop, + ({ root, child0, child1 }) => { + const insets = root.getSafeAreaInsets(); + equal(left(child0), insets.left, `${child0}.left - actual: ${left(child0)} expected: ${insets.left}`); + equal(top(child0), insets.top, `${child0}.top - actual: ${top(child0)} expected: ${insets.top}`); + equal(right(child0), width(root) - insets.right, `${child0}.right - actual: ${right(child0)} expected: ${width(root) - insets.right}`); + equal(bottom(child0), height(root) - insets.bottom, `${child0}.bottom - actual: ${bottom(child0)} expected: ${height(root) - insets.bottom}`); + equal(height(child1), 0, `${child1} has been laid out, but should not`); + equal(width(child1), 0, `${child1} has been laid out, but should not`); + } + ); + } + + public test_wrap_nested_layouts_beyond_safe_area() { + const snippet = ` + + +