/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html test('margin_start', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_START, 10); root_child0.setWidth(10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_top', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_TOP, 10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_end', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setJustifyContent(Yoga.JUSTIFY_FLEX_END); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_END, 10); root_child0.setWidth(10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_bottom', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_FLEX_END); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_BOTTOM, 10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(80); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(80); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_and_flex_row', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMargin(Yoga.EDGE_START, 10); root_child0.setMargin(Yoga.EDGE_END, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_and_flex_column', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMargin(Yoga.EDGE_TOP, 10); root_child0.setMargin(Yoga.EDGE_BOTTOM, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(80); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(80); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_and_stretch_row', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMargin(Yoga.EDGE_TOP, 10); root_child0.setMargin(Yoga.EDGE_BOTTOM, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(80); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(80); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_and_stretch_column', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMargin(Yoga.EDGE_START, 10); root_child0.setMargin(Yoga.EDGE_END, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_with_sibling_row', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMargin(Yoga.EDGE_END, 10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(45); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(55); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(45); expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(55); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(45); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(45); expect(root_child1.getComputedHeight()).toBe(100); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_with_sibling_column', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMargin(Yoga.EDGE_BOTTOM, 10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(45); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(55); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(45); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(45); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(55); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(45); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_bottom', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_BOTTOM, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_top', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_TOP, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_bottom_and_top', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_TOP, "auto"); root_child0.setMargin(Yoga.EDGE_BOTTOM, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(50); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(50); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_bottom_and_top_justify_center', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_TOP, "auto"); root_child0.setMargin(Yoga.EDGE_BOTTOM, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(50); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(50); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_mutiple_children_column', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_TOP, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setMargin(Yoga.EDGE_TOP, "auto"); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(25); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(75); expect(root_child2.getComputedTop()).toBe(150); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(25); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(75); expect(root_child2.getComputedTop()).toBe(150); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_mutiple_children_row', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(75); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(150); expect(root_child2.getComputedTop()).toBe(75); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(125); expect(root_child0.getComputedTop()).toBe(75); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(75); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_left_and_right_column', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(75); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(75); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_left_and_right', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_start_and_end_column', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_START, "auto"); root_child0.setMargin(Yoga.EDGE_END, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(75); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(75); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_start_and_end', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_START, "auto"); root_child0.setMargin(Yoga.EDGE_END, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_left_and_right_column_and_center', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_left', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_right', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_left_and_right_stretch', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_top_and_bottom_stretch', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_TOP, "auto"); root_child0.setMargin(Yoga.EDGE_BOTTOM, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(50); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(50); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_should_not_be_part_of_max_height', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setWidth(250); root.setHeight(250); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_TOP, 20); root_child0.setWidth(100); root_child0.setHeight(100); root_child0.setMaxHeight(100); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(250); expect(root.getComputedHeight()).toBe(250); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(250); expect(root.getComputedHeight()).toBe(250); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_should_not_be_part_of_max_width', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setWidth(250); root.setHeight(250); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, 20); root_child0.setWidth(100); root_child0.setMaxWidth(100); root_child0.setHeight(100); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(250); expect(root.getComputedHeight()).toBe(250); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(250); expect(root.getComputedHeight()).toBe(250); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_left_right_child_bigger_than_parent', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setWidth(52); root.setHeight(52); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(72); root_child0.setHeight(72); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-20); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_left_child_bigger_than_parent', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setWidth(52); root.setHeight(52); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setWidth(72); root_child0.setHeight(72); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-20); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_fix_left_auto_right_child_bigger_than_parent', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setWidth(52); root.setHeight(52); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, 10); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(72); root_child0.setHeight(72); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-20); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_left_fix_right_child_bigger_than_parent', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setWidth(52); root.setHeight(52); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setMargin(Yoga.EDGE_RIGHT, 10); root_child0.setWidth(72); root_child0.setHeight(72); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-30); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_top_stretching_child', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root_child0.setMargin(Yoga.EDGE_TOP, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } }); test('margin_auto_left_stretching_child', () => { const config = Yoga.Config.create(); let root; config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true); try { root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(200); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(200); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); } config.free(); } });