gentest support for position: static + initial test
Summary: I am about to embark on supporting `position: static` in Yoga. The enum exists already (and is the default position type, lol) but does not actually do anything and just behaves like `position: relative`. My approach here is to write a bunch of tests to test for the various behaviors of static positions and then develop on Yoga afterwards to get those tests passing. To do this, we need to make a few changes to the gentest files as there is not support for adding `position: static` at the moment: * Make it so that the gentest code can physically write `YGPositionTypeStatic` if it encounters `position: static` in the style * Make it so that gentest.js knows that Yoga's default is actually static. This way the code generated in the tests will actually label nodes for non default values * Explicitly label the position type even when it is not declared in the style prop (with the exception of the default) * Regenerate all the tests Additionally I added the first, basic test: making sure insets do nothing on a statically positioned element. Reviewed By: NickGerleman Differential Revision: D50437855 fbshipit-source-id: 0e8bbf1c224d477ea4592b7563d0b70d2ffa79c8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7e91004b90
commit
2ea4c043fd
@@ -17,10 +17,12 @@ TEST(YogaTest, percentage_width_height) {
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetWidthPercent(root_child0, 30);
|
||||
YGNodeStyleSetHeightPercent(root_child0, 30);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
@@ -59,10 +61,12 @@ TEST(YogaTest, percentage_position_left_top) {
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 400);
|
||||
YGNodeStyleSetHeight(root, 400);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetPositionPercent(root_child0, YGEdgeLeft, 10);
|
||||
YGNodeStyleSetPositionPercent(root_child0, YGEdgeTop, 20);
|
||||
YGNodeStyleSetWidthPercent(root_child0, 45);
|
||||
@@ -103,10 +107,12 @@ TEST(YogaTest, percentage_position_bottom_right) {
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 500);
|
||||
YGNodeStyleSetHeight(root, 500);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetPositionPercent(root_child0, YGEdgeRight, 20);
|
||||
YGNodeStyleSetPositionPercent(root_child0, YGEdgeBottom, 10);
|
||||
YGNodeStyleSetWidthPercent(root_child0, 55);
|
||||
@@ -147,15 +153,18 @@ TEST(YogaTest, percentage_flex_basis) {
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child0, 50);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child1, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 1);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child1, 25);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
@@ -203,15 +212,18 @@ TEST(YogaTest, percentage_flex_basis_cross) {
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child0, 50);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child1, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 1);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child1, 25);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
@@ -261,15 +273,18 @@ TEST(YogaTest, percentage_flex_basis_cross_min_height) {
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetMinHeightPercent(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child1, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 2);
|
||||
YGNodeStyleSetMinHeightPercent(root_child1, 10);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
@@ -318,16 +333,19 @@ TEST(YogaTest, percentage_flex_basis_main_max_height) {
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child0, 10);
|
||||
YGNodeStyleSetMaxHeightPercent(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child1, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 4);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child1, 10);
|
||||
YGNodeStyleSetMaxHeightPercent(root_child1, 20);
|
||||
@@ -376,16 +394,19 @@ TEST(YogaTest, percentage_flex_basis_cross_max_height) {
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child0, 10);
|
||||
YGNodeStyleSetMaxHeightPercent(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child1, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 4);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child1, 10);
|
||||
YGNodeStyleSetMaxHeightPercent(root_child1, 20);
|
||||
@@ -435,16 +456,19 @@ TEST(YogaTest, percentage_flex_basis_main_max_width) {
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child0, 15);
|
||||
YGNodeStyleSetMaxWidthPercent(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child1, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 4);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child1, 10);
|
||||
YGNodeStyleSetMaxWidthPercent(root_child1, 20);
|
||||
@@ -493,16 +517,19 @@ TEST(YogaTest, percentage_flex_basis_cross_max_width) {
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child0, 10);
|
||||
YGNodeStyleSetMaxWidthPercent(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child1, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 4);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child1, 15);
|
||||
YGNodeStyleSetMaxWidthPercent(root_child1, 20);
|
||||
@@ -552,16 +579,19 @@ TEST(YogaTest, percentage_flex_basis_main_min_width) {
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child0, 15);
|
||||
YGNodeStyleSetMinWidthPercent(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child1, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 4);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child1, 10);
|
||||
YGNodeStyleSetMinWidthPercent(root_child1, 20);
|
||||
@@ -610,16 +640,19 @@ TEST(YogaTest, percentage_flex_basis_cross_min_width) {
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child0, 10);
|
||||
YGNodeStyleSetMinWidthPercent(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child1, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 4);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child1, 15);
|
||||
YGNodeStyleSetMinWidthPercent(root_child1, 20);
|
||||
@@ -668,10 +701,12 @@ TEST(YogaTest, percentage_multiple_nested_with_padding_margin_and_percentage_val
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child0, 10);
|
||||
YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 5);
|
||||
@@ -686,6 +721,7 @@ TEST(YogaTest, percentage_multiple_nested_with_padding_margin_and_percentage_val
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetMargin(root_child0_child0, YGEdgeLeft, 5);
|
||||
YGNodeStyleSetMargin(root_child0_child0, YGEdgeTop, 5);
|
||||
YGNodeStyleSetMargin(root_child0_child0, YGEdgeRight, 5);
|
||||
@@ -698,6 +734,7 @@ TEST(YogaTest, percentage_multiple_nested_with_padding_margin_and_percentage_val
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeLeft, 5);
|
||||
YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeTop, 5);
|
||||
YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeRight, 5);
|
||||
@@ -710,6 +747,7 @@ TEST(YogaTest, percentage_multiple_nested_with_padding_margin_and_percentage_val
|
||||
YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child1, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 4);
|
||||
YGNodeStyleSetFlexBasisPercent(root_child1, 15);
|
||||
YGNodeStyleSetMinWidthPercent(root_child1, 20);
|
||||
@@ -778,10 +816,12 @@ TEST(YogaTest, percentage_margin_should_calculate_based_only_on_width) {
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetMarginPercent(root_child0, YGEdgeLeft, 10);
|
||||
YGNodeStyleSetMarginPercent(root_child0, YGEdgeTop, 10);
|
||||
@@ -790,6 +830,7 @@ TEST(YogaTest, percentage_margin_should_calculate_based_only_on_width) {
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetWidth(root_child0_child0, 10);
|
||||
YGNodeStyleSetHeight(root_child0_child0, 10);
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
@@ -837,10 +878,12 @@ TEST(YogaTest, percentage_padding_should_calculate_based_only_on_width) {
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetPaddingPercent(root_child0, YGEdgeLeft, 10);
|
||||
YGNodeStyleSetPaddingPercent(root_child0, YGEdgeTop, 10);
|
||||
@@ -849,6 +892,7 @@ TEST(YogaTest, percentage_padding_should_calculate_based_only_on_width) {
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetWidth(root_child0_child0, 10);
|
||||
YGNodeStyleSetHeight(root_child0_child0, 10);
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
@@ -896,6 +940,7 @@ TEST(YogaTest, percentage_absolute_position) {
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
@@ -940,8 +985,10 @@ TEST(YogaTest, percentage_width_height_undefined_parent_size) {
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetWidthPercent(root_child0, 50);
|
||||
YGNodeStyleSetHeightPercent(root_child0, 50);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
@@ -980,22 +1027,27 @@ TEST(YogaTest, percent_within_flex_grow) {
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 350);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetWidth(root_child0, 100);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child1, YGPositionTypeRelative);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 1);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
|
||||
const YGNodeRef root_child1_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child1_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetWidthPercent(root_child1_child0, 100);
|
||||
YGNodeInsertChild(root_child1, root_child1_child0, 0);
|
||||
|
||||
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child2, YGPositionTypeRelative);
|
||||
YGNodeStyleSetWidth(root_child2, 100);
|
||||
YGNodeInsertChild(root, root_child2, 2);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -1064,24 +1116,29 @@ TEST(YogaTest, percentage_container_in_wrapping_container) {
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow);
|
||||
YGNodeStyleSetJustifyContent(root_child0_child0, YGJustifyCenter);
|
||||
YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetWidthPercent(root_child0_child0, 100);
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetWidth(root_child0_child0_child0, 50);
|
||||
YGNodeStyleSetHeight(root_child0_child0_child0, 50);
|
||||
YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0_child0_child1, YGPositionTypeRelative);
|
||||
YGNodeStyleSetWidth(root_child0_child0_child1, 50);
|
||||
YGNodeStyleSetHeight(root_child0_child0_child1, 50);
|
||||
YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1);
|
||||
@@ -1149,6 +1206,7 @@ TEST(YogaTest, percent_absolute_position) {
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root, 60);
|
||||
YGNodeStyleSetHeight(root, 50);
|
||||
|
||||
@@ -1161,10 +1219,12 @@ TEST(YogaTest, percent_absolute_position) {
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeRelative);
|
||||
YGNodeStyleSetWidthPercent(root_child0_child0, 100);
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0_child1, YGPositionTypeRelative);
|
||||
YGNodeStyleSetWidthPercent(root_child0_child1, 100);
|
||||
YGNodeInsertChild(root_child0, root_child0_child1, 1);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
Reference in New Issue
Block a user