Clearly mark java CSSNode as deprecated. It will go away very soon
Summary: Clearly mark java CSSNode as deprecated. It will go away very soon. Reviewed By: lucasr Differential Revision: D3992775 fbshipit-source-id: b3ceca277e5c7426eb51f8cbeacf5e2fe451c6ec
This commit is contained in:
committed by
Facebook Github Bot
parent
871a7cf310
commit
62dba4c741
@@ -17,19 +17,19 @@ public class CSSLayoutFlexBasisTest {
|
||||
|
||||
@Test
|
||||
public void testFlexBasis() {
|
||||
final CSSNode root = new CSSNode();
|
||||
final CSSNodeDEPRECATED root = new CSSNodeDEPRECATED();
|
||||
root.setFlexDirection(CSSFlexDirection.ROW);
|
||||
root.setStyleWidth(300);
|
||||
root.setStyleHeight(100);
|
||||
|
||||
final CSSNode root_child0 = new CSSNode();
|
||||
final CSSNodeDEPRECATED root_child0 = new CSSNodeDEPRECATED();
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setFlexBasis(100);
|
||||
root_child0.setStyleWidth(200);
|
||||
root_child0.setStyleHeight(100);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final CSSNode root_child1 = new CSSNode();
|
||||
final CSSNodeDEPRECATED root_child1 = new CSSNodeDEPRECATED();
|
||||
root_child1.setFlexGrow(1);
|
||||
root_child1.setStyleWidth(100);
|
||||
root_child1.setStyleHeight(100);
|
||||
|
@@ -15,14 +15,14 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
/**
|
||||
* Tests for {@link CSSNode}.
|
||||
* Tests for {@link CSSNodeDEPRECATED}.
|
||||
*/
|
||||
public class CSSNodeTest {
|
||||
|
||||
@Test
|
||||
public void testAddChildGetParent() {
|
||||
CSSNode parent = new CSSNode();
|
||||
CSSNode child = new CSSNode();
|
||||
CSSNodeDEPRECATED parent = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED child = new CSSNodeDEPRECATED();
|
||||
|
||||
assertNull(child.getParent());
|
||||
assertEquals(0, parent.getChildCount());
|
||||
@@ -41,9 +41,9 @@ public class CSSNodeTest {
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void testCannotAddChildToMultipleParents() {
|
||||
CSSNode parent1 = new CSSNode();
|
||||
CSSNode parent2 = new CSSNode();
|
||||
CSSNode child = new CSSNode();
|
||||
CSSNodeDEPRECATED parent1 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED parent2 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED child = new CSSNodeDEPRECATED();
|
||||
|
||||
parent1.addChildAt(child, 0);
|
||||
parent2.addChildAt(child, 0);
|
||||
|
@@ -14,12 +14,12 @@ import org.junit.Test;
|
||||
import static junit.framework.Assert.*;
|
||||
|
||||
/**
|
||||
* Tests for {@link LayoutEngine} and {@link CSSNode} to make sure layouts are only generated when
|
||||
* Tests for {@link LayoutEngine} and {@link CSSNodeDEPRECATED} to make sure layouts are only generated when
|
||||
* needed.
|
||||
*/
|
||||
public class LayoutCachingTest {
|
||||
|
||||
private void assertTreeHasNewLayout(boolean expectedHasNewLayout, CSSNode root) {
|
||||
private void assertTreeHasNewLayout(boolean expectedHasNewLayout, CSSNodeDEPRECATED root) {
|
||||
assertEquals(expectedHasNewLayout, root.hasNewLayout());
|
||||
|
||||
for (int i = 0; i < root.getChildCount(); i++) {
|
||||
@@ -27,7 +27,7 @@ public class LayoutCachingTest {
|
||||
}
|
||||
}
|
||||
|
||||
private void markLayoutAppliedForTree(CSSNode root) {
|
||||
private void markLayoutAppliedForTree(CSSNodeDEPRECATED root) {
|
||||
root.markLayoutSeen();
|
||||
for (int i = 0; i < root.getChildCount(); i++) {
|
||||
markLayoutAppliedForTree(root.getChildAt(i));
|
||||
@@ -37,10 +37,10 @@ public class LayoutCachingTest {
|
||||
@Test
|
||||
public void testCachesFullTree() {
|
||||
CSSLayoutContext layoutContext = new CSSLayoutContext();
|
||||
CSSNode root = new CSSNode();
|
||||
CSSNode c0 = new CSSNode();
|
||||
CSSNode c1 = new CSSNode();
|
||||
CSSNode c0c0 = new CSSNode();
|
||||
CSSNodeDEPRECATED root = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c1 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0c0 = new CSSNodeDEPRECATED();
|
||||
root.addChildAt(c0, 0);
|
||||
root.addChildAt(c1, 1);
|
||||
c0.addChildAt(c0c0, 0);
|
||||
@@ -58,12 +58,12 @@ public class LayoutCachingTest {
|
||||
@Test
|
||||
public void testInvalidatesCacheWhenChildAdded() {
|
||||
CSSLayoutContext layoutContext = new CSSLayoutContext();
|
||||
CSSNode root = new CSSNode();
|
||||
CSSNode c0 = new CSSNode();
|
||||
CSSNode c1 = new CSSNode();
|
||||
CSSNode c0c0 = new CSSNode();
|
||||
CSSNode c0c1 = new CSSNode();
|
||||
CSSNode c1c0 = new CSSNode();
|
||||
CSSNodeDEPRECATED root = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c1 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0c0 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0c1 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c1c0 = new CSSNodeDEPRECATED();
|
||||
c0c1.setStyleWidth(200);
|
||||
c0c1.setStyleHeight(200);
|
||||
root.addChildAt(c0, 0);
|
||||
@@ -90,10 +90,10 @@ public class LayoutCachingTest {
|
||||
@Test
|
||||
public void testInvalidatesCacheWhenEnumPropertyChanges() {
|
||||
CSSLayoutContext layoutContext = new CSSLayoutContext();
|
||||
CSSNode root = new CSSNode();
|
||||
CSSNode c0 = new CSSNode();
|
||||
CSSNode c1 = new CSSNode();
|
||||
CSSNode c0c0 = new CSSNode();
|
||||
CSSNodeDEPRECATED root = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c1 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0c0 = new CSSNodeDEPRECATED();
|
||||
root.addChildAt(c0, 0);
|
||||
root.addChildAt(c1, 1);
|
||||
c0.addChildAt(c0c0, 0);
|
||||
@@ -114,10 +114,10 @@ public class LayoutCachingTest {
|
||||
@Test
|
||||
public void testInvalidatesCacheWhenFloatPropertyChanges() {
|
||||
CSSLayoutContext layoutContext = new CSSLayoutContext();
|
||||
CSSNode root = new CSSNode();
|
||||
CSSNode c0 = new CSSNode();
|
||||
CSSNode c1 = new CSSNode();
|
||||
CSSNode c0c0 = new CSSNode();
|
||||
CSSNodeDEPRECATED root = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c1 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0c0 = new CSSNodeDEPRECATED();
|
||||
root.addChildAt(c0, 0);
|
||||
root.addChildAt(c1, 1);
|
||||
c0.addChildAt(c0c0, 0);
|
||||
@@ -138,11 +138,11 @@ public class LayoutCachingTest {
|
||||
@Test
|
||||
public void testInvalidatesFullTreeWhenParentWidthChanges() {
|
||||
CSSLayoutContext layoutContext = new CSSLayoutContext();
|
||||
CSSNode root = new CSSNode();
|
||||
CSSNode c0 = new CSSNode();
|
||||
CSSNode c1 = new CSSNode();
|
||||
CSSNode c0c0 = new CSSNode();
|
||||
CSSNode c1c0 = new CSSNode();
|
||||
CSSNodeDEPRECATED root = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c1 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0c0 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c1c0 = new CSSNodeDEPRECATED();
|
||||
root.addChildAt(c0, 0);
|
||||
root.addChildAt(c1, 1);
|
||||
c0.addChildAt(c0c0, 0);
|
||||
@@ -165,10 +165,10 @@ public class LayoutCachingTest {
|
||||
@Test
|
||||
public void testDoesNotInvalidateCacheWhenPropertyIsTheSame() {
|
||||
CSSLayoutContext layoutContext = new CSSLayoutContext();
|
||||
CSSNode root = new CSSNode();
|
||||
CSSNode c0 = new CSSNode();
|
||||
CSSNode c1 = new CSSNode();
|
||||
CSSNode c0c0 = new CSSNode();
|
||||
CSSNodeDEPRECATED root = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c1 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0c0 = new CSSNodeDEPRECATED();
|
||||
root.addChildAt(c0, 0);
|
||||
root.addChildAt(c1, 1);
|
||||
c0.addChildAt(c0c0, 0);
|
||||
@@ -188,10 +188,10 @@ public class LayoutCachingTest {
|
||||
@Test
|
||||
public void testInvalidateCacheWhenHeightChangesPosition() {
|
||||
CSSLayoutContext layoutContext = new CSSLayoutContext();
|
||||
CSSNode root = new CSSNode();
|
||||
CSSNode c0 = new CSSNode();
|
||||
CSSNode c1 = new CSSNode();
|
||||
CSSNode c1c0 = new CSSNode();
|
||||
CSSNodeDEPRECATED root = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c1 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c1c0 = new CSSNodeDEPRECATED();
|
||||
root.addChildAt(c0, 0);
|
||||
root.addChildAt(c1, 1);
|
||||
c1.addChildAt(c1c0, 0);
|
||||
@@ -211,10 +211,10 @@ public class LayoutCachingTest {
|
||||
@Test
|
||||
public void testInvalidatesOnNewMeasureFunction() {
|
||||
CSSLayoutContext layoutContext = new CSSLayoutContext();
|
||||
CSSNode root = new CSSNode();
|
||||
CSSNode c0 = new CSSNode();
|
||||
CSSNode c1 = new CSSNode();
|
||||
CSSNode c0c0 = new CSSNode();
|
||||
CSSNodeDEPRECATED root = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c1 = new CSSNodeDEPRECATED();
|
||||
CSSNodeDEPRECATED c0c0 = new CSSNodeDEPRECATED();
|
||||
root.addChildAt(c0, 0);
|
||||
root.addChildAt(c1, 1);
|
||||
c0.addChildAt(c0c0, 0);
|
||||
|
@@ -23,7 +23,7 @@ import static com.facebook.csslayout.CSSLayout.DIMENSION_HEIGHT;
|
||||
public class LayoutEngineTest {
|
||||
|
||||
private static final CSSNodeAPI.MeasureFunction sTestMeasureFunction =
|
||||
new CSSNode.MeasureFunction() {
|
||||
new CSSNodeDEPRECATED.MeasureFunction() {
|
||||
|
||||
@Override
|
||||
public void measure(CSSNodeAPI node, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode, MeasureOutput measureOutput) {
|
||||
@@ -72,7 +72,7 @@ public class LayoutEngineTest {
|
||||
}
|
||||
};
|
||||
|
||||
private static class TestCSSNode extends CSSNode {
|
||||
private static class TestCSSNode extends CSSNodeDEPRECATED {
|
||||
|
||||
public String context = null;
|
||||
|
||||
@@ -81,7 +81,7 @@ public class LayoutEngineTest {
|
||||
}
|
||||
}
|
||||
|
||||
private static void test(String message, CSSNode style, CSSNode expectedLayout) {
|
||||
private static void test(String message, CSSNodeDEPRECATED style, CSSNodeDEPRECATED expectedLayout) {
|
||||
CSSLayoutContext layoutContext = new CSSLayoutContext();
|
||||
style.calculateLayout(layoutContext);
|
||||
assertLayoutsEqual(message, style, expectedLayout);
|
||||
@@ -93,13 +93,13 @@ public class LayoutEngineTest {
|
||||
}
|
||||
}
|
||||
|
||||
private static void assertLayoutsEqual(String message, CSSNode actual, CSSNode expected) {
|
||||
private static void assertLayoutsEqual(String message, CSSNodeDEPRECATED actual, CSSNodeDEPRECATED expected) {
|
||||
Assert.assertTrue(
|
||||
message + "\nActual:\n" + actual.toString() + "\nExpected:\n" + expected.toString(),
|
||||
areLayoutsEqual(actual, expected));
|
||||
}
|
||||
|
||||
private static boolean areLayoutsEqual(CSSNode a, CSSNode b) {
|
||||
private static boolean areLayoutsEqual(CSSNodeDEPRECATED a, CSSNodeDEPRECATED b) {
|
||||
boolean doNodesHaveSameLayout =
|
||||
areFloatsEqual(a.layout.position[POSITION_LEFT], b.layout.position[POSITION_LEFT]) &&
|
||||
areFloatsEqual(a.layout.position[POSITION_TOP], b.layout.position[POSITION_TOP]) &&
|
||||
|
Reference in New Issue
Block a user