Move configuration to new YGConfig and pass them down to CalculateLayout
Summary: Move configuration to new ```YGConfig``` and pass them down to CalculateLayout. See #418 . Adds ```YGConfigNew()``` + ```YGConfigFree```, and changed ```YGSetExperimentalFeatureEnabled``` to use the config. New function for calculation is ```YGNodeCalculateLayoutWithConfig```. Closes https://github.com/facebook/yoga/pull/432 Reviewed By: astreet Differential Revision: D4611359 Pulled By: emilsjolander fbshipit-source-id: a1332f0e1b21cec02129dd021ee57408449e10b0
This commit is contained in:
committed by
Facebook Github Bot
parent
8668e43f6d
commit
37c48257ae
@@ -18,33 +18,35 @@ import static org.junit.Assert.assertEquals;
|
||||
public class YGAlignContentTest {
|
||||
@Test
|
||||
public void test_align_content_flex_start() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(130f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(10f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root_child2.setHeight(10f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setWidth(50f);
|
||||
root_child3.setHeight(10f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root_child4.setHeight(10f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
@@ -117,30 +119,32 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_flex_start_without_height_on_children() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(10f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setWidth(50f);
|
||||
root_child3.setHeight(10f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
@@ -212,36 +216,38 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_flex_start_with_flex() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(120f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setFlexGrow(1f);
|
||||
root_child0.setFlexBasisPercent(0f);
|
||||
root_child0.setWidth(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setFlexGrow(1f);
|
||||
root_child1.setFlexBasisPercent(0f);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(10f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setFlexGrow(1f);
|
||||
root_child3.setFlexShrink(1f);
|
||||
root_child3.setFlexBasisPercent(0f);
|
||||
root_child3.setWidth(50f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
@@ -313,33 +319,35 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_flex_end() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setAlignContent(YogaAlign.FLEX_END);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(10f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root_child2.setHeight(10f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setWidth(50f);
|
||||
root_child3.setHeight(10f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root_child4.setHeight(10f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
@@ -412,29 +420,31 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(150f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setWidth(50f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
@@ -506,34 +516,36 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_spacebetween() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.SPACE_BETWEEN);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(130f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(10f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root_child2.setHeight(10f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setWidth(50f);
|
||||
root_child3.setHeight(10f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root_child4.setHeight(10f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
@@ -606,34 +618,36 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_spacearound() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.SPACE_AROUND);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(140f);
|
||||
root.setHeight(120f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(10f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root_child2.setHeight(10f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setWidth(50f);
|
||||
root_child3.setHeight(10f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root_child4.setHeight(10f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
@@ -706,30 +720,32 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_row() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(150f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setWidth(50f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
@@ -801,36 +817,38 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_row_with_children() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(150f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = new YogaNode();
|
||||
final YogaNode root_child0_child0 = new YogaNode(config);
|
||||
root_child0_child0.setFlexGrow(1f);
|
||||
root_child0_child0.setFlexShrink(1f);
|
||||
root_child0_child0.setFlexBasisPercent(0f);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setWidth(50f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
@@ -912,36 +930,38 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_row_with_flex() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(150f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setFlexGrow(1f);
|
||||
root_child1.setFlexShrink(1f);
|
||||
root_child1.setFlexBasisPercent(0f);
|
||||
root_child1.setWidth(50f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setFlexGrow(1f);
|
||||
root_child3.setFlexShrink(1f);
|
||||
root_child3.setFlexBasisPercent(0f);
|
||||
root_child3.setWidth(50f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
@@ -1013,35 +1033,37 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_row_with_flex_no_shrink() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(150f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setFlexGrow(1f);
|
||||
root_child1.setFlexShrink(1f);
|
||||
root_child1.setFlexBasisPercent(0f);
|
||||
root_child1.setWidth(50f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setFlexGrow(1f);
|
||||
root_child3.setFlexBasisPercent(0f);
|
||||
root_child3.setWidth(50f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
@@ -1113,18 +1135,20 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_row_with_margin() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(150f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setMargin(YogaEdge.LEFT, 10f);
|
||||
root_child1.setMargin(YogaEdge.TOP, 10f);
|
||||
root_child1.setMargin(YogaEdge.RIGHT, 10f);
|
||||
@@ -1132,11 +1156,11 @@ public class YGAlignContentTest {
|
||||
root_child1.setWidth(50f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setMargin(YogaEdge.LEFT, 10f);
|
||||
root_child3.setMargin(YogaEdge.TOP, 10f);
|
||||
root_child3.setMargin(YogaEdge.RIGHT, 10f);
|
||||
@@ -1144,7 +1168,7 @@ public class YGAlignContentTest {
|
||||
root_child3.setWidth(50f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
@@ -1216,18 +1240,20 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_row_with_padding() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(150f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setPadding(YogaEdge.LEFT, 10);
|
||||
root_child1.setPadding(YogaEdge.TOP, 10);
|
||||
root_child1.setPadding(YogaEdge.RIGHT, 10);
|
||||
@@ -1235,11 +1261,11 @@ public class YGAlignContentTest {
|
||||
root_child1.setWidth(50f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setPadding(YogaEdge.LEFT, 10);
|
||||
root_child3.setPadding(YogaEdge.TOP, 10);
|
||||
root_child3.setPadding(YogaEdge.RIGHT, 10);
|
||||
@@ -1247,7 +1273,7 @@ public class YGAlignContentTest {
|
||||
root_child3.setWidth(50f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
@@ -1319,18 +1345,20 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_row_with_single_row() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(150f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
@@ -1372,31 +1400,33 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_row_with_fixed_height() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(150f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(60f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setWidth(50f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
@@ -1468,31 +1498,33 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_row_with_max_height() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(150f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setMaxHeight(20f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setWidth(50f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
@@ -1564,31 +1596,33 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_row_with_min_height() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(150f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setMinHeight(80f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setWidth(50f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setWidth(50f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
@@ -1660,38 +1694,40 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_column() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(150f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = new YogaNode();
|
||||
final YogaNode root_child0_child0 = new YogaNode(config);
|
||||
root_child0_child0.setFlexGrow(1f);
|
||||
root_child0_child0.setFlexShrink(1f);
|
||||
root_child0_child0.setFlexBasisPercent(0f);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
final YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.setFlexGrow(1f);
|
||||
root_child1.setFlexShrink(1f);
|
||||
root_child1.setFlexBasisPercent(0f);
|
||||
root_child1.setHeight(50f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
final YogaNode root_child2 = new YogaNode(config);
|
||||
root_child2.setHeight(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
final YogaNode root_child3 = new YogaNode(config);
|
||||
root_child3.setHeight(50f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
final YogaNode root_child4 = new YogaNode(config);
|
||||
root_child4.setHeight(50f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
@@ -1773,10 +1809,12 @@ public class YGAlignContentTest {
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_is_not_overriding_align_items() {
|
||||
final YogaNode root = new YogaNode();
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root_child0.setAlignContent(YogaAlign.STRETCH);
|
||||
root_child0.setAlignItems(YogaAlign.CENTER);
|
||||
@@ -1784,7 +1822,7 @@ public class YGAlignContentTest {
|
||||
root_child0.setHeight(100f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = new YogaNode();
|
||||
final YogaNode root_child0_child0 = new YogaNode(config);
|
||||
root_child0_child0.setAlignContent(YogaAlign.STRETCH);
|
||||
root_child0_child0.setWidth(10f);
|
||||
root_child0_child0.setHeight(10f);
|
||||
|
Reference in New Issue
Block a user