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:
committed by
Facebook Github Bot
parent
b1821ab4cd
commit
3499e2e0ef
@@ -9,23 +9,33 @@
|
||||
|
||||
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 YGSizeOverflowTest {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
public static Iterable<TestParametrization.NodeFactory> nodeFactories() {
|
||||
return TestParametrization.nodeFactories();
|
||||
}
|
||||
|
||||
@Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory;
|
||||
|
||||
@Test
|
||||
public void test_nested_overflowing_child() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
final YogaNode root = createNode(config);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = new YogaNode(config);
|
||||
final YogaNode root_child0_child0 = createNode(config);
|
||||
root_child0_child0.setWidth(200f);
|
||||
root_child0_child0.setHeight(200f);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
@@ -70,16 +80,16 @@ public class YGSizeOverflowTest {
|
||||
public void test_nested_overflowing_child_in_constraint_parent() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
final YogaNode root = createNode(config);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(100f);
|
||||
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.setWidth(200f);
|
||||
root_child0_child0.setHeight(200f);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
@@ -124,15 +134,15 @@ public class YGSizeOverflowTest {
|
||||
public void test_parent_wrap_child_size_overflowing_parent() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
|
||||
final YogaNode root = new YogaNode(config);
|
||||
final YogaNode root = createNode(config);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode(config);
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(100f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = new YogaNode(config);
|
||||
final YogaNode root_child0_child0 = createNode(config);
|
||||
root_child0_child0.setWidth(100f);
|
||||
root_child0_child0.setHeight(200f);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
@@ -173,4 +183,7 @@ public class YGSizeOverflowTest {
|
||||
assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user