Add YogaNodeProperties implementation based on ByteBuffer

Summary:
@public
Adds an implementation of `YogaNodeProperties` that accesses style and layout properties using a `ByteBuffer` rather than JNI calls.
We hope for a speed improvement.

This needs further cleanup after experimenting, e.g. to codegen the offsets.

Reviewed By: pasqualeanatriello

Differential Revision: D8911723

fbshipit-source-id: 3c24b57eb545155878896ebb5d64d4553eb6bedc
This commit is contained in:
David Aurelio
2018-07-30 09:30:51 -07:00
committed by Facebook Github Bot
parent b1821ab4cd
commit 3499e2e0ef
29 changed files with 2034 additions and 979 deletions

View File

@@ -9,42 +9,52 @@
package com.facebook.yoga;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class YGAlignContentTest {
@Parameterized.Parameters(name = "{0}")
public static Iterable<TestParametrization.NodeFactory> nodeFactories() {
return TestParametrization.nodeFactories();
}
@Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory;
@Test
public void test_align_content_flex_start() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
root.setWrap(YogaWrap.WRAP);
root.setWidth(130f);
root.setHeight(100f);
final YogaNode root_child0 = new YogaNode(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root_child0.setHeight(10f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(50f);
root_child1.setHeight(10f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = new YogaNode(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root_child2.setHeight(10f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(config);
root_child3.setWidth(50f);
root_child3.setHeight(10f);
root.addChildAt(root_child3, 3);
final YogaNode root_child4 = new YogaNode(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root_child4.setHeight(10f);
root.addChildAt(root_child4, 4);
@@ -119,30 +129,30 @@ public class YGAlignContentTest {
public void test_align_content_flex_start_without_height_on_children() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(config);
root.setWrap(YogaWrap.WRAP);
root.setWidth(100f);
root.setHeight(100f);
final YogaNode root_child0 = new YogaNode(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(50f);
root_child1.setHeight(10f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = new YogaNode(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(config);
root_child3.setWidth(50f);
root_child3.setHeight(10f);
root.addChildAt(root_child3, 3);
final YogaNode root_child4 = new YogaNode(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root.addChildAt(root_child4, 4);
root.setDirection(YogaDirection.LTR);
@@ -216,36 +226,36 @@ public class YGAlignContentTest {
public void test_align_content_flex_start_with_flex() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(config);
root.setWrap(YogaWrap.WRAP);
root.setWidth(100f);
root.setHeight(120f);
final YogaNode root_child0 = new YogaNode(config);
final YogaNode root_child0 = createNode(config);
root_child0.setFlexGrow(1f);
root_child0.setFlexBasisPercent(0f);
root_child0.setWidth(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(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(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(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(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root.addChildAt(root_child4, 4);
root.setDirection(YogaDirection.LTR);
@@ -319,33 +329,33 @@ public class YGAlignContentTest {
public void test_align_content_flex_end() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(config);
root.setAlignContent(YogaAlign.FLEX_END);
root.setWrap(YogaWrap.WRAP);
root.setWidth(100f);
root.setHeight(100f);
final YogaNode root_child0 = new YogaNode(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root_child0.setHeight(10f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(50f);
root_child1.setHeight(10f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = new YogaNode(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root_child2.setHeight(10f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(config);
root_child3.setWidth(50f);
root_child3.setHeight(10f);
root.addChildAt(root_child3, 3);
final YogaNode root_child4 = new YogaNode(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root_child4.setHeight(10f);
root.addChildAt(root_child4, 4);
@@ -420,29 +430,29 @@ public class YGAlignContentTest {
public void test_align_content_stretch() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(config);
root.setAlignContent(YogaAlign.STRETCH);
root.setWrap(YogaWrap.WRAP);
root.setWidth(150f);
root.setHeight(100f);
final YogaNode root_child0 = new YogaNode(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(50f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = new YogaNode(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(config);
root_child3.setWidth(50f);
root.addChildAt(root_child3, 3);
final YogaNode root_child4 = new YogaNode(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root.addChildAt(root_child4, 4);
root.setDirection(YogaDirection.LTR);
@@ -516,34 +526,34 @@ public class YGAlignContentTest {
public void test_align_content_spacebetween() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(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(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root_child0.setHeight(10f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(50f);
root_child1.setHeight(10f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = new YogaNode(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root_child2.setHeight(10f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(config);
root_child3.setWidth(50f);
root_child3.setHeight(10f);
root.addChildAt(root_child3, 3);
final YogaNode root_child4 = new YogaNode(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root_child4.setHeight(10f);
root.addChildAt(root_child4, 4);
@@ -618,34 +628,34 @@ public class YGAlignContentTest {
public void test_align_content_spacearound() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(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(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root_child0.setHeight(10f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(50f);
root_child1.setHeight(10f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = new YogaNode(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root_child2.setHeight(10f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(config);
root_child3.setWidth(50f);
root_child3.setHeight(10f);
root.addChildAt(root_child3, 3);
final YogaNode root_child4 = new YogaNode(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root_child4.setHeight(10f);
root.addChildAt(root_child4, 4);
@@ -720,30 +730,30 @@ public class YGAlignContentTest {
public void test_align_content_stretch_row() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(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(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(50f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = new YogaNode(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(config);
root_child3.setWidth(50f);
root.addChildAt(root_child3, 3);
final YogaNode root_child4 = new YogaNode(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root.addChildAt(root_child4, 4);
root.setDirection(YogaDirection.LTR);
@@ -817,36 +827,36 @@ public class YGAlignContentTest {
public void test_align_content_stretch_row_with_children() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(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(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child0_child0 = new YogaNode(config);
final YogaNode root_child0_child0 = createNode(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(config);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(50f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = new YogaNode(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(config);
root_child3.setWidth(50f);
root.addChildAt(root_child3, 3);
final YogaNode root_child4 = new YogaNode(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root.addChildAt(root_child4, 4);
root.setDirection(YogaDirection.LTR);
@@ -930,36 +940,36 @@ public class YGAlignContentTest {
public void test_align_content_stretch_row_with_flex() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(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(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(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(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(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(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root.addChildAt(root_child4, 4);
root.setDirection(YogaDirection.LTR);
@@ -1033,35 +1043,35 @@ public class YGAlignContentTest {
public void test_align_content_stretch_row_with_flex_no_shrink() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(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(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(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(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(config);
root_child3.setFlexGrow(1f);
root_child3.setFlexBasisPercent(0f);
root_child3.setWidth(50f);
root.addChildAt(root_child3, 3);
final YogaNode root_child4 = new YogaNode(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root.addChildAt(root_child4, 4);
root.setDirection(YogaDirection.LTR);
@@ -1135,18 +1145,18 @@ public class YGAlignContentTest {
public void test_align_content_stretch_row_with_margin() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(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(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(config);
root_child1.setMargin(YogaEdge.LEFT, 10f);
root_child1.setMargin(YogaEdge.TOP, 10f);
root_child1.setMargin(YogaEdge.RIGHT, 10f);
@@ -1154,11 +1164,11 @@ public class YGAlignContentTest {
root_child1.setWidth(50f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = new YogaNode(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(config);
root_child3.setMargin(YogaEdge.LEFT, 10f);
root_child3.setMargin(YogaEdge.TOP, 10f);
root_child3.setMargin(YogaEdge.RIGHT, 10f);
@@ -1166,7 +1176,7 @@ public class YGAlignContentTest {
root_child3.setWidth(50f);
root.addChildAt(root_child3, 3);
final YogaNode root_child4 = new YogaNode(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root.addChildAt(root_child4, 4);
root.setDirection(YogaDirection.LTR);
@@ -1240,18 +1250,18 @@ public class YGAlignContentTest {
public void test_align_content_stretch_row_with_padding() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(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(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(config);
root_child1.setPadding(YogaEdge.LEFT, 10);
root_child1.setPadding(YogaEdge.TOP, 10);
root_child1.setPadding(YogaEdge.RIGHT, 10);
@@ -1259,11 +1269,11 @@ public class YGAlignContentTest {
root_child1.setWidth(50f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = new YogaNode(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(config);
root_child3.setPadding(YogaEdge.LEFT, 10);
root_child3.setPadding(YogaEdge.TOP, 10);
root_child3.setPadding(YogaEdge.RIGHT, 10);
@@ -1271,7 +1281,7 @@ public class YGAlignContentTest {
root_child3.setWidth(50f);
root.addChildAt(root_child3, 3);
final YogaNode root_child4 = new YogaNode(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root.addChildAt(root_child4, 4);
root.setDirection(YogaDirection.LTR);
@@ -1345,18 +1355,18 @@ public class YGAlignContentTest {
public void test_align_content_stretch_row_with_single_row() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(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(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(50f);
root.addChildAt(root_child1, 1);
root.setDirection(YogaDirection.LTR);
@@ -1400,31 +1410,31 @@ public class YGAlignContentTest {
public void test_align_content_stretch_row_with_fixed_height() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(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(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(50f);
root_child1.setHeight(60f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = new YogaNode(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(config);
root_child3.setWidth(50f);
root.addChildAt(root_child3, 3);
final YogaNode root_child4 = new YogaNode(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root.addChildAt(root_child4, 4);
root.setDirection(YogaDirection.LTR);
@@ -1498,31 +1508,31 @@ public class YGAlignContentTest {
public void test_align_content_stretch_row_with_max_height() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(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(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(50f);
root_child1.setMaxHeight(20f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = new YogaNode(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(config);
root_child3.setWidth(50f);
root.addChildAt(root_child3, 3);
final YogaNode root_child4 = new YogaNode(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root.addChildAt(root_child4, 4);
root.setDirection(YogaDirection.LTR);
@@ -1596,31 +1606,31 @@ public class YGAlignContentTest {
public void test_align_content_stretch_row_with_min_height() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(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(config);
final YogaNode root_child0 = createNode(config);
root_child0.setWidth(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode(config);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(50f);
root_child1.setMinHeight(80f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = new YogaNode(config);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(50f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(config);
root_child3.setWidth(50f);
root.addChildAt(root_child3, 3);
final YogaNode root_child4 = new YogaNode(config);
final YogaNode root_child4 = createNode(config);
root_child4.setWidth(50f);
root.addChildAt(root_child4, 4);
root.setDirection(YogaDirection.LTR);
@@ -1694,38 +1704,38 @@ public class YGAlignContentTest {
public void test_align_content_stretch_column() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(config);
root.setAlignContent(YogaAlign.STRETCH);
root.setWrap(YogaWrap.WRAP);
root.setWidth(100f);
root.setHeight(150f);
final YogaNode root_child0 = new YogaNode(config);
final YogaNode root_child0 = createNode(config);
root_child0.setHeight(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child0_child0 = new YogaNode(config);
final YogaNode root_child0_child0 = createNode(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(config);
final YogaNode root_child1 = createNode(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(config);
final YogaNode root_child2 = createNode(config);
root_child2.setHeight(50f);
root.addChildAt(root_child2, 2);
final YogaNode root_child3 = new YogaNode(config);
final YogaNode root_child3 = createNode(config);
root_child3.setHeight(50f);
root.addChildAt(root_child3, 3);
final YogaNode root_child4 = new YogaNode(config);
final YogaNode root_child4 = createNode(config);
root_child4.setHeight(50f);
root.addChildAt(root_child4, 4);
root.setDirection(YogaDirection.LTR);
@@ -1809,10 +1819,10 @@ public class YGAlignContentTest {
public void test_align_content_stretch_is_not_overriding_align_items() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
final YogaNode root = createNode(config);
root.setAlignContent(YogaAlign.STRETCH);
final YogaNode root_child0 = new YogaNode(config);
final YogaNode root_child0 = createNode(config);
root_child0.setFlexDirection(YogaFlexDirection.ROW);
root_child0.setAlignContent(YogaAlign.STRETCH);
root_child0.setAlignItems(YogaAlign.CENTER);
@@ -1820,7 +1830,7 @@ public class YGAlignContentTest {
root_child0.setHeight(100f);
root.addChildAt(root_child0, 0);
final YogaNode root_child0_child0 = new YogaNode(config);
final YogaNode root_child0_child0 = createNode(config);
root_child0_child0.setAlignContent(YogaAlign.STRETCH);
root_child0_child0.setWidth(10f);
root_child0_child0.setHeight(10f);
@@ -1862,4 +1872,7 @@ public class YGAlignContentTest {
assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
}
private YogaNode createNode(YogaConfig config) {
return mNodeFactory.create(config);
}
}