Summary: X-link: https://github.com/facebook/react-native/pull/41480 Pull Request resolved: https://github.com/facebook/yoga/pull/1469 The previous version of static didn't do anything inside of Yoga. Now that we're making it do something, this changes the default back to relative so that users with no errata set don't see their deafult styles changing. Reviewed By: joevilches Differential Revision: D51182955 fbshipit-source-id: c0ea357694e1367fb6786f1907dfff784b19a4bc
1264 lines
51 KiB
Java
1264 lines
51 KiB
Java
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
// @generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html
|
|
|
|
package com.facebook.yoga;
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
import org.junit.Ignore;
|
|
import org.junit.Test;
|
|
import org.junit.runner.RunWith;
|
|
import org.junit.runners.Parameterized;
|
|
|
|
@RunWith(Parameterized.class)
|
|
public class YGJustifyContentTest {
|
|
@Parameterized.Parameters(name = "{0}")
|
|
public static Iterable<TestParametrization.NodeFactory> nodeFactories() {
|
|
return TestParametrization.nodeFactories();
|
|
}
|
|
|
|
@Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory;
|
|
|
|
@Test
|
|
public void test_justify_content_row_flex_start() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setWidth(102f);
|
|
root.setHeight(102f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setWidth(10f);
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
final YogaNode root_child1 = createNode(config);
|
|
root_child1.setWidth(10f);
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
final YogaNode root_child2 = createNode(config);
|
|
root_child2.setWidth(10f);
|
|
root.addChildAt(root_child2, 2);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(20f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(92f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(82f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(72f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_row_flex_end() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
|
root.setJustifyContent(YogaJustify.FLEX_END);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setWidth(102f);
|
|
root.setHeight(102f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setWidth(10f);
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
final YogaNode root_child1 = createNode(config);
|
|
root_child1.setWidth(10f);
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
final YogaNode root_child2 = createNode(config);
|
|
root_child2.setWidth(10f);
|
|
root.addChildAt(root_child2, 2);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(72f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(82f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(92f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_row_center() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
|
root.setJustifyContent(YogaJustify.CENTER);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setWidth(102f);
|
|
root.setHeight(102f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setWidth(10f);
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
final YogaNode root_child1 = createNode(config);
|
|
root_child1.setWidth(10f);
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
final YogaNode root_child2 = createNode(config);
|
|
root_child2.setWidth(10f);
|
|
root.addChildAt(root_child2, 2);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(36f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(46f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(56f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(56f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(46f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(36f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_row_space_between() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
|
root.setJustifyContent(YogaJustify.SPACE_BETWEEN);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setWidth(102f);
|
|
root.setHeight(102f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setWidth(10f);
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
final YogaNode root_child1 = createNode(config);
|
|
root_child1.setWidth(10f);
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
final YogaNode root_child2 = createNode(config);
|
|
root_child2.setWidth(10f);
|
|
root.addChildAt(root_child2, 2);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(46f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(92f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(92f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(46f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_row_space_around() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
|
root.setJustifyContent(YogaJustify.SPACE_AROUND);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setWidth(102f);
|
|
root.setHeight(102f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setWidth(10f);
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
final YogaNode root_child1 = createNode(config);
|
|
root_child1.setWidth(10f);
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
final YogaNode root_child2 = createNode(config);
|
|
root_child2.setWidth(10f);
|
|
root.addChildAt(root_child2, 2);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(12f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(46f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(80f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(46f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(12f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_column_flex_start() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setWidth(102f);
|
|
root.setHeight(102f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setHeight(10f);
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
final YogaNode root_child1 = createNode(config);
|
|
root_child1.setHeight(10f);
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
final YogaNode root_child2 = createNode(config);
|
|
root_child2.setHeight(10f);
|
|
root.addChildAt(root_child2, 2);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_column_flex_end() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setJustifyContent(YogaJustify.FLEX_END);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setWidth(102f);
|
|
root.setHeight(102f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setHeight(10f);
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
final YogaNode root_child1 = createNode(config);
|
|
root_child1.setHeight(10f);
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
final YogaNode root_child2 = createNode(config);
|
|
root_child2.setHeight(10f);
|
|
root.addChildAt(root_child2, 2);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(72f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(82f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(92f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(72f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(82f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(92f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_column_center() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setJustifyContent(YogaJustify.CENTER);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setWidth(102f);
|
|
root.setHeight(102f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setHeight(10f);
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
final YogaNode root_child1 = createNode(config);
|
|
root_child1.setHeight(10f);
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
final YogaNode root_child2 = createNode(config);
|
|
root_child2.setHeight(10f);
|
|
root.addChildAt(root_child2, 2);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(36f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(46f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(56f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(36f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(46f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(56f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_column_space_between() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setJustifyContent(YogaJustify.SPACE_BETWEEN);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setWidth(102f);
|
|
root.setHeight(102f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setHeight(10f);
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
final YogaNode root_child1 = createNode(config);
|
|
root_child1.setHeight(10f);
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
final YogaNode root_child2 = createNode(config);
|
|
root_child2.setHeight(10f);
|
|
root.addChildAt(root_child2, 2);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(46f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(92f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(46f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(92f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_column_space_around() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setJustifyContent(YogaJustify.SPACE_AROUND);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setWidth(102f);
|
|
root.setHeight(102f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setHeight(10f);
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
final YogaNode root_child1 = createNode(config);
|
|
root_child1.setHeight(10f);
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
final YogaNode root_child2 = createNode(config);
|
|
root_child2.setHeight(10f);
|
|
root.addChildAt(root_child2, 2);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(12f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(46f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(80f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(12f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(46f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(80f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_row_min_width_and_margin() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
|
root.setJustifyContent(YogaJustify.CENTER);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setMargin(YogaEdge.LEFT, 100f);
|
|
root.setMinWidth(50f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setWidth(20f);
|
|
root_child0.setHeight(20f);
|
|
root.addChildAt(root_child0, 0);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(100f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(20f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(15f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(100f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(20f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(15f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_row_max_width_and_margin() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
|
root.setJustifyContent(YogaJustify.CENTER);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setMargin(YogaEdge.LEFT, 100f);
|
|
root.setWidth(100f);
|
|
root.setMaxWidth(80f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setWidth(20f);
|
|
root_child0.setHeight(20f);
|
|
root.addChildAt(root_child0, 0);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(100f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(80f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(20f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(30f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(100f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(80f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(20f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(30f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_column_min_height_and_margin() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setJustifyContent(YogaJustify.CENTER);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setMargin(YogaEdge.TOP, 100f);
|
|
root.setMinHeight(50f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setWidth(20f);
|
|
root_child0.setHeight(20f);
|
|
root.addChildAt(root_child0, 0);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(100f, root.getLayoutY(), 0.0f);
|
|
assertEquals(20f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(15f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(100f, root.getLayoutY(), 0.0f);
|
|
assertEquals(20f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(15f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_colunn_max_height_and_margin() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setJustifyContent(YogaJustify.CENTER);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setMargin(YogaEdge.TOP, 100f);
|
|
root.setHeight(100f);
|
|
root.setMaxHeight(80f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setWidth(20f);
|
|
root_child0.setHeight(20f);
|
|
root.addChildAt(root_child0, 0);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(100f, root.getLayoutY(), 0.0f);
|
|
assertEquals(20f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(80f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(30f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(100f, root.getLayoutY(), 0.0f);
|
|
assertEquals(20f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(80f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(30f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_column_space_evenly() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setJustifyContent(YogaJustify.SPACE_EVENLY);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setWidth(102f);
|
|
root.setHeight(102f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setHeight(10f);
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
final YogaNode root_child1 = createNode(config);
|
|
root_child1.setHeight(10f);
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
final YogaNode root_child2 = createNode(config);
|
|
root_child2.setHeight(10f);
|
|
root.addChildAt(root_child2, 2);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(18f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(46f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(74f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(18f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(46f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(74f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_row_space_evenly() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
|
root.setJustifyContent(YogaJustify.SPACE_EVENLY);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setWidth(102f);
|
|
root.setHeight(102f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setHeight(10f);
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
final YogaNode root_child1 = createNode(config);
|
|
root_child1.setHeight(10f);
|
|
root.addChildAt(root_child1, 1);
|
|
|
|
final YogaNode root_child2 = createNode(config);
|
|
root_child2.setHeight(10f);
|
|
root.addChildAt(root_child2, 2);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(26f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(51f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(77f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(0f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(77f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(51f, root_child1.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(26f, root_child2.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
|
assertEquals(0f, root_child2.getLayoutWidth(), 0.0f);
|
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_min_width_with_padding_child_width_greater_than_parent() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setAlignContent(YogaAlign.STRETCH);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setWidth(1000f);
|
|
root.setHeight(1584f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setFlexDirection(YogaFlexDirection.ROW);
|
|
root_child0.setAlignContent(YogaAlign.STRETCH);
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
final YogaNode root_child0_child0 = createNode(config);
|
|
root_child0_child0.setFlexDirection(YogaFlexDirection.ROW);
|
|
root_child0_child0.setJustifyContent(YogaJustify.CENTER);
|
|
root_child0_child0.setAlignContent(YogaAlign.STRETCH);
|
|
root_child0_child0.setPadding(YogaEdge.LEFT, 100);
|
|
root_child0_child0.setPadding(YogaEdge.RIGHT, 100);
|
|
root_child0_child0.setMinWidth(400f);
|
|
root_child0.addChildAt(root_child0_child0, 0);
|
|
|
|
final YogaNode root_child0_child0_child0 = createNode(config);
|
|
root_child0_child0_child0.setFlexDirection(YogaFlexDirection.ROW);
|
|
root_child0_child0_child0.setAlignContent(YogaAlign.STRETCH);
|
|
root_child0_child0_child0.setWidth(300f);
|
|
root_child0_child0_child0.setHeight(100f);
|
|
root_child0_child0.addChildAt(root_child0_child0_child0, 0);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(1000f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(1584f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(1000f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
|
assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
|
assertEquals(300f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(1000f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(1584f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(1000f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(500f, root_child0_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
|
assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
|
assertEquals(300f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_min_width_with_padding_child_width_lower_than_parent() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setAlignContent(YogaAlign.STRETCH);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setWidth(1080f);
|
|
root.setHeight(1584f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setFlexDirection(YogaFlexDirection.ROW);
|
|
root_child0.setAlignContent(YogaAlign.STRETCH);
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
final YogaNode root_child0_child0 = createNode(config);
|
|
root_child0_child0.setFlexDirection(YogaFlexDirection.ROW);
|
|
root_child0_child0.setJustifyContent(YogaJustify.CENTER);
|
|
root_child0_child0.setAlignContent(YogaAlign.STRETCH);
|
|
root_child0_child0.setPadding(YogaEdge.LEFT, 100);
|
|
root_child0_child0.setPadding(YogaEdge.RIGHT, 100);
|
|
root_child0_child0.setMinWidth(400f);
|
|
root_child0.addChildAt(root_child0_child0, 0);
|
|
|
|
final YogaNode root_child0_child0_child0 = createNode(config);
|
|
root_child0_child0_child0.setFlexDirection(YogaFlexDirection.ROW);
|
|
root_child0_child0_child0.setAlignContent(YogaAlign.STRETCH);
|
|
root_child0_child0_child0.setWidth(199f);
|
|
root_child0_child0_child0.setHeight(100f);
|
|
root_child0_child0.addChildAt(root_child0_child0_child0, 0);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(1080f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(1584f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(1080f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
|
assertEquals(400f, root_child0_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(101f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
|
assertEquals(199f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(1080f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(1584f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(1080f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(680f, root_child0_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
|
assertEquals(400f, root_child0_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(101f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
|
assertEquals(199f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
@Test
|
|
public void test_justify_content_space_between_indefinite_container_dim_with_free_space() {
|
|
YogaConfig config = YogaConfigFactory.create();
|
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
|
|
|
final YogaNode root = createNode(config);
|
|
root.setAlignItems(YogaAlign.CENTER);
|
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
|
root.setWidth(300f);
|
|
|
|
final YogaNode root_child0 = createNode(config);
|
|
root_child0.setFlexDirection(YogaFlexDirection.ROW);
|
|
root_child0.setJustifyContent(YogaJustify.SPACE_BETWEEN);
|
|
root_child0.setMinWidth(200f);
|
|
root.addChildAt(root_child0, 0);
|
|
|
|
final YogaNode root_child0_child0 = createNode(config);
|
|
root_child0_child0.setWidth(50f);
|
|
root_child0_child0.setHeight(50f);
|
|
root_child0.addChildAt(root_child0_child0, 0);
|
|
|
|
final YogaNode root_child0_child1 = createNode(config);
|
|
root_child0_child1.setWidth(50f);
|
|
root_child0_child1.setHeight(50f);
|
|
root_child0.addChildAt(root_child0_child1, 1);
|
|
root.setDirection(YogaDirection.LTR);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
|
assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(150f, root_child0_child1.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
|
|
assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
|
|
|
|
root.setDirection(YogaDirection.RTL);
|
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
|
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
|
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(150f, root_child0_child0.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
|
assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
|
|
assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
|
|
|
|
assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
|
|
assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
|
|
assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
|
|
assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
|
|
}
|
|
|
|
private YogaNode createNode(YogaConfig config) {
|
|
return mNodeFactory.create(config);
|
|
}
|
|
}
|