Remove rounding from experimental features

Summary: Rounding has been successfully adopted by multiple products and frameworks. Time to move it out of experimental mode. Rounding can still be turned of by setting the point scale factor to 0 on the config.

Reviewed By: gkassabli

Differential Revision: D4953838

fbshipit-source-id: 3ee5f27d92f95b3ed4a01c98bc35e9157f2e91c5
This commit is contained in:
Emil Sjolander
2017-04-27 07:09:24 -07:00
committed by Facebook Github Bot
parent f6b17183c5
commit 3db38f2a80
20 changed files with 48 additions and 216 deletions

View File

@@ -13,9 +13,8 @@ import com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip
public enum YogaExperimentalFeature {
ROUNDING(0),
WEB_FLEX_BASIS(1),
MIN_FLEX_FIX(2);
WEB_FLEX_BASIS(0),
MIN_FLEX_FIX(1);
private int mIntValue;
@@ -29,9 +28,8 @@ public enum YogaExperimentalFeature {
public static YogaExperimentalFeature fromInt(int value) {
switch (value) {
case 0: return ROUNDING;
case 1: return WEB_FLEX_BASIS;
case 2: return MIN_FLEX_FIX;
case 0: return WEB_FLEX_BASIS;
case 1: return MIN_FLEX_FIX;
default: throw new IllegalArgumentException("Unknown enum value: " + value);
}
}

View File

@@ -19,7 +19,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_width_height() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
@@ -60,7 +59,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_position_left_top() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
@@ -103,7 +101,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_position_bottom_right() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
@@ -146,7 +143,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_flex_basis() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
@@ -202,7 +198,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_flex_basis_cross() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setWidth(200f);
@@ -257,7 +252,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_flex_basis_cross_min_height() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setWidth(200f);
@@ -312,7 +306,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_flex_basis_main_max_height() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
@@ -370,7 +363,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_flex_basis_cross_max_height() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setWidth(200f);
@@ -427,7 +419,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_flex_basis_main_max_width() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
@@ -485,7 +476,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_flex_basis_cross_max_width() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setWidth(200f);
@@ -542,7 +532,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_flex_basis_main_min_width() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
@@ -600,7 +589,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_flex_basis_cross_min_width() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setWidth(200f);
@@ -657,7 +645,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_multiple_nested_with_padding_margin_and_percentage_values() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setWidth(200f);
@@ -766,7 +753,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_margin_should_calculate_based_only_on_width() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setWidth(200f);
@@ -824,7 +810,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_padding_should_calculate_based_only_on_width() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setWidth(200f);
@@ -882,7 +867,6 @@ public class YGPercentageTest {
@Test
public void test_percentage_absolute_position() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setWidth(200f);

View File

@@ -19,7 +19,6 @@ public class YGRoundingTest {
@Test
public void test_rounding_flex_basis_flex_grow_row_width_of_100() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
@@ -87,7 +86,6 @@ public class YGRoundingTest {
@Test
public void test_rounding_flex_basis_flex_grow_row_prime_number_width() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
@@ -183,7 +181,6 @@ public class YGRoundingTest {
@Test
public void test_rounding_flex_basis_flex_shrink_row() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
@@ -252,7 +249,6 @@ public class YGRoundingTest {
@Test
public void test_rounding_flex_basis_overrides_main_size() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setWidth(100f);
@@ -323,7 +319,6 @@ public class YGRoundingTest {
@Test
public void test_rounding_total_fractial() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setWidth(87.4f);
@@ -394,7 +389,6 @@ public class YGRoundingTest {
@Test
public void test_rounding_total_fractial_nested() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setWidth(87.4f);
@@ -499,7 +493,6 @@ public class YGRoundingTest {
@Test
public void test_rounding_fractial_input_1() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setWidth(100f);
@@ -570,7 +563,6 @@ public class YGRoundingTest {
@Test
public void test_rounding_fractial_input_2() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setWidth(100f);
@@ -641,7 +633,6 @@ public class YGRoundingTest {
@Test
public void test_rounding_fractial_input_3() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setPosition(YogaEdge.TOP, 0.3f);
@@ -713,7 +704,6 @@ public class YGRoundingTest {
@Test
public void test_rounding_fractial_input_4() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setPosition(YogaEdge.TOP, 0.7f);
@@ -785,7 +775,6 @@ public class YGRoundingTest {
@Test
public void test_rounding_inner_node_controversy_horizontal() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
@@ -870,7 +859,6 @@ public class YGRoundingTest {
@Test
public void test_rounding_inner_node_controversy_vertical() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setHeight(320f);
@@ -954,7 +942,6 @@ public class YGRoundingTest {
@Test
public void test_rounding_inner_node_controversy_combined() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final YogaNode root = new YogaNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);

View File

@@ -84,8 +84,8 @@ public class YogaNodeTest {
}
});
node.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(100.5f, node.getLayoutWidth(), 0.0f);
assertEquals(100.5f, node.getLayoutHeight(), 0.0f);
assertEquals(101f, node.getLayoutWidth(), 0.01f);
assertEquals(101f, node.getLayoutHeight(), 0.01f);
}
@Test
@@ -102,8 +102,8 @@ public class YogaNodeTest {
}
});
node.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(Float.MIN_VALUE, node.getLayoutWidth(), 0.0f);
assertEquals(Float.MIN_VALUE, node.getLayoutHeight(), 0.0f);
assertEquals(Float.MIN_VALUE, node.getLayoutWidth(), 0.01f);
assertEquals(Float.MIN_VALUE, node.getLayoutHeight(), 0.01f);
}
@Test
@@ -120,8 +120,8 @@ public class YogaNodeTest {
}
});
node.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(Float.MAX_VALUE, node.getLayoutWidth(), 0.0f);
assertEquals(Float.MAX_VALUE, node.getLayoutHeight(), 0.0f);
assertEquals(Float.MAX_VALUE, node.getLayoutWidth(), 0.01f);
assertEquals(Float.MAX_VALUE, node.getLayoutHeight(), 0.01f);
}
private YogaLogLevel mLogLevel;