Remove deprecated java code
Summary: Remove deprecated java code and make use of CSSEdge instead of the now removed Spacing class. Reviewed By: AaaChiuuu Differential Revision: D4233198 fbshipit-source-id: 736d79be266e1b9f2d62e5fe6d901de47123cdc1
This commit is contained in:
committed by
Facebook Github Bot
parent
5fa42cd1b0
commit
b32b6029de
@@ -93,12 +93,12 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
CSSDirectionLTR:{value:'CSSDirection.LTR'},
|
CSSDirectionLTR:{value:'CSSDirection.LTR'},
|
||||||
CSSDirectionRTL:{value:'CSSDirection.RTL'},
|
CSSDirectionRTL:{value:'CSSDirection.RTL'},
|
||||||
|
|
||||||
CSSEdgeBottom:{value:'Spacing.BOTTOM'},
|
CSSEdgeBottom:{value:'CSSEdge.BOTTOM'},
|
||||||
CSSEdgeEnd:{value:'Spacing.END'},
|
CSSEdgeEnd:{value:'CSSEdge.END'},
|
||||||
CSSEdgeLeft:{value:'Spacing.LEFT'},
|
CSSEdgeLeft:{value:'CSSEdge.LEFT'},
|
||||||
CSSEdgeRight:{value:'Spacing.RIGHT'},
|
CSSEdgeRight:{value:'CSSEdge.RIGHT'},
|
||||||
CSSEdgeStart:{value:'Spacing.START'},
|
CSSEdgeStart:{value:'CSSEdge.START'},
|
||||||
CSSEdgeTop:{value:'Spacing.TOP'},
|
CSSEdgeTop:{value:'CSSEdge.TOP'},
|
||||||
|
|
||||||
CSSFlexDirectionColumn:{value:'CSSFlexDirection.COLUMN'},
|
CSSFlexDirectionColumn:{value:'CSSFlexDirection.COLUMN'},
|
||||||
CSSFlexDirectionColumnReverse:{value:'CSSFlexDirection.COLUMN_REVERSE'},
|
CSSFlexDirectionColumnReverse:{value:'CSSFlexDirection.COLUMN_REVERSE'},
|
||||||
@@ -124,7 +124,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
|
|
||||||
CSSNodeCalculateLayout:{value:function(node, dir) {
|
CSSNodeCalculateLayout:{value:function(node, dir) {
|
||||||
this.push(node + '.setDirection(' + dir + ');');
|
this.push(node + '.setDirection(' + dir + ');');
|
||||||
this.push(node + '.calculateLayout(null);');
|
this.push(node + '.calculateLayout();');
|
||||||
}},
|
}},
|
||||||
|
|
||||||
CSSNodeInsertChild:{value:function(parentName, nodeName, index) {
|
CSSNodeInsertChild:{value:function(parentName, nodeName, index) {
|
||||||
|
@@ -1,20 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014-present, Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD-style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.facebook.csslayout;
|
|
||||||
|
|
||||||
public class CSSCachedMeasurement {
|
|
||||||
public float availableWidth;
|
|
||||||
public float availableHeight;
|
|
||||||
public CSSMeasureMode widthMeasureMode = null;
|
|
||||||
public CSSMeasureMode heightMeasureMode = null;
|
|
||||||
|
|
||||||
public float computedWidth;
|
|
||||||
public float computedHeight;
|
|
||||||
}
|
|
@@ -1,77 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014-present, Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD-style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.facebook.csslayout;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Where the output of {@link LayoutEngine#layoutNode(CSSNodeDEPRECATED, float)} will go in the CSSNodeDEPRECATED.
|
|
||||||
*/
|
|
||||||
public class CSSLayout {
|
|
||||||
// This value was chosen based on empiracle data. Even the most complicated
|
|
||||||
// layouts should not require more than 16 entries to fit within the cache.
|
|
||||||
public static final int MAX_CACHED_RESULT_COUNT = 16;
|
|
||||||
|
|
||||||
public static final int POSITION_LEFT = 0;
|
|
||||||
public static final int POSITION_TOP = 1;
|
|
||||||
public static final int POSITION_RIGHT = 2;
|
|
||||||
public static final int POSITION_BOTTOM = 3;
|
|
||||||
|
|
||||||
public static final int DIMENSION_WIDTH = 0;
|
|
||||||
public static final int DIMENSION_HEIGHT = 1;
|
|
||||||
|
|
||||||
public float[] position = new float[4];
|
|
||||||
public float[] dimensions = new float[2];
|
|
||||||
public CSSDirection direction = CSSDirection.LTR;
|
|
||||||
|
|
||||||
public float computedFlexBasis;
|
|
||||||
|
|
||||||
public int generationCount;
|
|
||||||
public CSSDirection lastParentDirection;
|
|
||||||
|
|
||||||
public int nextCachedMeasurementsIndex;
|
|
||||||
public CSSCachedMeasurement[] cachedMeasurements = new CSSCachedMeasurement[MAX_CACHED_RESULT_COUNT];
|
|
||||||
public float[] measuredDimensions = new float[2];
|
|
||||||
|
|
||||||
public CSSCachedMeasurement cachedLayout = new CSSCachedMeasurement();
|
|
||||||
|
|
||||||
CSSLayout() {
|
|
||||||
resetResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resetResult() {
|
|
||||||
Arrays.fill(position, 0);
|
|
||||||
Arrays.fill(dimensions, CSSConstants.UNDEFINED);
|
|
||||||
direction = CSSDirection.LTR;
|
|
||||||
|
|
||||||
computedFlexBasis = CSSConstants.UNDEFINED;
|
|
||||||
|
|
||||||
generationCount = 0;
|
|
||||||
lastParentDirection = null;
|
|
||||||
|
|
||||||
nextCachedMeasurementsIndex = 0;
|
|
||||||
measuredDimensions[DIMENSION_WIDTH] = CSSConstants.UNDEFINED;
|
|
||||||
measuredDimensions[DIMENSION_HEIGHT] = CSSConstants.UNDEFINED;
|
|
||||||
|
|
||||||
cachedLayout.widthMeasureMode = null;
|
|
||||||
cachedLayout.heightMeasureMode = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "layout: {" +
|
|
||||||
"left: " + position[POSITION_LEFT] + ", " +
|
|
||||||
"top: " + position[POSITION_TOP] + ", " +
|
|
||||||
"width: " + dimensions[DIMENSION_WIDTH] + ", " +
|
|
||||||
"height: " + dimensions[DIMENSION_HEIGHT] + ", " +
|
|
||||||
"direction: " + direction +
|
|
||||||
"}";
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014-present, Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD-style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.facebook.csslayout;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A context for holding values local to a given instance of layout computation.
|
|
||||||
*
|
|
||||||
* This is necessary for making layout thread-safe. A separate instance should
|
|
||||||
* be used when {@link CSSNodeDEPRECATED#calculateLayout} is called concurrently on
|
|
||||||
* different node hierarchies.
|
|
||||||
*/
|
|
||||||
public class CSSLayoutContext {
|
|
||||||
/*package*/ final MeasureOutput measureOutput = new MeasureOutput();
|
|
||||||
int currentGenerationCount;
|
|
||||||
}
|
|
@@ -157,7 +157,7 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
|||||||
|
|
||||||
private native void jni_CSSNodeCalculateLayout(long nativePointer);
|
private native void jni_CSSNodeCalculateLayout(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public void calculateLayout(CSSLayoutContext layoutContext) {
|
public void calculateLayout() {
|
||||||
jni_CSSNodeCalculateLayout(mNativePointer);
|
jni_CSSNodeCalculateLayout(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,66 +337,66 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
|||||||
|
|
||||||
private native float jni_CSSNodeStyleGetMargin(long nativePointer, int edge);
|
private native float jni_CSSNodeStyleGetMargin(long nativePointer, int edge);
|
||||||
@Override
|
@Override
|
||||||
public float getMargin(int spacingType) {
|
public float getMargin(CSSEdge edge) {
|
||||||
if (!mHasSetMargin) {
|
if (!mHasSetMargin) {
|
||||||
return spacingType < Spacing.START ? 0 : CSSConstants.UNDEFINED;
|
return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED;
|
||||||
}
|
}
|
||||||
return jni_CSSNodeStyleGetMargin(mNativePointer, spacingType);
|
return jni_CSSNodeStyleGetMargin(mNativePointer, edge.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
private native void jni_CSSNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
||||||
@Override
|
@Override
|
||||||
public void setMargin(int spacingType, float margin) {
|
public void setMargin(CSSEdge edge, float margin) {
|
||||||
mHasSetMargin = true;
|
mHasSetMargin = true;
|
||||||
jni_CSSNodeStyleSetMargin(mNativePointer, spacingType, margin);
|
jni_CSSNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetPadding(long nativePointer, int edge);
|
private native float jni_CSSNodeStyleGetPadding(long nativePointer, int edge);
|
||||||
@Override
|
@Override
|
||||||
public float getPadding(int spacingType) {
|
public float getPadding(CSSEdge edge) {
|
||||||
if (!mHasSetPadding) {
|
if (!mHasSetPadding) {
|
||||||
return spacingType < Spacing.START ? 0 : CSSConstants.UNDEFINED;
|
return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED;
|
||||||
}
|
}
|
||||||
return jni_CSSNodeStyleGetPadding(mNativePointer, spacingType);
|
return jni_CSSNodeStyleGetPadding(mNativePointer, edge.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
private native void jni_CSSNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
||||||
@Override
|
@Override
|
||||||
public void setPadding(int spacingType, float padding) {
|
public void setPadding(CSSEdge edge, float padding) {
|
||||||
mHasSetPadding = true;
|
mHasSetPadding = true;
|
||||||
jni_CSSNodeStyleSetPadding(mNativePointer, spacingType, padding);
|
jni_CSSNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetBorder(long nativePointer, int edge);
|
private native float jni_CSSNodeStyleGetBorder(long nativePointer, int edge);
|
||||||
@Override
|
@Override
|
||||||
public float getBorder(int spacingType) {
|
public float getBorder(CSSEdge edge) {
|
||||||
if (!mHasSetBorder) {
|
if (!mHasSetBorder) {
|
||||||
return spacingType < Spacing.START ? 0 : CSSConstants.UNDEFINED;
|
return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED;
|
||||||
}
|
}
|
||||||
return jni_CSSNodeStyleGetBorder(mNativePointer, spacingType);
|
return jni_CSSNodeStyleGetBorder(mNativePointer, edge.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetBorder(long nativePointer, int edge, float border);
|
private native void jni_CSSNodeStyleSetBorder(long nativePointer, int edge, float border);
|
||||||
@Override
|
@Override
|
||||||
public void setBorder(int spacingType, float border) {
|
public void setBorder(CSSEdge edge, float border) {
|
||||||
mHasSetBorder = true;
|
mHasSetBorder = true;
|
||||||
jni_CSSNodeStyleSetBorder(mNativePointer, spacingType, border);
|
jni_CSSNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetPosition(long nativePointer, int edge);
|
private native float jni_CSSNodeStyleGetPosition(long nativePointer, int edge);
|
||||||
@Override
|
@Override
|
||||||
public float getPosition(int spacingType) {
|
public float getPosition(CSSEdge edge) {
|
||||||
if (!mHasSetPosition) {
|
if (!mHasSetPosition) {
|
||||||
return CSSConstants.UNDEFINED;
|
return CSSConstants.UNDEFINED;
|
||||||
}
|
}
|
||||||
return jni_CSSNodeStyleGetPosition(mNativePointer, spacingType);
|
return jni_CSSNodeStyleGetPosition(mNativePointer, edge.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetPosition(long nativePointer, int edge, float position);
|
private native void jni_CSSNodeStyleSetPosition(long nativePointer, int edge, float position);
|
||||||
@Override
|
@Override
|
||||||
public void setPosition(int spacingType, float position) {
|
public void setPosition(CSSEdge edge, float position) {
|
||||||
mHasSetPosition = true;
|
mHasSetPosition = true;
|
||||||
jni_CSSNodeStyleSetPosition(mNativePointer, spacingType, position);
|
jni_CSSNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetWidth(long nativePointer);
|
private native float jni_CSSNodeStyleGetWidth(long nativePointer);
|
||||||
@@ -537,11 +537,6 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
|||||||
return mMeasureFunction != null;
|
return mMeasureFunction != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean valuesEqual(float f1, float f2) {
|
|
||||||
return FloatUtil.floatsEqual(f1, f2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setData(Object data) {
|
public void setData(Object data) {
|
||||||
mData = data;
|
mData = data;
|
||||||
|
@@ -31,12 +31,11 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
|
|||||||
int indexOf(CSSNodeType child);
|
int indexOf(CSSNodeType child);
|
||||||
void setMeasureFunction(MeasureFunction measureFunction);
|
void setMeasureFunction(MeasureFunction measureFunction);
|
||||||
boolean isMeasureDefined();
|
boolean isMeasureDefined();
|
||||||
void calculateLayout(CSSLayoutContext layoutContext);
|
void calculateLayout();
|
||||||
boolean isDirty();
|
boolean isDirty();
|
||||||
boolean hasNewLayout();
|
boolean hasNewLayout();
|
||||||
void dirty();
|
void dirty();
|
||||||
void markLayoutSeen();
|
void markLayoutSeen();
|
||||||
boolean valuesEqual(float f1, float f2);
|
|
||||||
void copyStyle(CSSNodeType srcNode);
|
void copyStyle(CSSNodeType srcNode);
|
||||||
CSSDirection getStyleDirection();
|
CSSDirection getStyleDirection();
|
||||||
void setDirection(CSSDirection direction);
|
void setDirection(CSSDirection direction);
|
||||||
@@ -60,14 +59,14 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
|
|||||||
void setFlexShrink(float flexShrink);
|
void setFlexShrink(float flexShrink);
|
||||||
float getFlexBasis();
|
float getFlexBasis();
|
||||||
void setFlexBasis(float flexBasis);
|
void setFlexBasis(float flexBasis);
|
||||||
float getMargin(int spacingType);
|
float getMargin(CSSEdge edge);
|
||||||
void setMargin(int spacingType, float margin);
|
void setMargin(CSSEdge edge, float margin);
|
||||||
float getPadding(int spacingType);
|
float getPadding(CSSEdge edge);
|
||||||
void setPadding(int spacingType, float padding);
|
void setPadding(CSSEdge edge, float padding);
|
||||||
float getBorder(int spacingType);
|
float getBorder(CSSEdge edge);
|
||||||
void setBorder(int spacingType, float border);
|
void setBorder(CSSEdge edge, float border);
|
||||||
float getPosition(int spacingType);
|
float getPosition(CSSEdge edge);
|
||||||
void setPosition(int spacingType, float position);
|
void setPosition(CSSEdge edge, float position);
|
||||||
float getWidth();
|
float getWidth();
|
||||||
void setWidth(float width);
|
void setWidth(float width);
|
||||||
float getHeight();
|
float getHeight();
|
||||||
|
@@ -1,626 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014-present, Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD-style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.facebook.csslayout;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import com.facebook.infer.annotation.Assertions;
|
|
||||||
|
|
||||||
import static com.facebook.csslayout.CSSLayout.DIMENSION_HEIGHT;
|
|
||||||
import static com.facebook.csslayout.CSSLayout.DIMENSION_WIDTH;
|
|
||||||
import static com.facebook.csslayout.CSSLayout.POSITION_LEFT;
|
|
||||||
import static com.facebook.csslayout.CSSLayout.POSITION_TOP;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A CSS Node. It has a style object you can manipulate at {@link #style}. After calling
|
|
||||||
* {@link #calculateLayout()}, {@link #layout} will be filled with the results of the layout.
|
|
||||||
*/
|
|
||||||
public class CSSNodeDEPRECATED implements CSSNodeAPI<CSSNodeDEPRECATED> {
|
|
||||||
|
|
||||||
private enum LayoutState {
|
|
||||||
/**
|
|
||||||
* Some property of this node or its children has changes and the current values in
|
|
||||||
* {@link #layout} are not valid.
|
|
||||||
*/
|
|
||||||
DIRTY,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This node has a new layout relative to the last time {@link #markLayoutSeen()} was called.
|
|
||||||
*/
|
|
||||||
HAS_NEW_LAYOUT,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link #layout} is valid for the node's properties and this layout has been marked as
|
|
||||||
* having been seen.
|
|
||||||
*/
|
|
||||||
UP_TO_DATE,
|
|
||||||
}
|
|
||||||
|
|
||||||
// VisibleForTesting
|
|
||||||
final CSSStyle style = new CSSStyle();
|
|
||||||
final CSSLayout layout = new CSSLayout();
|
|
||||||
final CachedCSSLayout lastLayout = new CachedCSSLayout();
|
|
||||||
|
|
||||||
public int lineIndex = 0;
|
|
||||||
|
|
||||||
CSSNodeDEPRECATED nextChild;
|
|
||||||
|
|
||||||
private @Nullable ArrayList<CSSNodeDEPRECATED> mChildren;
|
|
||||||
private @Nullable CSSNodeDEPRECATED mParent;
|
|
||||||
private @Nullable MeasureFunction mMeasureFunction = null;
|
|
||||||
private LayoutState mLayoutState = LayoutState.DIRTY;
|
|
||||||
private Object mData;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getChildCount() {
|
|
||||||
return mChildren == null ? 0 : mChildren.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CSSNodeDEPRECATED getChildAt(int i) {
|
|
||||||
Assertions.assertNotNull(mChildren);
|
|
||||||
return mChildren.get(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addChildAt(CSSNodeDEPRECATED child, int i) {
|
|
||||||
if (child.mParent != null) {
|
|
||||||
throw new IllegalStateException("Child already has a parent, it must be removed first.");
|
|
||||||
}
|
|
||||||
if (mChildren == null) {
|
|
||||||
// 4 is kinda arbitrary, but the default of 10 seems really high for an average View.
|
|
||||||
mChildren = new ArrayList<>(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
mChildren.add(i, child);
|
|
||||||
child.mParent = this;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CSSNodeDEPRECATED removeChildAt(int i) {
|
|
||||||
Assertions.assertNotNull(mChildren);
|
|
||||||
CSSNodeDEPRECATED removed = mChildren.remove(i);
|
|
||||||
removed.mParent = null;
|
|
||||||
dirty();
|
|
||||||
return removed;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @Nullable
|
|
||||||
CSSNodeDEPRECATED getParent() {
|
|
||||||
return mParent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the index of the given child, or -1 if the child doesn't exist in this node.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int indexOf(CSSNodeDEPRECATED child) {
|
|
||||||
Assertions.assertNotNull(mChildren);
|
|
||||||
return mChildren.indexOf(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMeasureFunction(MeasureFunction measureFunction) {
|
|
||||||
if (mMeasureFunction != measureFunction) {
|
|
||||||
mMeasureFunction = measureFunction;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isMeasureDefined() {
|
|
||||||
return mMeasureFunction != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
long measure(float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode) {
|
|
||||||
if (!isMeasureDefined()) {
|
|
||||||
throw new RuntimeException("Measure function isn't defined!");
|
|
||||||
}
|
|
||||||
return Assertions.assertNotNull(mMeasureFunction).measure(this, width, widthMode, height, heightMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Performs the actual layout and saves the results in {@link #layout}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void calculateLayout(CSSLayoutContext layoutContext) {
|
|
||||||
LayoutEngine.layoutNode(layoutContext, this, CSSConstants.UNDEFINED, CSSConstants.UNDEFINED, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* See {@link LayoutState#DIRTY}.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isDirty() {
|
|
||||||
return mLayoutState == LayoutState.DIRTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* See {@link LayoutState#HAS_NEW_LAYOUT}.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean hasNewLayout() {
|
|
||||||
return mLayoutState == LayoutState.HAS_NEW_LAYOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dirty() {
|
|
||||||
if (mLayoutState == LayoutState.DIRTY) {
|
|
||||||
return;
|
|
||||||
} else if (mLayoutState == LayoutState.HAS_NEW_LAYOUT) {
|
|
||||||
throw new IllegalStateException("Previous layout was ignored! markLayoutSeen() never called");
|
|
||||||
}
|
|
||||||
|
|
||||||
mLayoutState = LayoutState.DIRTY;
|
|
||||||
layout.computedFlexBasis = CSSConstants.UNDEFINED;
|
|
||||||
|
|
||||||
if (mParent != null) {
|
|
||||||
mParent.dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void markHasNewLayout() {
|
|
||||||
mLayoutState = LayoutState.HAS_NEW_LAYOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tells the node that the current values in {@link #layout} have been seen. Subsequent calls
|
|
||||||
* to {@link #hasNewLayout()} will return false until this node is laid out with new parameters.
|
|
||||||
* You must call this each time the layout is generated if the node has a new layout.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void markLayoutSeen() {
|
|
||||||
if (!hasNewLayout()) {
|
|
||||||
throw new IllegalStateException("Expected node to have a new layout to be seen!");
|
|
||||||
}
|
|
||||||
|
|
||||||
mLayoutState = LayoutState.UP_TO_DATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void toStringWithIndentation(StringBuilder result, int level) {
|
|
||||||
// Spaces and tabs are dropped by IntelliJ logcat integration, so rely on __ instead.
|
|
||||||
StringBuilder indentation = new StringBuilder();
|
|
||||||
for (int i = 0; i < level; ++i) {
|
|
||||||
indentation.append("__");
|
|
||||||
}
|
|
||||||
|
|
||||||
result.append(indentation.toString());
|
|
||||||
result.append(layout.toString());
|
|
||||||
|
|
||||||
if (getChildCount() == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
result.append(", children: [\n");
|
|
||||||
for (int i = 0; i < getChildCount(); i++) {
|
|
||||||
getChildAt(i).toStringWithIndentation(result, level + 1);
|
|
||||||
result.append("\n");
|
|
||||||
}
|
|
||||||
result.append(indentation + "]");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
this.toStringWithIndentation(sb, 0);
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean valuesEqual(float f1, float f2) {
|
|
||||||
return FloatUtil.floatsEqual(f1, f2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void copyStyle(CSSNodeDEPRECATED srcNode) {
|
|
||||||
throw new UnsupportedOperationException("copyStyle is not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's direction, as defined in the style.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public CSSDirection getStyleDirection() {
|
|
||||||
return style.direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDirection(CSSDirection direction) {
|
|
||||||
if (style.direction != direction) {
|
|
||||||
style.direction = direction;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's flex direction, as defined by style.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public CSSFlexDirection getFlexDirection() {
|
|
||||||
return style.flexDirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexDirection(CSSFlexDirection flexDirection) {
|
|
||||||
if (style.flexDirection != flexDirection) {
|
|
||||||
style.flexDirection = flexDirection;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's justify content, as defined by style.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public CSSJustify getJustifyContent() {
|
|
||||||
return style.justifyContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setJustifyContent(CSSJustify justifyContent) {
|
|
||||||
if (style.justifyContent != justifyContent) {
|
|
||||||
style.justifyContent = justifyContent;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's align items, as defined by style.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public CSSAlign getAlignItems() {
|
|
||||||
return style.alignItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlignItems(CSSAlign alignItems) {
|
|
||||||
if (style.alignItems != alignItems) {
|
|
||||||
style.alignItems = alignItems;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's align items, as defined by style.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public CSSAlign getAlignSelf() {
|
|
||||||
return style.alignSelf;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlignSelf(CSSAlign alignSelf) {
|
|
||||||
if (style.alignSelf != alignSelf) {
|
|
||||||
style.alignSelf = alignSelf;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CSSAlign getAlignContent() {
|
|
||||||
return style.alignContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlignContent(CSSAlign alignContent) {
|
|
||||||
if (style.alignContent != alignContent) {
|
|
||||||
style.alignContent = alignContent;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's position type, as defined by style.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public CSSPositionType getPositionType() {
|
|
||||||
return style.positionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPositionType(CSSPositionType positionType) {
|
|
||||||
if (style.positionType != positionType) {
|
|
||||||
style.positionType = positionType;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWrap(CSSWrap flexWrap) {
|
|
||||||
if (style.flexWrap != flexWrap) {
|
|
||||||
style.flexWrap = flexWrap;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlex(float flex) {
|
|
||||||
if (CSSConstants.isUndefined(flex) || flex == 0) {
|
|
||||||
setFlexGrow(0);
|
|
||||||
setFlexShrink(0);
|
|
||||||
setFlexBasis(CSSConstants.UNDEFINED);
|
|
||||||
} else if (flex > 0) {
|
|
||||||
setFlexGrow(flex);
|
|
||||||
setFlexShrink(0);
|
|
||||||
setFlexBasis(0);
|
|
||||||
} else {
|
|
||||||
setFlexGrow(0);
|
|
||||||
setFlexShrink(-flex);
|
|
||||||
setFlexBasis(CSSConstants.UNDEFINED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getFlexGrow() {
|
|
||||||
return style.flexGrow;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexGrow(float flexGrow) {
|
|
||||||
if (!valuesEqual(style.flexGrow, flexGrow)) {
|
|
||||||
style.flexGrow = flexGrow;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getFlexShrink() {
|
|
||||||
return style.flexShrink;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexShrink(float flexShrink) {
|
|
||||||
if (!valuesEqual(style.flexShrink, flexShrink)) {
|
|
||||||
style.flexShrink = flexShrink;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getFlexBasis() {
|
|
||||||
return style.flexBasis;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexBasis(float flexBasis) {
|
|
||||||
if (!valuesEqual(style.flexBasis, flexBasis)) {
|
|
||||||
style.flexBasis = flexBasis;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's margin, as defined by style + default margin.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public float getMargin(int spacingType) {
|
|
||||||
return style.margin.get(spacingType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMargin(int spacingType, float margin) {
|
|
||||||
if (style.margin.set(spacingType, margin)) {
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's padding, as defined by style + default padding.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public float getPadding(int spacingType) {
|
|
||||||
return style.padding.get(spacingType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPadding(int spacingType, float padding) {
|
|
||||||
if (style.padding.set(spacingType, padding)) {
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's border, as defined by style.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public float getBorder(int spacingType) {
|
|
||||||
return style.border.get(spacingType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBorder(int spacingType, float border) {
|
|
||||||
if (style.border.set(spacingType, border)) {
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's position, as defined by style.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public float getPosition(int spacingType) {
|
|
||||||
return style.position.get(spacingType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPosition(int spacingType, float position) {
|
|
||||||
if (style.position.set(spacingType, position)) {
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's width, as defined in the style.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public float getWidth() {
|
|
||||||
return style.dimensions[DIMENSION_WIDTH];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWidth(float width) {
|
|
||||||
if (!valuesEqual(style.dimensions[DIMENSION_WIDTH], width)) {
|
|
||||||
style.dimensions[DIMENSION_WIDTH] = width;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's height, as defined in the style.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public float getHeight() {
|
|
||||||
return style.dimensions[DIMENSION_HEIGHT];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeight(float height) {
|
|
||||||
if (!valuesEqual(style.dimensions[DIMENSION_HEIGHT], height)) {
|
|
||||||
style.dimensions[DIMENSION_HEIGHT] = height;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's max width, as defined in the style
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public float getMaxWidth() {
|
|
||||||
return style.maxWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxWidth(float maxWidth) {
|
|
||||||
if (!valuesEqual(style.maxWidth, maxWidth)) {
|
|
||||||
style.maxWidth = maxWidth;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's min width, as defined in the style
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public float getMinWidth() {
|
|
||||||
return style.minWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinWidth(float minWidth) {
|
|
||||||
if (!valuesEqual(style.minWidth, minWidth)) {
|
|
||||||
style.minWidth = minWidth;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's max height, as defined in the style
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public float getMaxHeight() {
|
|
||||||
return style.maxHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxHeight(float maxHeight) {
|
|
||||||
if (!valuesEqual(style.maxHeight, maxHeight)) {
|
|
||||||
style.maxHeight = maxHeight;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's min height, as defined in the style
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public float getMinHeight() {
|
|
||||||
return style.minHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinHeight(float minHeight) {
|
|
||||||
if (!valuesEqual(style.minHeight, minHeight)) {
|
|
||||||
style.minHeight = minHeight;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutX() {
|
|
||||||
return layout.position[POSITION_LEFT];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutY() {
|
|
||||||
return layout.position[POSITION_TOP];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutWidth() {
|
|
||||||
return layout.dimensions[DIMENSION_WIDTH];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutHeight() {
|
|
||||||
return layout.dimensions[DIMENSION_HEIGHT];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CSSDirection getLayoutDirection() {
|
|
||||||
return layout.direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this node's overflow property, as defined in the style
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public CSSOverflow getOverflow() {
|
|
||||||
return style.overflow;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setOverflow(CSSOverflow overflow) {
|
|
||||||
if (style.overflow != overflow) {
|
|
||||||
style.overflow = overflow;
|
|
||||||
dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setData(Object data) {
|
|
||||||
mData = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getData() {
|
|
||||||
return mData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets this instance to its default state. This method is meant to be used when
|
|
||||||
* recycling {@link CSSNodeDEPRECATED} instances.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void reset() {
|
|
||||||
if (mParent != null || (mChildren != null && mChildren.size() > 0)) {
|
|
||||||
throw new IllegalStateException("You should not free an attached CSSNodeDEPRECATED");
|
|
||||||
}
|
|
||||||
|
|
||||||
style.reset();
|
|
||||||
layout.resetResult();
|
|
||||||
lineIndex = 0;
|
|
||||||
mLayoutState = LayoutState.DIRTY;
|
|
||||||
mMeasureFunction = null;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,76 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014-present, Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD-style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.facebook.csslayout;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The CSS style definition for a {@link CSSNodeDEPRECATED}.
|
|
||||||
*/
|
|
||||||
public class CSSStyle {
|
|
||||||
|
|
||||||
public CSSDirection direction;
|
|
||||||
public CSSFlexDirection flexDirection;
|
|
||||||
public CSSJustify justifyContent;
|
|
||||||
public CSSAlign alignContent;
|
|
||||||
public CSSAlign alignItems;
|
|
||||||
public CSSAlign alignSelf;
|
|
||||||
public CSSPositionType positionType;
|
|
||||||
public CSSWrap flexWrap;
|
|
||||||
public CSSOverflow overflow;
|
|
||||||
public float flexGrow;
|
|
||||||
public float flexShrink;
|
|
||||||
public float flexBasis;
|
|
||||||
|
|
||||||
public Spacing margin = new Spacing();
|
|
||||||
public Spacing padding = new Spacing();
|
|
||||||
public Spacing border = new Spacing();
|
|
||||||
public Spacing position = new Spacing(CSSConstants.UNDEFINED);
|
|
||||||
|
|
||||||
public float[] dimensions = new float[2];
|
|
||||||
|
|
||||||
public float minWidth = CSSConstants.UNDEFINED;
|
|
||||||
public float minHeight = CSSConstants.UNDEFINED;
|
|
||||||
|
|
||||||
public float maxWidth = CSSConstants.UNDEFINED;
|
|
||||||
public float maxHeight = CSSConstants.UNDEFINED;
|
|
||||||
|
|
||||||
CSSStyle() {
|
|
||||||
reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset() {
|
|
||||||
direction = CSSDirection.INHERIT;
|
|
||||||
flexDirection = CSSFlexDirection.COLUMN;
|
|
||||||
justifyContent = CSSJustify.FLEX_START;
|
|
||||||
alignContent = CSSAlign.FLEX_START;
|
|
||||||
alignItems = CSSAlign.STRETCH;
|
|
||||||
alignSelf = CSSAlign.AUTO;
|
|
||||||
positionType = CSSPositionType.RELATIVE;
|
|
||||||
flexWrap = CSSWrap.NO_WRAP;
|
|
||||||
overflow = CSSOverflow.VISIBLE;
|
|
||||||
flexGrow = 0;
|
|
||||||
flexShrink = 0;
|
|
||||||
flexBasis = CSSConstants.UNDEFINED;
|
|
||||||
|
|
||||||
margin.reset();
|
|
||||||
padding.reset();
|
|
||||||
border.reset();
|
|
||||||
position.reset();
|
|
||||||
|
|
||||||
Arrays.fill(dimensions, CSSConstants.UNDEFINED);
|
|
||||||
|
|
||||||
minWidth = CSSConstants.UNDEFINED;
|
|
||||||
minHeight = CSSConstants.UNDEFINED;
|
|
||||||
|
|
||||||
maxWidth = CSSConstants.UNDEFINED;
|
|
||||||
maxHeight = CSSConstants.UNDEFINED;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,23 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014-present, Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD-style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.facebook.csslayout;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CSSLayout with additional information about the conditions under which it was generated.
|
|
||||||
* {@link #requestedWidth} and {@link #requestedHeight} are the width and height the parent set on
|
|
||||||
* this node before calling layout visited us.
|
|
||||||
*/
|
|
||||||
public class CachedCSSLayout extends CSSLayout {
|
|
||||||
|
|
||||||
public float requestedWidth = CSSConstants.UNDEFINED;
|
|
||||||
public float requestedHeight = CSSConstants.UNDEFINED;
|
|
||||||
public float parentMaxWidth = CSSConstants.UNDEFINED;
|
|
||||||
public float parentMaxHeight = CSSConstants.UNDEFINED;
|
|
||||||
}
|
|
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014-present, Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD-style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.facebook.csslayout;
|
|
||||||
|
|
||||||
public class FloatUtil {
|
|
||||||
|
|
||||||
private static final float EPSILON = .00001f;
|
|
||||||
|
|
||||||
public static boolean floatsEqual(float f1, float f2) {
|
|
||||||
if (Float.isNaN(f1) || Float.isNaN(f2)) {
|
|
||||||
return Float.isNaN(f1) && Float.isNaN(f2);
|
|
||||||
}
|
|
||||||
return Math.abs(f2 - f1) < EPSILON;
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@@ -1,190 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014-present, Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD-style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.facebook.csslayout;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class representing CSS spacing (padding, margin, and borders). This is mostly necessary to
|
|
||||||
* properly implement interactions and updates for properties like margin, marginLeft, and
|
|
||||||
* marginHorizontal.
|
|
||||||
*/
|
|
||||||
public class Spacing {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Spacing type that represents the left direction. E.g. {@code marginLeft}.
|
|
||||||
*/
|
|
||||||
public static final int LEFT = 0;
|
|
||||||
/**
|
|
||||||
* Spacing type that represents the top direction. E.g. {@code marginTop}.
|
|
||||||
*/
|
|
||||||
public static final int TOP = 1;
|
|
||||||
/**
|
|
||||||
* Spacing type that represents the right direction. E.g. {@code marginRight}.
|
|
||||||
*/
|
|
||||||
public static final int RIGHT = 2;
|
|
||||||
/**
|
|
||||||
* Spacing type that represents the bottom direction. E.g. {@code marginBottom}.
|
|
||||||
*/
|
|
||||||
public static final int BOTTOM = 3;
|
|
||||||
/**
|
|
||||||
* Spacing type that represents start direction e.g. left in left-to-right, right in right-to-left.
|
|
||||||
*/
|
|
||||||
public static final int START = 4;
|
|
||||||
/**
|
|
||||||
* Spacing type that represents end direction e.g. right in left-to-right, left in right-to-left.
|
|
||||||
*/
|
|
||||||
public static final int END = 5;
|
|
||||||
/**
|
|
||||||
* Spacing type that represents horizontal direction (left and right). E.g.
|
|
||||||
* {@code marginHorizontal}.
|
|
||||||
*/
|
|
||||||
public static final int HORIZONTAL = 6;
|
|
||||||
/**
|
|
||||||
* Spacing type that represents vertical direction (top and bottom). E.g. {@code marginVertical}.
|
|
||||||
*/
|
|
||||||
public static final int VERTICAL = 7;
|
|
||||||
/**
|
|
||||||
* Spacing type that represents all directions (left, top, right, bottom). E.g. {@code margin}.
|
|
||||||
*/
|
|
||||||
public static final int ALL = 8;
|
|
||||||
|
|
||||||
private static final int[] sFlagsMap = {
|
|
||||||
1, /*LEFT*/
|
|
||||||
2, /*TOP*/
|
|
||||||
4, /*RIGHT*/
|
|
||||||
8, /*BOTTOM*/
|
|
||||||
16, /*START*/
|
|
||||||
32, /*END*/
|
|
||||||
64, /*HORIZONTAL*/
|
|
||||||
128, /*VERTICAL*/
|
|
||||||
256, /*ALL*/
|
|
||||||
};
|
|
||||||
|
|
||||||
private final float[] mSpacing = newFullSpacingArray();
|
|
||||||
private int mValueFlags = 0;
|
|
||||||
private float mDefaultValue;
|
|
||||||
private boolean mHasAliasesSet;
|
|
||||||
|
|
||||||
public Spacing() {
|
|
||||||
this(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Spacing(float defaultValue) {
|
|
||||||
mDefaultValue = defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a spacing value.
|
|
||||||
*
|
|
||||||
* @param spacingType one of {@link #LEFT}, {@link #TOP}, {@link #RIGHT}, {@link #BOTTOM},
|
|
||||||
* {@link #VERTICAL}, {@link #HORIZONTAL}, {@link #ALL}
|
|
||||||
* @param value the value for this direction
|
|
||||||
* @return {@code true} if the spacing has changed, or {@code false} if the same value was already
|
|
||||||
* set
|
|
||||||
*/
|
|
||||||
public boolean set(int spacingType, float value) {
|
|
||||||
if (!FloatUtil.floatsEqual(mSpacing[spacingType], value)) {
|
|
||||||
mSpacing[spacingType] = value;
|
|
||||||
|
|
||||||
if (CSSConstants.isUndefined(value)) {
|
|
||||||
mValueFlags &= ~sFlagsMap[spacingType];
|
|
||||||
} else {
|
|
||||||
mValueFlags |= sFlagsMap[spacingType];
|
|
||||||
}
|
|
||||||
|
|
||||||
mHasAliasesSet =
|
|
||||||
(mValueFlags & sFlagsMap[ALL]) != 0 ||
|
|
||||||
(mValueFlags & sFlagsMap[VERTICAL]) != 0 ||
|
|
||||||
(mValueFlags & sFlagsMap[HORIZONTAL]) != 0;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the spacing for a direction. This takes into account any default values that have been set.
|
|
||||||
*
|
|
||||||
* @param spacingType one of {@link #LEFT}, {@link #TOP}, {@link #RIGHT}, {@link #BOTTOM}
|
|
||||||
*/
|
|
||||||
public float get(int spacingType) {
|
|
||||||
float defaultValue = (spacingType == START || spacingType == END
|
|
||||||
? CSSConstants.UNDEFINED
|
|
||||||
: mDefaultValue);
|
|
||||||
|
|
||||||
if (mValueFlags == 0) {
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((mValueFlags & sFlagsMap[spacingType]) != 0) {
|
|
||||||
return mSpacing[spacingType];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mHasAliasesSet) {
|
|
||||||
int secondType = spacingType == TOP || spacingType == BOTTOM ? VERTICAL : HORIZONTAL;
|
|
||||||
if ((mValueFlags & sFlagsMap[secondType]) != 0) {
|
|
||||||
return mSpacing[secondType];
|
|
||||||
} else if ((mValueFlags & sFlagsMap[ALL]) != 0) {
|
|
||||||
return mSpacing[ALL];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the raw value (that was set using {@link #set(int, float)}), without taking into account
|
|
||||||
* any default values.
|
|
||||||
*
|
|
||||||
* @param spacingType one of {@link #LEFT}, {@link #TOP}, {@link #RIGHT}, {@link #BOTTOM},
|
|
||||||
* {@link #VERTICAL}, {@link #HORIZONTAL}, {@link #ALL}
|
|
||||||
*/
|
|
||||||
public float getRaw(int spacingType) {
|
|
||||||
return mSpacing[spacingType];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets the spacing instance to its default state. This method is meant to be used when
|
|
||||||
* recycling {@link Spacing} instances.
|
|
||||||
*/
|
|
||||||
public void reset() {
|
|
||||||
Arrays.fill(mSpacing, CSSConstants.UNDEFINED);
|
|
||||||
mHasAliasesSet = false;
|
|
||||||
mValueFlags = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Try to get start value and fallback to given type if not defined. This is used privately
|
|
||||||
* by the layout engine as a more efficient way to fetch direction-aware values by
|
|
||||||
* avoid extra method invocations.
|
|
||||||
*/
|
|
||||||
float getWithFallback(int spacingType, int fallbackType) {
|
|
||||||
return
|
|
||||||
(mValueFlags & sFlagsMap[spacingType]) != 0
|
|
||||||
? mSpacing[spacingType]
|
|
||||||
: get(fallbackType);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static float[] newFullSpacingArray() {
|
|
||||||
return new float[] {
|
|
||||||
CSSConstants.UNDEFINED,
|
|
||||||
CSSConstants.UNDEFINED,
|
|
||||||
CSSConstants.UNDEFINED,
|
|
||||||
CSSConstants.UNDEFINED,
|
|
||||||
CSSConstants.UNDEFINED,
|
|
||||||
CSSConstants.UNDEFINED,
|
|
||||||
CSSConstants.UNDEFINED,
|
|
||||||
CSSConstants.UNDEFINED,
|
|
||||||
CSSConstants.UNDEFINED,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@@ -24,13 +24,13 @@ public class CSSLayoutAbsolutePositionTest {
|
|||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
|
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
|
||||||
root_child0.setPosition(Spacing.START, 10f);
|
root_child0.setPosition(CSSEdge.START, 10f);
|
||||||
root_child0.setPosition(Spacing.TOP, 10f);
|
root_child0.setPosition(CSSEdge.TOP, 10f);
|
||||||
root_child0.setWidth(10f);
|
root_child0.setWidth(10f);
|
||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -43,7 +43,7 @@ public class CSSLayoutAbsolutePositionTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -64,13 +64,13 @@ public class CSSLayoutAbsolutePositionTest {
|
|||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
|
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
|
||||||
root_child0.setPosition(Spacing.END, 10f);
|
root_child0.setPosition(CSSEdge.END, 10f);
|
||||||
root_child0.setPosition(Spacing.BOTTOM, 10f);
|
root_child0.setPosition(CSSEdge.BOTTOM, 10f);
|
||||||
root_child0.setWidth(10f);
|
root_child0.setWidth(10f);
|
||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -83,7 +83,7 @@ public class CSSLayoutAbsolutePositionTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -104,13 +104,13 @@ public class CSSLayoutAbsolutePositionTest {
|
|||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
|
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
|
||||||
root_child0.setPosition(Spacing.START, 10f);
|
root_child0.setPosition(CSSEdge.START, 10f);
|
||||||
root_child0.setPosition(Spacing.TOP, 10f);
|
root_child0.setPosition(CSSEdge.TOP, 10f);
|
||||||
root_child0.setPosition(Spacing.END, 10f);
|
root_child0.setPosition(CSSEdge.END, 10f);
|
||||||
root_child0.setPosition(Spacing.BOTTOM, 10f);
|
root_child0.setPosition(CSSEdge.BOTTOM, 10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -123,7 +123,7 @@ public class CSSLayoutAbsolutePositionTest {
|
|||||||
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -144,15 +144,15 @@ public class CSSLayoutAbsolutePositionTest {
|
|||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
|
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
|
||||||
root_child0.setPosition(Spacing.START, 10f);
|
root_child0.setPosition(CSSEdge.START, 10f);
|
||||||
root_child0.setPosition(Spacing.TOP, 10f);
|
root_child0.setPosition(CSSEdge.TOP, 10f);
|
||||||
root_child0.setPosition(Spacing.END, 10f);
|
root_child0.setPosition(CSSEdge.END, 10f);
|
||||||
root_child0.setPosition(Spacing.BOTTOM, 10f);
|
root_child0.setPosition(CSSEdge.BOTTOM, 10f);
|
||||||
root_child0.setWidth(10f);
|
root_child0.setWidth(10f);
|
||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -165,7 +165,7 @@ public class CSSLayoutAbsolutePositionTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -188,8 +188,8 @@ public class CSSLayoutAbsolutePositionTest {
|
|||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
|
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
|
||||||
root_child0.setPosition(Spacing.START, 0f);
|
root_child0.setPosition(CSSEdge.START, 0f);
|
||||||
root_child0.setPosition(Spacing.TOP, 0f);
|
root_child0.setPosition(CSSEdge.TOP, 0f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
final CSSNode root_child0_child0 = new CSSNode();
|
final CSSNode root_child0_child0 = new CSSNode();
|
||||||
@@ -197,7 +197,7 @@ public class CSSLayoutAbsolutePositionTest {
|
|||||||
root_child0_child0.setHeight(100f);
|
root_child0_child0.setHeight(100f);
|
||||||
root_child0.addChildAt(root_child0_child0, 0);
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -215,7 +215,7 @@ public class CSSLayoutAbsolutePositionTest {
|
|||||||
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -236,38 +236,38 @@ public class CSSLayoutAbsolutePositionTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_absolute_layout_within_border() {
|
public void test_absolute_layout_within_border() {
|
||||||
final CSSNode root = new CSSNode();
|
final CSSNode root = new CSSNode();
|
||||||
root.setMargin(Spacing.LEFT, 10f);
|
root.setMargin(CSSEdge.LEFT, 10f);
|
||||||
root.setMargin(Spacing.TOP, 10f);
|
root.setMargin(CSSEdge.TOP, 10f);
|
||||||
root.setMargin(Spacing.RIGHT, 10f);
|
root.setMargin(CSSEdge.RIGHT, 10f);
|
||||||
root.setMargin(Spacing.BOTTOM, 10f);
|
root.setMargin(CSSEdge.BOTTOM, 10f);
|
||||||
root.setPadding(Spacing.LEFT, 10);
|
root.setPadding(CSSEdge.LEFT, 10);
|
||||||
root.setPadding(Spacing.TOP, 10);
|
root.setPadding(CSSEdge.TOP, 10);
|
||||||
root.setPadding(Spacing.RIGHT, 10);
|
root.setPadding(CSSEdge.RIGHT, 10);
|
||||||
root.setPadding(Spacing.BOTTOM, 10);
|
root.setPadding(CSSEdge.BOTTOM, 10);
|
||||||
root.setBorder(Spacing.LEFT, 10f);
|
root.setBorder(CSSEdge.LEFT, 10f);
|
||||||
root.setBorder(Spacing.TOP, 10f);
|
root.setBorder(CSSEdge.TOP, 10f);
|
||||||
root.setBorder(Spacing.RIGHT, 10f);
|
root.setBorder(CSSEdge.RIGHT, 10f);
|
||||||
root.setBorder(Spacing.BOTTOM, 10f);
|
root.setBorder(CSSEdge.BOTTOM, 10f);
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
|
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
|
||||||
root_child0.setPosition(Spacing.LEFT, 0f);
|
root_child0.setPosition(CSSEdge.LEFT, 0f);
|
||||||
root_child0.setPosition(Spacing.TOP, 0f);
|
root_child0.setPosition(CSSEdge.TOP, 0f);
|
||||||
root_child0.setWidth(50f);
|
root_child0.setWidth(50f);
|
||||||
root_child0.setHeight(50f);
|
root_child0.setHeight(50f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
final CSSNode root_child1 = new CSSNode();
|
final CSSNode root_child1 = new CSSNode();
|
||||||
root_child1.setPositionType(CSSPositionType.ABSOLUTE);
|
root_child1.setPositionType(CSSPositionType.ABSOLUTE);
|
||||||
root_child1.setPosition(Spacing.RIGHT, 0f);
|
root_child1.setPosition(CSSEdge.RIGHT, 0f);
|
||||||
root_child1.setPosition(Spacing.BOTTOM, 0f);
|
root_child1.setPosition(CSSEdge.BOTTOM, 0f);
|
||||||
root_child1.setWidth(50f);
|
root_child1.setWidth(50f);
|
||||||
root_child1.setHeight(50f);
|
root_child1.setHeight(50f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(10f, root.getLayoutX(), 0.0f);
|
assertEquals(10f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(10f, root.getLayoutY(), 0.0f);
|
assertEquals(10f, root.getLayoutY(), 0.0f);
|
||||||
@@ -285,7 +285,7 @@ public class CSSLayoutAbsolutePositionTest {
|
|||||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(10f, root.getLayoutX(), 0.0f);
|
assertEquals(10f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(10f, root.getLayoutY(), 0.0f);
|
assertEquals(10f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -48,7 +48,7 @@ public class CSSLayoutAlignContentTest {
|
|||||||
root_child4.setHeight(10f);
|
root_child4.setHeight(10f);
|
||||||
root.addChildAt(root_child4, 4);
|
root.addChildAt(root_child4, 4);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -81,7 +81,7 @@ public class CSSLayoutAlignContentTest {
|
|||||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -147,7 +147,7 @@ public class CSSLayoutAlignContentTest {
|
|||||||
root_child4.setHeight(10f);
|
root_child4.setHeight(10f);
|
||||||
root.addChildAt(root_child4, 4);
|
root.addChildAt(root_child4, 4);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -180,7 +180,7 @@ public class CSSLayoutAlignContentTest {
|
|||||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -246,7 +246,7 @@ public class CSSLayoutAlignContentTest {
|
|||||||
root_child4.setHeight(10f);
|
root_child4.setHeight(10f);
|
||||||
root.addChildAt(root_child4, 4);
|
root.addChildAt(root_child4, 4);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -279,7 +279,7 @@ public class CSSLayoutAlignContentTest {
|
|||||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -340,7 +340,7 @@ public class CSSLayoutAlignContentTest {
|
|||||||
root_child4.setWidth(50f);
|
root_child4.setWidth(50f);
|
||||||
root.addChildAt(root_child4, 4);
|
root.addChildAt(root_child4, 4);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -373,7 +373,7 @@ public class CSSLayoutAlignContentTest {
|
|||||||
assertEquals(0f, root_child4.getLayoutHeight(), 0.0f);
|
assertEquals(0f, root_child4.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -26,7 +26,7 @@ public class CSSLayoutAlignItemsTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -39,7 +39,7 @@ public class CSSLayoutAlignItemsTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -64,7 +64,7 @@ public class CSSLayoutAlignItemsTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -77,7 +77,7 @@ public class CSSLayoutAlignItemsTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -102,7 +102,7 @@ public class CSSLayoutAlignItemsTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -115,7 +115,7 @@ public class CSSLayoutAlignItemsTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -140,7 +140,7 @@ public class CSSLayoutAlignItemsTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -153,7 +153,7 @@ public class CSSLayoutAlignItemsTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -28,7 +28,7 @@ public class CSSLayoutAlignSelfTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -41,7 +41,7 @@ public class CSSLayoutAlignSelfTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -66,7 +66,7 @@ public class CSSLayoutAlignSelfTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -79,7 +79,7 @@ public class CSSLayoutAlignSelfTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -104,7 +104,7 @@ public class CSSLayoutAlignSelfTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -117,7 +117,7 @@ public class CSSLayoutAlignSelfTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -143,7 +143,7 @@ public class CSSLayoutAlignSelfTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -156,7 +156,7 @@ public class CSSLayoutAlignSelfTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -19,12 +19,12 @@ public class CSSLayoutBorderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_border_no_size() {
|
public void test_border_no_size() {
|
||||||
final CSSNode root = new CSSNode();
|
final CSSNode root = new CSSNode();
|
||||||
root.setBorder(Spacing.LEFT, 10f);
|
root.setBorder(CSSEdge.LEFT, 10f);
|
||||||
root.setBorder(Spacing.TOP, 10f);
|
root.setBorder(CSSEdge.TOP, 10f);
|
||||||
root.setBorder(Spacing.RIGHT, 10f);
|
root.setBorder(CSSEdge.RIGHT, 10f);
|
||||||
root.setBorder(Spacing.BOTTOM, 10f);
|
root.setBorder(CSSEdge.BOTTOM, 10f);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -32,7 +32,7 @@ public class CSSLayoutBorderTest {
|
|||||||
assertEquals(20f, root.getLayoutHeight(), 0.0f);
|
assertEquals(20f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -43,17 +43,17 @@ public class CSSLayoutBorderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_border_container_match_child() {
|
public void test_border_container_match_child() {
|
||||||
final CSSNode root = new CSSNode();
|
final CSSNode root = new CSSNode();
|
||||||
root.setBorder(Spacing.LEFT, 10f);
|
root.setBorder(CSSEdge.LEFT, 10f);
|
||||||
root.setBorder(Spacing.TOP, 10f);
|
root.setBorder(CSSEdge.TOP, 10f);
|
||||||
root.setBorder(Spacing.RIGHT, 10f);
|
root.setBorder(CSSEdge.RIGHT, 10f);
|
||||||
root.setBorder(Spacing.BOTTOM, 10f);
|
root.setBorder(CSSEdge.BOTTOM, 10f);
|
||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setWidth(10f);
|
root_child0.setWidth(10f);
|
||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -66,7 +66,7 @@ public class CSSLayoutBorderTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -82,10 +82,10 @@ public class CSSLayoutBorderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_border_flex_child() {
|
public void test_border_flex_child() {
|
||||||
final CSSNode root = new CSSNode();
|
final CSSNode root = new CSSNode();
|
||||||
root.setBorder(Spacing.LEFT, 10f);
|
root.setBorder(CSSEdge.LEFT, 10f);
|
||||||
root.setBorder(Spacing.TOP, 10f);
|
root.setBorder(CSSEdge.TOP, 10f);
|
||||||
root.setBorder(Spacing.RIGHT, 10f);
|
root.setBorder(CSSEdge.RIGHT, 10f);
|
||||||
root.setBorder(Spacing.BOTTOM, 10f);
|
root.setBorder(CSSEdge.BOTTOM, 10f);
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ public class CSSLayoutBorderTest {
|
|||||||
root_child0.setWidth(10f);
|
root_child0.setWidth(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -107,7 +107,7 @@ public class CSSLayoutBorderTest {
|
|||||||
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -123,10 +123,10 @@ public class CSSLayoutBorderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_border_stretch_child() {
|
public void test_border_stretch_child() {
|
||||||
final CSSNode root = new CSSNode();
|
final CSSNode root = new CSSNode();
|
||||||
root.setBorder(Spacing.LEFT, 10f);
|
root.setBorder(CSSEdge.LEFT, 10f);
|
||||||
root.setBorder(Spacing.TOP, 10f);
|
root.setBorder(CSSEdge.TOP, 10f);
|
||||||
root.setBorder(Spacing.RIGHT, 10f);
|
root.setBorder(CSSEdge.RIGHT, 10f);
|
||||||
root.setBorder(Spacing.BOTTOM, 10f);
|
root.setBorder(CSSEdge.BOTTOM, 10f);
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ public class CSSLayoutBorderTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -147,7 +147,7 @@ public class CSSLayoutBorderTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -165,9 +165,9 @@ public class CSSLayoutBorderTest {
|
|||||||
final CSSNode root = new CSSNode();
|
final CSSNode root = new CSSNode();
|
||||||
root.setJustifyContent(CSSJustify.CENTER);
|
root.setJustifyContent(CSSJustify.CENTER);
|
||||||
root.setAlignItems(CSSAlign.CENTER);
|
root.setAlignItems(CSSAlign.CENTER);
|
||||||
root.setBorder(Spacing.START, 10f);
|
root.setBorder(CSSEdge.START, 10f);
|
||||||
root.setBorder(Spacing.END, 20f);
|
root.setBorder(CSSEdge.END, 20f);
|
||||||
root.setBorder(Spacing.BOTTOM, 20f);
|
root.setBorder(CSSEdge.BOTTOM, 20f);
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ public class CSSLayoutBorderTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -189,7 +189,7 @@ public class CSSLayoutBorderTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -33,7 +33,7 @@ public class CSSLayoutFlexDirectionTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -56,7 +56,7 @@ public class CSSLayoutFlexDirectionTest {
|
|||||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -97,7 +97,7 @@ public class CSSLayoutFlexDirectionTest {
|
|||||||
root_child2.setWidth(10f);
|
root_child2.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -120,7 +120,7 @@ public class CSSLayoutFlexDirectionTest {
|
|||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -161,7 +161,7 @@ public class CSSLayoutFlexDirectionTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -184,7 +184,7 @@ public class CSSLayoutFlexDirectionTest {
|
|||||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -226,7 +226,7 @@ public class CSSLayoutFlexDirectionTest {
|
|||||||
root_child2.setWidth(10f);
|
root_child2.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -249,7 +249,7 @@ public class CSSLayoutFlexDirectionTest {
|
|||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -291,7 +291,7 @@ public class CSSLayoutFlexDirectionTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -314,7 +314,7 @@ public class CSSLayoutFlexDirectionTest {
|
|||||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -356,7 +356,7 @@ public class CSSLayoutFlexDirectionTest {
|
|||||||
root_child2.setWidth(10f);
|
root_child2.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -379,7 +379,7 @@ public class CSSLayoutFlexDirectionTest {
|
|||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -31,7 +31,7 @@ public class CSSLayoutFlexTest {
|
|||||||
root_child1.setFlexGrow(1f);
|
root_child1.setFlexGrow(1f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -49,7 +49,7 @@ public class CSSLayoutFlexTest {
|
|||||||
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -83,7 +83,7 @@ public class CSSLayoutFlexTest {
|
|||||||
root_child1.setFlexGrow(1f);
|
root_child1.setFlexGrow(1f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -101,7 +101,7 @@ public class CSSLayoutFlexTest {
|
|||||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -134,7 +134,7 @@ public class CSSLayoutFlexTest {
|
|||||||
root_child1.setFlexBasis(50f);
|
root_child1.setFlexBasis(50f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -152,7 +152,7 @@ public class CSSLayoutFlexTest {
|
|||||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -186,7 +186,7 @@ public class CSSLayoutFlexTest {
|
|||||||
root_child1.setFlexBasis(50f);
|
root_child1.setFlexBasis(50f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -204,7 +204,7 @@ public class CSSLayoutFlexTest {
|
|||||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -243,7 +243,7 @@ public class CSSLayoutFlexTest {
|
|||||||
root_child2.setHeight(50f);
|
root_child2.setHeight(50f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -266,7 +266,7 @@ public class CSSLayoutFlexTest {
|
|||||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -311,7 +311,7 @@ public class CSSLayoutFlexTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -334,7 +334,7 @@ public class CSSLayoutFlexTest {
|
|||||||
assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -371,7 +371,7 @@ public class CSSLayoutFlexTest {
|
|||||||
root_child0_child0.setFlexShrink(1f);
|
root_child0_child0.setFlexShrink(1f);
|
||||||
root_child0.addChildAt(root_child0_child0, 0);
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -389,7 +389,7 @@ public class CSSLayoutFlexTest {
|
|||||||
assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -42,7 +42,7 @@ public class CSSLayoutFlexWrapTest {
|
|||||||
root_child3.setHeight(30f);
|
root_child3.setHeight(30f);
|
||||||
root.addChildAt(root_child3, 3);
|
root.addChildAt(root_child3, 3);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -70,7 +70,7 @@ public class CSSLayoutFlexWrapTest {
|
|||||||
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
|
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -125,7 +125,7 @@ public class CSSLayoutFlexWrapTest {
|
|||||||
root_child3.setHeight(30f);
|
root_child3.setHeight(30f);
|
||||||
root.addChildAt(root_child3, 3);
|
root.addChildAt(root_child3, 3);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -153,7 +153,7 @@ public class CSSLayoutFlexWrapTest {
|
|||||||
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
|
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -209,7 +209,7 @@ public class CSSLayoutFlexWrapTest {
|
|||||||
root_child3.setHeight(30f);
|
root_child3.setHeight(30f);
|
||||||
root.addChildAt(root_child3, 3);
|
root.addChildAt(root_child3, 3);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -237,7 +237,7 @@ public class CSSLayoutFlexWrapTest {
|
|||||||
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
|
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -293,7 +293,7 @@ public class CSSLayoutFlexWrapTest {
|
|||||||
root_child3.setHeight(30f);
|
root_child3.setHeight(30f);
|
||||||
root.addChildAt(root_child3, 3);
|
root.addChildAt(root_child3, 3);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -321,7 +321,7 @@ public class CSSLayoutFlexWrapTest {
|
|||||||
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
|
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -35,7 +35,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
root_child2.setWidth(10f);
|
root_child2.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -58,7 +58,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -101,7 +101,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
root_child2.setWidth(10f);
|
root_child2.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -124,7 +124,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -167,7 +167,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
root_child2.setWidth(10f);
|
root_child2.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -190,7 +190,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -233,7 +233,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
root_child2.setWidth(10f);
|
root_child2.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -256,7 +256,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -299,7 +299,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
root_child2.setWidth(10f);
|
root_child2.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -322,7 +322,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -362,7 +362,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -385,7 +385,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -427,7 +427,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -450,7 +450,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -492,7 +492,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -515,7 +515,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -557,7 +557,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -580,7 +580,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -622,7 +622,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -645,7 +645,7 @@ public class CSSLayoutJustifyContentTest {
|
|||||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -24,11 +24,11 @@ public class CSSLayoutMarginTest {
|
|||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setMargin(Spacing.START, 10f);
|
root_child0.setMargin(CSSEdge.START, 10f);
|
||||||
root_child0.setWidth(10f);
|
root_child0.setWidth(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -41,7 +41,7 @@ public class CSSLayoutMarginTest {
|
|||||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -61,11 +61,11 @@ public class CSSLayoutMarginTest {
|
|||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setMargin(Spacing.TOP, 10f);
|
root_child0.setMargin(CSSEdge.TOP, 10f);
|
||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -78,7 +78,7 @@ public class CSSLayoutMarginTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -100,11 +100,11 @@ public class CSSLayoutMarginTest {
|
|||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setMargin(Spacing.END, 10f);
|
root_child0.setMargin(CSSEdge.END, 10f);
|
||||||
root_child0.setWidth(10f);
|
root_child0.setWidth(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -117,7 +117,7 @@ public class CSSLayoutMarginTest {
|
|||||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -138,11 +138,11 @@ public class CSSLayoutMarginTest {
|
|||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setMargin(Spacing.BOTTOM, 10f);
|
root_child0.setMargin(CSSEdge.BOTTOM, 10f);
|
||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -155,7 +155,7 @@ public class CSSLayoutMarginTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -177,10 +177,10 @@ public class CSSLayoutMarginTest {
|
|||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setFlexGrow(1f);
|
root_child0.setFlexGrow(1f);
|
||||||
root_child0.setMargin(Spacing.START, 10f);
|
root_child0.setMargin(CSSEdge.START, 10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -193,7 +193,7 @@ public class CSSLayoutMarginTest {
|
|||||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -214,10 +214,10 @@ public class CSSLayoutMarginTest {
|
|||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setFlexGrow(1f);
|
root_child0.setFlexGrow(1f);
|
||||||
root_child0.setMargin(Spacing.TOP, 10f);
|
root_child0.setMargin(CSSEdge.TOP, 10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -230,7 +230,7 @@ public class CSSLayoutMarginTest {
|
|||||||
assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -252,10 +252,10 @@ public class CSSLayoutMarginTest {
|
|||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setFlexGrow(1f);
|
root_child0.setFlexGrow(1f);
|
||||||
root_child0.setMargin(Spacing.TOP, 10f);
|
root_child0.setMargin(CSSEdge.TOP, 10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -268,7 +268,7 @@ public class CSSLayoutMarginTest {
|
|||||||
assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -289,10 +289,10 @@ public class CSSLayoutMarginTest {
|
|||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setFlexGrow(1f);
|
root_child0.setFlexGrow(1f);
|
||||||
root_child0.setMargin(Spacing.START, 10f);
|
root_child0.setMargin(CSSEdge.START, 10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -305,7 +305,7 @@ public class CSSLayoutMarginTest {
|
|||||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -333,7 +333,7 @@ public class CSSLayoutMarginTest {
|
|||||||
root_child1.setFlexGrow(1f);
|
root_child1.setFlexGrow(1f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -351,7 +351,7 @@ public class CSSLayoutMarginTest {
|
|||||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -383,7 +383,7 @@ public class CSSLayoutMarginTest {
|
|||||||
root_child1.setFlexGrow(1f);
|
root_child1.setFlexGrow(1f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -401,7 +401,7 @@ public class CSSLayoutMarginTest {
|
|||||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -27,7 +27,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -40,7 +40,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -65,7 +65,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
root_child0.setMaxHeight(50f);
|
root_child0.setMaxHeight(50f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -78,7 +78,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -106,7 +106,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
root_child1.setFlexGrow(1f);
|
root_child1.setFlexGrow(1f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -124,7 +124,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -158,7 +158,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
root_child1.setFlexGrow(1f);
|
root_child1.setFlexGrow(1f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -176,7 +176,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -207,7 +207,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
root_child0.setHeight(60f);
|
root_child0.setHeight(60f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -220,7 +220,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -246,7 +246,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
root_child0.setHeight(60f);
|
root_child0.setHeight(60f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -259,7 +259,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -294,7 +294,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
root_child2.setHeight(50f);
|
root_child2.setHeight(50f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -317,7 +317,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -356,7 +356,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
root_child0_child0.setHeight(20f);
|
root_child0_child0.setHeight(20f);
|
||||||
root_child0.addChildAt(root_child0_child0, 0);
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -374,7 +374,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -408,7 +408,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
root_child0_child0.setHeight(20f);
|
root_child0_child0.setHeight(20f);
|
||||||
root_child0.addChildAt(root_child0_child0, 0);
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -426,7 +426,7 @@ public class CSSLayoutMinMaxDimensionTest {
|
|||||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -19,12 +19,12 @@ public class CSSLayoutPaddingTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_padding_no_size() {
|
public void test_padding_no_size() {
|
||||||
final CSSNode root = new CSSNode();
|
final CSSNode root = new CSSNode();
|
||||||
root.setPadding(Spacing.LEFT, 10);
|
root.setPadding(CSSEdge.LEFT, 10);
|
||||||
root.setPadding(Spacing.TOP, 10);
|
root.setPadding(CSSEdge.TOP, 10);
|
||||||
root.setPadding(Spacing.RIGHT, 10);
|
root.setPadding(CSSEdge.RIGHT, 10);
|
||||||
root.setPadding(Spacing.BOTTOM, 10);
|
root.setPadding(CSSEdge.BOTTOM, 10);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -32,7 +32,7 @@ public class CSSLayoutPaddingTest {
|
|||||||
assertEquals(20f, root.getLayoutHeight(), 0.0f);
|
assertEquals(20f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -43,17 +43,17 @@ public class CSSLayoutPaddingTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_padding_container_match_child() {
|
public void test_padding_container_match_child() {
|
||||||
final CSSNode root = new CSSNode();
|
final CSSNode root = new CSSNode();
|
||||||
root.setPadding(Spacing.LEFT, 10);
|
root.setPadding(CSSEdge.LEFT, 10);
|
||||||
root.setPadding(Spacing.TOP, 10);
|
root.setPadding(CSSEdge.TOP, 10);
|
||||||
root.setPadding(Spacing.RIGHT, 10);
|
root.setPadding(CSSEdge.RIGHT, 10);
|
||||||
root.setPadding(Spacing.BOTTOM, 10);
|
root.setPadding(CSSEdge.BOTTOM, 10);
|
||||||
|
|
||||||
final CSSNode root_child0 = new CSSNode();
|
final CSSNode root_child0 = new CSSNode();
|
||||||
root_child0.setWidth(10f);
|
root_child0.setWidth(10f);
|
||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -66,7 +66,7 @@ public class CSSLayoutPaddingTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -82,10 +82,10 @@ public class CSSLayoutPaddingTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_padding_flex_child() {
|
public void test_padding_flex_child() {
|
||||||
final CSSNode root = new CSSNode();
|
final CSSNode root = new CSSNode();
|
||||||
root.setPadding(Spacing.LEFT, 10);
|
root.setPadding(CSSEdge.LEFT, 10);
|
||||||
root.setPadding(Spacing.TOP, 10);
|
root.setPadding(CSSEdge.TOP, 10);
|
||||||
root.setPadding(Spacing.RIGHT, 10);
|
root.setPadding(CSSEdge.RIGHT, 10);
|
||||||
root.setPadding(Spacing.BOTTOM, 10);
|
root.setPadding(CSSEdge.BOTTOM, 10);
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ public class CSSLayoutPaddingTest {
|
|||||||
root_child0.setWidth(10f);
|
root_child0.setWidth(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -107,7 +107,7 @@ public class CSSLayoutPaddingTest {
|
|||||||
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -123,10 +123,10 @@ public class CSSLayoutPaddingTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_padding_stretch_child() {
|
public void test_padding_stretch_child() {
|
||||||
final CSSNode root = new CSSNode();
|
final CSSNode root = new CSSNode();
|
||||||
root.setPadding(Spacing.LEFT, 10);
|
root.setPadding(CSSEdge.LEFT, 10);
|
||||||
root.setPadding(Spacing.TOP, 10);
|
root.setPadding(CSSEdge.TOP, 10);
|
||||||
root.setPadding(Spacing.RIGHT, 10);
|
root.setPadding(CSSEdge.RIGHT, 10);
|
||||||
root.setPadding(Spacing.BOTTOM, 10);
|
root.setPadding(CSSEdge.BOTTOM, 10);
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ public class CSSLayoutPaddingTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -147,7 +147,7 @@ public class CSSLayoutPaddingTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -165,9 +165,9 @@ public class CSSLayoutPaddingTest {
|
|||||||
final CSSNode root = new CSSNode();
|
final CSSNode root = new CSSNode();
|
||||||
root.setJustifyContent(CSSJustify.CENTER);
|
root.setJustifyContent(CSSJustify.CENTER);
|
||||||
root.setAlignItems(CSSAlign.CENTER);
|
root.setAlignItems(CSSAlign.CENTER);
|
||||||
root.setPadding(Spacing.START, 10);
|
root.setPadding(CSSEdge.START, 10);
|
||||||
root.setPadding(Spacing.END, 20);
|
root.setPadding(CSSEdge.END, 20);
|
||||||
root.setPadding(Spacing.BOTTOM, 20);
|
root.setPadding(CSSEdge.BOTTOM, 20);
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ public class CSSLayoutPaddingTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -189,7 +189,7 @@ public class CSSLayoutPaddingTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -37,7 +37,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
root_child2.setFlexGrow(1f);
|
root_child2.setFlexGrow(1f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -60,7 +60,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -114,7 +114,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
root_child4.setFlexGrow(1f);
|
root_child4.setFlexGrow(1f);
|
||||||
root.addChildAt(root_child4, 4);
|
root.addChildAt(root_child4, 4);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -147,7 +147,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -204,7 +204,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
root_child2.setFlexBasis(25f);
|
root_child2.setFlexBasis(25f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -227,7 +227,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -276,7 +276,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -299,7 +299,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -348,7 +348,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
root_child2.setHeight(10.7f);
|
root_child2.setHeight(10.7f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -371,7 +371,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -413,14 +413,14 @@ public class CSSLayoutRoundingTest {
|
|||||||
final CSSNode root_child0_child0 = new CSSNode();
|
final CSSNode root_child0_child0 = new CSSNode();
|
||||||
root_child0_child0.setFlexGrow(1f);
|
root_child0_child0.setFlexGrow(1f);
|
||||||
root_child0_child0.setFlexBasis(0.3f);
|
root_child0_child0.setFlexBasis(0.3f);
|
||||||
root_child0_child0.setPosition(Spacing.BOTTOM, 13.3f);
|
root_child0_child0.setPosition(CSSEdge.BOTTOM, 13.3f);
|
||||||
root_child0_child0.setHeight(9.9f);
|
root_child0_child0.setHeight(9.9f);
|
||||||
root_child0.addChildAt(root_child0_child0, 0);
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
|
|
||||||
final CSSNode root_child0_child1 = new CSSNode();
|
final CSSNode root_child0_child1 = new CSSNode();
|
||||||
root_child0_child1.setFlexGrow(4f);
|
root_child0_child1.setFlexGrow(4f);
|
||||||
root_child0_child1.setFlexBasis(0.3f);
|
root_child0_child1.setFlexBasis(0.3f);
|
||||||
root_child0_child1.setPosition(Spacing.TOP, 13.3f);
|
root_child0_child1.setPosition(CSSEdge.TOP, 13.3f);
|
||||||
root_child0_child1.setHeight(1.1f);
|
root_child0_child1.setHeight(1.1f);
|
||||||
root_child0.addChildAt(root_child0_child1, 1);
|
root_child0.addChildAt(root_child0_child1, 1);
|
||||||
|
|
||||||
@@ -434,7 +434,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
root_child2.setHeight(10.7f);
|
root_child2.setHeight(10.7f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -467,7 +467,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -526,7 +526,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -549,7 +549,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -598,7 +598,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -621,7 +621,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -651,7 +651,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
|
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
|
||||||
|
|
||||||
final CSSNode root = new CSSNode();
|
final CSSNode root = new CSSNode();
|
||||||
root.setPosition(Spacing.TOP, 0.3f);
|
root.setPosition(CSSEdge.TOP, 0.3f);
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
root.setHeight(113.4f);
|
root.setHeight(113.4f);
|
||||||
|
|
||||||
@@ -671,7 +671,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -694,7 +694,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -724,7 +724,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
|
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
|
||||||
|
|
||||||
final CSSNode root = new CSSNode();
|
final CSSNode root = new CSSNode();
|
||||||
root.setPosition(Spacing.TOP, 0.7f);
|
root.setPosition(CSSEdge.TOP, 0.7f);
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
root.setHeight(113.4f);
|
root.setHeight(113.4f);
|
||||||
|
|
||||||
@@ -744,7 +744,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(CSSDirection.LTR);
|
root.setDirection(CSSDirection.LTR);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(1f, root.getLayoutY(), 0.0f);
|
assertEquals(1f, root.getLayoutY(), 0.0f);
|
||||||
@@ -767,7 +767,7 @@ public class CSSLayoutRoundingTest {
|
|||||||
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(CSSDirection.RTL);
|
root.setDirection(CSSDirection.RTL);
|
||||||
root.calculateLayout(null);
|
root.calculateLayout();
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(1f, root.getLayoutY(), 0.0f);
|
assertEquals(1f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -36,7 +36,7 @@ public class CSSNodeTest {
|
|||||||
return MeasureOutput.make(100, 100);
|
return MeasureOutput.make(100, 100);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
node.calculateLayout(null);
|
node.calculateLayout();
|
||||||
assertEquals(100, (int) node.getLayoutWidth());
|
assertEquals(100, (int) node.getLayoutWidth());
|
||||||
assertEquals(100, (int) node.getLayoutHeight());
|
assertEquals(100, (int) node.getLayoutHeight());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user