|
|
|
@@ -425,4 +425,745 @@ public class YGMarginTest {
|
|
|
|
|
assertEquals(45f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void test_margin_auto_bottom() {
|
|
|
|
|
final YogaNode root = new YogaNode();
|
|
|
|
|
root.setAlignItems(YogaAlign.CENTER);
|
|
|
|
|
root.setWidth(200f);
|
|
|
|
|
root.setHeight(200f);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child0 = new YogaNode();
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.BOTTOM);
|
|
|
|
|
root_child0.setWidth(50f);
|
|
|
|
|
root_child0.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child1 = new YogaNode();
|
|
|
|
|
root_child1.setWidth(50f);
|
|
|
|
|
root_child1.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
|
root.setDirection(YogaDirection.LTR);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void test_margin_auto_top() {
|
|
|
|
|
final YogaNode root = new YogaNode();
|
|
|
|
|
root.setAlignItems(YogaAlign.CENTER);
|
|
|
|
|
root.setWidth(200f);
|
|
|
|
|
root.setHeight(200f);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child0 = new YogaNode();
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.TOP);
|
|
|
|
|
root_child0.setWidth(50f);
|
|
|
|
|
root_child0.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child1 = new YogaNode();
|
|
|
|
|
root_child1.setWidth(50f);
|
|
|
|
|
root_child1.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
|
root.setDirection(YogaDirection.LTR);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(100f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(100f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void test_margin_auto_bottom_and_top() {
|
|
|
|
|
final YogaNode root = new YogaNode();
|
|
|
|
|
root.setAlignItems(YogaAlign.CENTER);
|
|
|
|
|
root.setWidth(200f);
|
|
|
|
|
root.setHeight(200f);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child0 = new YogaNode();
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.TOP);
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.BOTTOM);
|
|
|
|
|
root_child0.setWidth(50f);
|
|
|
|
|
root_child0.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child1 = new YogaNode();
|
|
|
|
|
root_child1.setWidth(50f);
|
|
|
|
|
root_child1.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
|
root.setDirection(YogaDirection.LTR);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void test_margin_auto_bottom_and_top_justify_center() {
|
|
|
|
|
final YogaNode root = new YogaNode();
|
|
|
|
|
root.setJustifyContent(YogaJustify.CENTER);
|
|
|
|
|
root.setWidth(200f);
|
|
|
|
|
root.setHeight(200f);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child0 = new YogaNode();
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.TOP);
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.BOTTOM);
|
|
|
|
|
root_child0.setWidth(50f);
|
|
|
|
|
root_child0.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child1 = new YogaNode();
|
|
|
|
|
root_child1.setWidth(50f);
|
|
|
|
|
root_child1.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
|
root.setDirection(YogaDirection.LTR);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void test_margin_auto_mutiple_children_column() {
|
|
|
|
|
final YogaNode root = new YogaNode();
|
|
|
|
|
root.setAlignItems(YogaAlign.CENTER);
|
|
|
|
|
root.setWidth(200f);
|
|
|
|
|
root.setHeight(200f);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child0 = new YogaNode();
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.TOP);
|
|
|
|
|
root_child0.setWidth(50f);
|
|
|
|
|
root_child0.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child1 = new YogaNode();
|
|
|
|
|
root_child1.setMarginAuto(YogaEdge.TOP);
|
|
|
|
|
root_child1.setWidth(50f);
|
|
|
|
|
root_child1.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child2 = new YogaNode();
|
|
|
|
|
root_child2.setWidth(50f);
|
|
|
|
|
root_child2.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child2, 2);
|
|
|
|
|
root.setDirection(YogaDirection.LTR);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(25f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(100f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child2.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(150f, root_child2.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(25f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(100f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child2.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(150f, root_child2.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void test_margin_auto_mutiple_children_row() {
|
|
|
|
|
final YogaNode root = new YogaNode();
|
|
|
|
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
|
|
|
|
root.setAlignItems(YogaAlign.CENTER);
|
|
|
|
|
root.setWidth(200f);
|
|
|
|
|
root.setHeight(200f);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child0 = new YogaNode();
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.RIGHT);
|
|
|
|
|
root_child0.setWidth(50f);
|
|
|
|
|
root_child0.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child1 = new YogaNode();
|
|
|
|
|
root_child1.setMarginAuto(YogaEdge.RIGHT);
|
|
|
|
|
root_child1.setWidth(50f);
|
|
|
|
|
root_child1.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child2 = new YogaNode();
|
|
|
|
|
root_child2.setWidth(50f);
|
|
|
|
|
root_child2.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child2, 2);
|
|
|
|
|
root.setDirection(YogaDirection.LTR);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(150f, root_child2.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(75f, root_child2.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(125f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(75f, root_child2.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void test_margin_auto_left_and_right_column() {
|
|
|
|
|
final YogaNode root = new YogaNode();
|
|
|
|
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
|
|
|
|
root.setAlignItems(YogaAlign.CENTER);
|
|
|
|
|
root.setWidth(200f);
|
|
|
|
|
root.setHeight(200f);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child0 = new YogaNode();
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.LEFT);
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.RIGHT);
|
|
|
|
|
root_child0.setWidth(50f);
|
|
|
|
|
root_child0.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child1 = new YogaNode();
|
|
|
|
|
root_child1.setWidth(50f);
|
|
|
|
|
root_child1.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
|
root.setDirection(YogaDirection.LTR);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void test_margin_auto_left_and_right() {
|
|
|
|
|
final YogaNode root = new YogaNode();
|
|
|
|
|
root.setWidth(200f);
|
|
|
|
|
root.setHeight(200f);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child0 = new YogaNode();
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.LEFT);
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.RIGHT);
|
|
|
|
|
root_child0.setWidth(50f);
|
|
|
|
|
root_child0.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child1 = new YogaNode();
|
|
|
|
|
root_child1.setWidth(50f);
|
|
|
|
|
root_child1.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
|
root.setDirection(YogaDirection.LTR);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void test_margin_auto_left_and_right_column_and_center() {
|
|
|
|
|
final YogaNode root = new YogaNode();
|
|
|
|
|
root.setAlignItems(YogaAlign.CENTER);
|
|
|
|
|
root.setWidth(200f);
|
|
|
|
|
root.setHeight(200f);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child0 = new YogaNode();
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.LEFT);
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.RIGHT);
|
|
|
|
|
root_child0.setWidth(50f);
|
|
|
|
|
root_child0.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child1 = new YogaNode();
|
|
|
|
|
root_child1.setWidth(50f);
|
|
|
|
|
root_child1.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
|
root.setDirection(YogaDirection.LTR);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void test_margin_auto_left() {
|
|
|
|
|
final YogaNode root = new YogaNode();
|
|
|
|
|
root.setAlignItems(YogaAlign.CENTER);
|
|
|
|
|
root.setWidth(200f);
|
|
|
|
|
root.setHeight(200f);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child0 = new YogaNode();
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.LEFT);
|
|
|
|
|
root_child0.setWidth(50f);
|
|
|
|
|
root_child0.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child1 = new YogaNode();
|
|
|
|
|
root_child1.setWidth(50f);
|
|
|
|
|
root_child1.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
|
root.setDirection(YogaDirection.LTR);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void test_margin_auto_right() {
|
|
|
|
|
final YogaNode root = new YogaNode();
|
|
|
|
|
root.setAlignItems(YogaAlign.CENTER);
|
|
|
|
|
root.setWidth(200f);
|
|
|
|
|
root.setHeight(200f);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child0 = new YogaNode();
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.RIGHT);
|
|
|
|
|
root_child0.setWidth(50f);
|
|
|
|
|
root_child0.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child1 = new YogaNode();
|
|
|
|
|
root_child1.setWidth(50f);
|
|
|
|
|
root_child1.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
|
root.setDirection(YogaDirection.LTR);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void test_margin_auto_left_and_right_strech() {
|
|
|
|
|
final YogaNode root = new YogaNode();
|
|
|
|
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
|
|
|
|
root.setWidth(200f);
|
|
|
|
|
root.setHeight(200f);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child0 = new YogaNode();
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.LEFT);
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.RIGHT);
|
|
|
|
|
root_child0.setWidth(50f);
|
|
|
|
|
root_child0.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child1 = new YogaNode();
|
|
|
|
|
root_child1.setWidth(50f);
|
|
|
|
|
root_child1.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
|
root.setDirection(YogaDirection.LTR);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void test_margin_auto_top_and_bottom_strech() {
|
|
|
|
|
final YogaNode root = new YogaNode();
|
|
|
|
|
root.setWidth(200f);
|
|
|
|
|
root.setHeight(200f);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child0 = new YogaNode();
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.TOP);
|
|
|
|
|
root_child0.setMarginAuto(YogaEdge.BOTTOM);
|
|
|
|
|
root_child0.setWidth(50f);
|
|
|
|
|
root_child0.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
|
|
|
|
|
|
final YogaNode root_child1 = new YogaNode();
|
|
|
|
|
root_child1.setWidth(50f);
|
|
|
|
|
root_child1.setHeight(50f);
|
|
|
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
|
root.setDirection(YogaDirection.LTR);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
|
|
|
root.calculateLayout();
|
|
|
|
|
|
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
|
|
|
|
|
|
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
|
|
|
|
|
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
|
|
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|