Rename java API

Summary: Rename java api to new use yoga naming

Reviewed By: IanChilds

Differential Revision: D4265345

fbshipit-source-id: 69ecfd8fac214f86b8b70647b9b909acd83d78b5
This commit is contained in:
Emil Sjolander
2016-12-03 04:40:23 -08:00
committed by Facebook Github Bot
parent 6339467b6d
commit c6100d0771
22 changed files with 366 additions and 352 deletions

View File

@@ -46,21 +46,21 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
if (experiments.length > 0) { if (experiments.length > 0) {
for (var i in experiments) { for (var i in experiments) {
this.push('CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.' + toJavaUpper(experiments[i]) +', true);'); this.push('YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.' + toJavaUpper(experiments[i]) +', true);');
} }
this.push(''); this.push('');
} }
}}, }},
emitTestTreePrologue:{value:function(nodeName) { emitTestTreePrologue:{value:function(nodeName) {
this.push('final CSSNode ' + nodeName + ' = new CSSNode();'); this.push('final YogaNode ' + nodeName + ' = new YogaNode();');
}}, }},
emitTestEpilogue:{value:function(experiments) { emitTestEpilogue:{value:function(experiments) {
if (experiments.length > 0) { if (experiments.length > 0) {
this.push(''); this.push('');
for (var i in experiments) { for (var i in experiments) {
this.push('CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.' + toJavaUpper(experiments[i]) +', false);'); this.push('YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.' + toJavaUpper(experiments[i]) +', false);');
} }
} }

View File

@@ -9,7 +9,7 @@ include_defs('//YOGA_DEFS')
cxx_library( cxx_library(
name = 'jni', name = 'jni',
soname = 'libcsslayout.$(ext)', soname = 'libyoga.$(ext)',
srcs = glob(['jni/*.cpp']), srcs = glob(['jni/*.cpp']),
header_namespace = '', header_namespace = '',
compiler_flags = [ compiler_flags = [

View File

@@ -12,11 +12,11 @@ package com.facebook.csslayout;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
/** /**
* Inteface for recieving logs from native layer. Use by setting CSSNode.setLogger(myLogger); * Inteface for recieving logs from native layer. Use by setting YogaNode.setLogger(myLogger);
* See YogaLogLevel for the different log levels. * See YogaLogLevel for the different log levels.
*/ */
@DoNotStrip @DoNotStrip
public interface CSSLogger { public interface YogaLogger {
@DoNotStrip @DoNotStrip
void log(YogaLogLevel level, String message); void log(YogaLogLevel level, String message);
} }

View File

@@ -0,0 +1,26 @@
/**
* 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 com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip
public interface YogaMeasureFunction {
/**
* Return a value created by YogaMeasureOutput.make(width, height);
*/
@DoNotStrip
long measure(
YogaNodeAPI node,
float width,
YogaMeasureMode widthMode,
float height,
YogaMeasureMode heightMode);
}

View File

@@ -12,7 +12,7 @@ package com.facebook.csslayout;
/** /**
* Helpers for building measure output value. * Helpers for building measure output value.
*/ */
public class MeasureOutput { public class YogaMeasureOutput {
public static long make(float width, float height) { public static long make(float width, float height) {
return make((int) width, (int) height); return make((int) width, (int) height);

View File

@@ -18,10 +18,10 @@ import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.soloader.SoLoader; import com.facebook.soloader.SoLoader;
@DoNotStrip @DoNotStrip
public class CSSNode implements CSSNodeAPI<CSSNode> { public class YogaNode implements YogaNodeAPI<YogaNode> {
static { static {
SoLoader.loadLibrary("csslayout"); SoLoader.loadLibrary("yoga");
} }
/** /**
@@ -31,7 +31,7 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
static native void jni_YGLog(int level, String message); static native void jni_YGLog(int level, String message);
private static native void jni_YGSetLogger(Object logger); private static native void jni_YGSetLogger(Object logger);
public static void setLogger(CSSLogger logger) { public static void setLogger(YogaLogger logger) {
jni_YGSetLogger(logger); jni_YGSetLogger(logger);
} }
@@ -49,9 +49,9 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
return jni_YGIsExperimentalFeatureEnabled(feature.intValue()); return jni_YGIsExperimentalFeatureEnabled(feature.intValue());
} }
private CSSNode mParent; private YogaNode mParent;
private List<CSSNode> mChildren; private List<YogaNode> mChildren;
private MeasureFunction mMeasureFunction; private YogaMeasureFunction mMeasureFunction;
private long mNativePointer; private long mNativePointer;
private Object mData; private Object mData;
@@ -72,7 +72,7 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
private int mLayoutDirection = 0; private int mLayoutDirection = 0;
private native long jni_YGNodeNew(); private native long jni_YGNodeNew();
public CSSNode() { public YogaNode() {
mNativePointer = jni_YGNodeNew(); mNativePointer = jni_YGNodeNew();
if (mNativePointer == 0) { if (mNativePointer == 0) {
throw new IllegalStateException("Failed to allocate native memory"); throw new IllegalStateException("Failed to allocate native memory");
@@ -115,13 +115,13 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
} }
@Override @Override
public CSSNode getChildAt(int i) { public YogaNode getChildAt(int i) {
return mChildren.get(i); return mChildren.get(i);
} }
private native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index); private native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index);
@Override @Override
public void addChildAt(CSSNode child, int i) { public void addChildAt(YogaNode child, int i) {
if (child.mParent != null) { if (child.mParent != null) {
throw new IllegalStateException("Child already has a parent, it must be removed first."); throw new IllegalStateException("Child already has a parent, it must be removed first.");
} }
@@ -136,9 +136,9 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
private native void jni_YGNodeRemoveChild(long nativePointer, long childPointer); private native void jni_YGNodeRemoveChild(long nativePointer, long childPointer);
@Override @Override
public CSSNode removeChildAt(int i) { public YogaNode removeChildAt(int i) {
final CSSNode child = mChildren.remove(i); final YogaNode child = mChildren.remove(i);
child.mParent = null; child.mParent = null;
jni_YGNodeRemoveChild(mNativePointer, child.mNativePointer); jni_YGNodeRemoveChild(mNativePointer, child.mNativePointer);
return child; return child;
@@ -146,12 +146,12 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
@Override @Override
public @Nullable public @Nullable
CSSNode getParent() { YogaNode getParent() {
return mParent; return mParent;
} }
@Override @Override
public int indexOf(CSSNode child) { public int indexOf(YogaNode child) {
return mChildren == null ? -1 : mChildren.indexOf(child); return mChildren == null ? -1 : mChildren.indexOf(child);
} }
@@ -187,7 +187,7 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
private native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer); private native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
@Override @Override
public void copyStyle(CSSNode srcNode) { public void copyStyle(YogaNode srcNode) {
jni_YGNodeCopyStyle(mNativePointer, srcNode.mNativePointer); jni_YGNodeCopyStyle(mNativePointer, srcNode.mNativePointer);
} }
@@ -508,14 +508,14 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
private native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc); private native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
@Override @Override
public void setMeasureFunction(MeasureFunction measureFunction) { public void setMeasureFunction(YogaMeasureFunction measureFunction) {
mMeasureFunction = measureFunction; mMeasureFunction = measureFunction;
jni_YGNodeSetHasMeasureFunc(mNativePointer, measureFunction != null); jni_YGNodeSetHasMeasureFunc(mNativePointer, measureFunction != null);
} }
// Implementation Note: Why this method needs to stay final // Implementation Note: Why this method needs to stay final
// //
// We cache the jmethodid for this method in CSSLayout code. This means that even if a subclass // We cache the jmethodid for this method in Yoga code. This means that even if a subclass
// were to override measure, we'd still call this implementation from layout code since the // were to override measure, we'd still call this implementation from layout code since the
// overriding method will have a different jmethodid. This is final to prevent that mistake. // overriding method will have a different jmethodid. This is final to prevent that mistake.
@DoNotStrip @DoNotStrip

View File

@@ -9,34 +9,22 @@
package com.facebook.csslayout; package com.facebook.csslayout;
public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> { // This only exists for legacy reasons. It will be removed sometime in the near future.
public interface YogaNodeAPI<YogaNodeType extends YogaNodeAPI> {
interface MeasureFunction {
/**
* Return a value created by MeasureOutput.make(width, height);
*/
long measure(
CSSNodeAPI node,
float width,
YogaMeasureMode widthMode,
float height,
YogaMeasureMode heightMode);
}
int getChildCount(); int getChildCount();
CSSNodeType getChildAt(int i); YogaNodeType getChildAt(int i);
void addChildAt(CSSNodeType child, int i); void addChildAt(YogaNodeType child, int i);
CSSNodeType removeChildAt(int i); YogaNodeType removeChildAt(int i);
CSSNodeType getParent(); YogaNodeType getParent();
int indexOf(CSSNodeType child); int indexOf(YogaNodeType child);
void setMeasureFunction(MeasureFunction measureFunction); void setMeasureFunction(YogaMeasureFunction measureFunction);
boolean isMeasureDefined(); boolean isMeasureDefined();
void calculateLayout(); void calculateLayout();
boolean isDirty(); boolean isDirty();
boolean hasNewLayout(); boolean hasNewLayout();
void dirty(); void dirty();
void markLayoutSeen(); void markLayoutSeen();
void copyStyle(CSSNodeType srcNode); void copyStyle(YogaNodeType srcNode);
YogaDirection getStyleDirection(); YogaDirection getStyleDirection();
void setDirection(YogaDirection direction); void setDirection(YogaDirection direction);
YogaFlexDirection getFlexDirection(); YogaFlexDirection getFlexDirection();

View File

@@ -58,7 +58,7 @@ static YGSize YGJNIMeasureFunc(YGNodeRef node,
float height, float height,
YGMeasureMode heightMode) { YGMeasureMode heightMode) {
if (auto obj = YGNodeJobject(node)->lockLocal()) { if (auto obj = YGNodeJobject(node)->lockLocal()) {
static auto measureFunc = findClassLocal("com/facebook/csslayout/CSSNode") static auto measureFunc = findClassLocal("com/facebook/csslayout/YogaNode")
->getMethod<jlong(jfloat, jint, jfloat, jint)>("measure"); ->getMethod<jlong(jfloat, jint, jfloat, jint)>("measure");
YGTransferLayoutDirection(node, obj); YGTransferLayoutDirection(node, obj);
@@ -89,7 +89,7 @@ static int YGLog(YGLogLevel level, const char *format, va_list args) {
char buffer[256]; char buffer[256];
int result = vsnprintf(buffer, sizeof(buffer), format, args); int result = vsnprintf(buffer, sizeof(buffer), format, args);
static auto logFunc = findClassLocal("com/facebook/csslayout/CSSLogger") static auto logFunc = findClassLocal("com/facebook/csslayout/YogaLogger")
->getMethod<void(local_ref<JYogaLogLevel>, jstring)>("log"); ->getMethod<void(local_ref<JYogaLogLevel>, jstring)>("log");
static auto logLevelFromInt = static auto logLevelFromInt =
@@ -261,7 +261,7 @@ YG_NODE_JNI_STYLE_PROP(jfloat, float, AspectRatio);
jint JNI_OnLoad(JavaVM *vm, void *) { jint JNI_OnLoad(JavaVM *vm, void *) {
return initialize(vm, [] { return initialize(vm, [] {
registerNatives("com/facebook/csslayout/CSSNode", registerNatives("com/facebook/csslayout/YogaNode",
{ {
YGMakeNativeMethod(jni_YGNodeNew), YGMakeNativeMethod(jni_YGNodeNew),
YGMakeNativeMethod(jni_YGNodeFree), YGMakeNativeMethod(jni_YGNodeFree),

View File

@@ -18,11 +18,11 @@ import static org.junit.Assert.assertEquals;
public class YGAbsolutePositionTest { public class YGAbsolutePositionTest {
@Test @Test
public void test_absolute_layout_width_height_start_top() { public void test_absolute_layout_width_height_start_top() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setPositionType(YogaPositionType.ABSOLUTE);
root_child0.setPosition(YogaEdge.START, 10f); root_child0.setPosition(YogaEdge.START, 10f);
root_child0.setPosition(YogaEdge.TOP, 10f); root_child0.setPosition(YogaEdge.TOP, 10f);
@@ -58,11 +58,11 @@ public class YGAbsolutePositionTest {
@Test @Test
public void test_absolute_layout_width_height_end_bottom() { public void test_absolute_layout_width_height_end_bottom() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setPositionType(YogaPositionType.ABSOLUTE);
root_child0.setPosition(YogaEdge.END, 10f); root_child0.setPosition(YogaEdge.END, 10f);
root_child0.setPosition(YogaEdge.BOTTOM, 10f); root_child0.setPosition(YogaEdge.BOTTOM, 10f);
@@ -98,11 +98,11 @@ public class YGAbsolutePositionTest {
@Test @Test
public void test_absolute_layout_start_top_end_bottom() { public void test_absolute_layout_start_top_end_bottom() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setPositionType(YogaPositionType.ABSOLUTE);
root_child0.setPosition(YogaEdge.START, 10f); root_child0.setPosition(YogaEdge.START, 10f);
root_child0.setPosition(YogaEdge.TOP, 10f); root_child0.setPosition(YogaEdge.TOP, 10f);
@@ -138,11 +138,11 @@ public class YGAbsolutePositionTest {
@Test @Test
public void test_absolute_layout_width_height_start_top_end_bottom() { public void test_absolute_layout_width_height_start_top_end_bottom() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setPositionType(YogaPositionType.ABSOLUTE);
root_child0.setPosition(YogaEdge.START, 10f); root_child0.setPosition(YogaEdge.START, 10f);
root_child0.setPosition(YogaEdge.TOP, 10f); root_child0.setPosition(YogaEdge.TOP, 10f);
@@ -180,19 +180,19 @@ public class YGAbsolutePositionTest {
@Test @Test
public void test_do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent() { public void test_do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setOverflow(YogaOverflow.HIDDEN); root.setOverflow(YogaOverflow.HIDDEN);
root.setWidth(50f); root.setWidth(50f);
root.setHeight(50f); root.setHeight(50f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setPositionType(YogaPositionType.ABSOLUTE);
root_child0.setPosition(YogaEdge.START, 0f); root_child0.setPosition(YogaEdge.START, 0f);
root_child0.setPosition(YogaEdge.TOP, 0f); root_child0.setPosition(YogaEdge.TOP, 0f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode(); final YogaNode root_child0_child0 = new YogaNode();
root_child0_child0.setWidth(100f); root_child0_child0.setWidth(100f);
root_child0_child0.setHeight(100f); root_child0_child0.setHeight(100f);
root_child0.addChildAt(root_child0_child0, 0); root_child0.addChildAt(root_child0_child0, 0);
@@ -235,7 +235,7 @@ public class YGAbsolutePositionTest {
@Test @Test
public void test_absolute_layout_within_border() { public void test_absolute_layout_within_border() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setMargin(YogaEdge.LEFT, 10f); root.setMargin(YogaEdge.LEFT, 10f);
root.setMargin(YogaEdge.TOP, 10f); root.setMargin(YogaEdge.TOP, 10f);
root.setMargin(YogaEdge.RIGHT, 10f); root.setMargin(YogaEdge.RIGHT, 10f);
@@ -251,7 +251,7 @@ public class YGAbsolutePositionTest {
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setPositionType(YogaPositionType.ABSOLUTE);
root_child0.setPosition(YogaEdge.LEFT, 0f); root_child0.setPosition(YogaEdge.LEFT, 0f);
root_child0.setPosition(YogaEdge.TOP, 0f); root_child0.setPosition(YogaEdge.TOP, 0f);
@@ -259,7 +259,7 @@ public class YGAbsolutePositionTest {
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 YogaNode root_child1 = new YogaNode();
root_child1.setPositionType(YogaPositionType.ABSOLUTE); root_child1.setPositionType(YogaPositionType.ABSOLUTE);
root_child1.setPosition(YogaEdge.RIGHT, 0f); root_child1.setPosition(YogaEdge.RIGHT, 0f);
root_child1.setPosition(YogaEdge.BOTTOM, 0f); root_child1.setPosition(YogaEdge.BOTTOM, 0f);

View File

@@ -18,32 +18,32 @@ import static org.junit.Assert.assertEquals;
public class YGAlignContentTest { public class YGAlignContentTest {
@Test @Test
public void test_align_content_flex_start() { public void test_align_content_flex_start() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWrap(YogaWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(50f); root_child0.setWidth(50f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(50f); root_child1.setWidth(50f);
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(50f); root_child2.setWidth(50f);
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode(); final YogaNode root_child3 = new YogaNode();
root_child3.setWidth(50f); root_child3.setWidth(50f);
root_child3.setHeight(10f); root_child3.setHeight(10f);
root.addChildAt(root_child3, 3); root.addChildAt(root_child3, 3);
final CSSNode root_child4 = new CSSNode(); final YogaNode root_child4 = new YogaNode();
root_child4.setWidth(50f); root_child4.setWidth(50f);
root_child4.setHeight(10f); root_child4.setHeight(10f);
root.addChildAt(root_child4, 4); root.addChildAt(root_child4, 4);
@@ -116,33 +116,33 @@ public class YGAlignContentTest {
@Test @Test
public void test_align_content_flex_end() { public void test_align_content_flex_end() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setAlignContent(YogaAlign.FLEX_END); root.setAlignContent(YogaAlign.FLEX_END);
root.setWrap(YogaWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(50f); root_child0.setWidth(50f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(50f); root_child1.setWidth(50f);
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(50f); root_child2.setWidth(50f);
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode(); final YogaNode root_child3 = new YogaNode();
root_child3.setWidth(50f); root_child3.setWidth(50f);
root_child3.setHeight(10f); root_child3.setHeight(10f);
root.addChildAt(root_child3, 3); root.addChildAt(root_child3, 3);
final CSSNode root_child4 = new CSSNode(); final YogaNode root_child4 = new YogaNode();
root_child4.setWidth(50f); root_child4.setWidth(50f);
root_child4.setHeight(10f); root_child4.setHeight(10f);
root.addChildAt(root_child4, 4); root.addChildAt(root_child4, 4);
@@ -215,33 +215,33 @@ public class YGAlignContentTest {
@Test @Test
public void test_align_content_center() { public void test_align_content_center() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setAlignContent(YogaAlign.CENTER); root.setAlignContent(YogaAlign.CENTER);
root.setWrap(YogaWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(50f); root_child0.setWidth(50f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(50f); root_child1.setWidth(50f);
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(50f); root_child2.setWidth(50f);
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode(); final YogaNode root_child3 = new YogaNode();
root_child3.setWidth(50f); root_child3.setWidth(50f);
root_child3.setHeight(10f); root_child3.setHeight(10f);
root.addChildAt(root_child3, 3); root.addChildAt(root_child3, 3);
final CSSNode root_child4 = new CSSNode(); final YogaNode root_child4 = new YogaNode();
root_child4.setWidth(50f); root_child4.setWidth(50f);
root_child4.setHeight(10f); root_child4.setHeight(10f);
root.addChildAt(root_child4, 4); root.addChildAt(root_child4, 4);
@@ -314,29 +314,29 @@ public class YGAlignContentTest {
@Test @Test
public void test_align_content_stretch() { public void test_align_content_stretch() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setAlignContent(YogaAlign.STRETCH); root.setAlignContent(YogaAlign.STRETCH);
root.setWrap(YogaWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(50f); root_child0.setWidth(50f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(50f); root_child1.setWidth(50f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(50f); root_child2.setWidth(50f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode(); final YogaNode root_child3 = new YogaNode();
root_child3.setWidth(50f); root_child3.setWidth(50f);
root.addChildAt(root_child3, 3); root.addChildAt(root_child3, 3);
final CSSNode root_child4 = new CSSNode(); final YogaNode root_child4 = new YogaNode();
root_child4.setWidth(50f); root_child4.setWidth(50f);
root.addChildAt(root_child4, 4); root.addChildAt(root_child4, 4);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);

View File

@@ -18,11 +18,11 @@ import static org.junit.Assert.assertEquals;
public class YGAlignItemsTest { public class YGAlignItemsTest {
@Test @Test
public void test_align_items_stretch() { public void test_align_items_stretch() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -54,12 +54,12 @@ public class YGAlignItemsTest {
@Test @Test
public void test_align_items_center() { public void test_align_items_center() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setAlignItems(YogaAlign.CENTER); root.setAlignItems(YogaAlign.CENTER);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
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);
@@ -92,12 +92,12 @@ public class YGAlignItemsTest {
@Test @Test
public void test_align_items_flex_start() { public void test_align_items_flex_start() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setAlignItems(YogaAlign.FLEX_START); root.setAlignItems(YogaAlign.FLEX_START);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
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);
@@ -130,12 +130,12 @@ public class YGAlignItemsTest {
@Test @Test
public void test_align_items_flex_end() { public void test_align_items_flex_end() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setAlignItems(YogaAlign.FLEX_END); root.setAlignItems(YogaAlign.FLEX_END);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
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);

View File

@@ -18,11 +18,11 @@ import static org.junit.Assert.assertEquals;
public class YGAlignSelfTest { public class YGAlignSelfTest {
@Test @Test
public void test_align_self_center() { public void test_align_self_center() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setAlignSelf(YogaAlign.CENTER); root_child0.setAlignSelf(YogaAlign.CENTER);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
@@ -56,11 +56,11 @@ public class YGAlignSelfTest {
@Test @Test
public void test_align_self_flex_end() { public void test_align_self_flex_end() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setAlignSelf(YogaAlign.FLEX_END); root_child0.setAlignSelf(YogaAlign.FLEX_END);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
@@ -94,11 +94,11 @@ public class YGAlignSelfTest {
@Test @Test
public void test_align_self_flex_start() { public void test_align_self_flex_start() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setAlignSelf(YogaAlign.FLEX_START); root_child0.setAlignSelf(YogaAlign.FLEX_START);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
@@ -132,12 +132,12 @@ public class YGAlignSelfTest {
@Test @Test
public void test_align_self_flex_end_override_flex_start() { public void test_align_self_flex_end_override_flex_start() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setAlignItems(YogaAlign.FLEX_START); root.setAlignItems(YogaAlign.FLEX_START);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setAlignSelf(YogaAlign.FLEX_END); root_child0.setAlignSelf(YogaAlign.FLEX_END);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);

View File

@@ -18,7 +18,7 @@ import static org.junit.Assert.assertEquals;
public class YGBorderTest { public class YGBorderTest {
@Test @Test
public void test_border_no_size() { public void test_border_no_size() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setBorder(YogaEdge.LEFT, 10f); root.setBorder(YogaEdge.LEFT, 10f);
root.setBorder(YogaEdge.TOP, 10f); root.setBorder(YogaEdge.TOP, 10f);
root.setBorder(YogaEdge.RIGHT, 10f); root.setBorder(YogaEdge.RIGHT, 10f);
@@ -42,13 +42,13 @@ public class YGBorderTest {
@Test @Test
public void test_border_container_match_child() { public void test_border_container_match_child() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setBorder(YogaEdge.LEFT, 10f); root.setBorder(YogaEdge.LEFT, 10f);
root.setBorder(YogaEdge.TOP, 10f); root.setBorder(YogaEdge.TOP, 10f);
root.setBorder(YogaEdge.RIGHT, 10f); root.setBorder(YogaEdge.RIGHT, 10f);
root.setBorder(YogaEdge.BOTTOM, 10f); root.setBorder(YogaEdge.BOTTOM, 10f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
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);
@@ -81,7 +81,7 @@ public class YGBorderTest {
@Test @Test
public void test_border_flex_child() { public void test_border_flex_child() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setBorder(YogaEdge.LEFT, 10f); root.setBorder(YogaEdge.LEFT, 10f);
root.setBorder(YogaEdge.TOP, 10f); root.setBorder(YogaEdge.TOP, 10f);
root.setBorder(YogaEdge.RIGHT, 10f); root.setBorder(YogaEdge.RIGHT, 10f);
@@ -89,7 +89,7 @@ public class YGBorderTest {
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -122,7 +122,7 @@ public class YGBorderTest {
@Test @Test
public void test_border_stretch_child() { public void test_border_stretch_child() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setBorder(YogaEdge.LEFT, 10f); root.setBorder(YogaEdge.LEFT, 10f);
root.setBorder(YogaEdge.TOP, 10f); root.setBorder(YogaEdge.TOP, 10f);
root.setBorder(YogaEdge.RIGHT, 10f); root.setBorder(YogaEdge.RIGHT, 10f);
@@ -130,7 +130,7 @@ public class YGBorderTest {
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -162,7 +162,7 @@ public class YGBorderTest {
@Test @Test
public void test_border_center_child() { public void test_border_center_child() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setJustifyContent(YogaJustify.CENTER); root.setJustifyContent(YogaJustify.CENTER);
root.setAlignItems(YogaAlign.CENTER); root.setAlignItems(YogaAlign.CENTER);
root.setBorder(YogaEdge.START, 10f); root.setBorder(YogaEdge.START, 10f);
@@ -171,7 +171,7 @@ public class YGBorderTest {
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
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);

View File

@@ -18,18 +18,18 @@ import static org.junit.Assert.assertEquals;
public class YGFlexDirectionTest { public class YGFlexDirectionTest {
@Test @Test
public void test_flex_direction_column_no_height() { public void test_flex_direction_column_no_height() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -81,19 +81,19 @@ public class YGFlexDirectionTest {
@Test @Test
public void test_flex_direction_row_no_width() { public void test_flex_direction_row_no_width() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(10f); root_child1.setWidth(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -145,19 +145,19 @@ public class YGFlexDirectionTest {
@Test @Test
public void test_flex_direction_column() { public void test_flex_direction_column() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -209,20 +209,20 @@ public class YGFlexDirectionTest {
@Test @Test
public void test_flex_direction_row() { public void test_flex_direction_row() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(10f); root_child1.setWidth(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -274,20 +274,20 @@ public class YGFlexDirectionTest {
@Test @Test
public void test_flex_direction_column_reverse() { public void test_flex_direction_column_reverse() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -339,20 +339,20 @@ public class YGFlexDirectionTest {
@Test @Test
public void test_flex_direction_row_reverse() { public void test_flex_direction_row_reverse() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(10f); root_child1.setWidth(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);

View File

@@ -18,16 +18,16 @@ import static org.junit.Assert.assertEquals;
public class YGFlexTest { public class YGFlexTest {
@Test @Test
public void test_flex_basis_flex_grow_column() { public void test_flex_basis_flex_grow_column() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f); root_child0.setFlexBasis(50f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -69,17 +69,17 @@ public class YGFlexTest {
@Test @Test
public void test_flex_basis_flex_grow_row() { public void test_flex_basis_flex_grow_row() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f); root_child0.setFlexBasis(50f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -121,16 +121,16 @@ public class YGFlexTest {
@Test @Test
public void test_flex_basis_flex_shrink_column() { public void test_flex_basis_flex_shrink_column() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexShrink(1f); root_child0.setFlexShrink(1f);
root_child0.setFlexBasis(100f); root_child0.setFlexBasis(100f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexBasis(50f); root_child1.setFlexBasis(50f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -172,17 +172,17 @@ public class YGFlexTest {
@Test @Test
public void test_flex_basis_flex_shrink_row() { public void test_flex_basis_flex_shrink_row() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexShrink(1f); root_child0.setFlexShrink(1f);
root_child0.setFlexBasis(100f); root_child0.setFlexBasis(100f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexBasis(50f); root_child1.setFlexBasis(50f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -224,21 +224,21 @@ public class YGFlexTest {
@Test @Test
public void test_flex_shrink_to_zero() { public void test_flex_shrink_to_zero() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setHeight(75f); root.setHeight(75f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
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 YogaNode root_child1 = new YogaNode();
root_child1.setFlexShrink(1f); root_child1.setFlexShrink(1f);
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);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(50f); root_child2.setWidth(50f);
root_child2.setHeight(50f); root_child2.setHeight(50f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
@@ -291,22 +291,22 @@ public class YGFlexTest {
@Test @Test
public void test_flex_basis_overrides_main_size() { public void test_flex_basis_overrides_main_size() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f); root_child0.setFlexBasis(50f);
root_child0.setHeight(20f); root_child0.setHeight(20f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setFlexGrow(1f); root_child2.setFlexGrow(1f);
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
@@ -359,14 +359,14 @@ public class YGFlexTest {
@Test @Test
public void test_flex_grow_shrink_at_most() { public void test_flex_grow_shrink_at_most() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode(); final YogaNode root_child0_child0 = new YogaNode();
root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexGrow(1f);
root_child0_child0.setFlexShrink(1f); root_child0_child0.setFlexShrink(1f);
root_child0.addChildAt(root_child0_child0, 0); root_child0.addChildAt(root_child0_child0, 0);

View File

@@ -18,26 +18,26 @@ import static org.junit.Assert.assertEquals;
public class YGFlexWrapTest { public class YGFlexWrapTest {
@Test @Test
public void test_wrap_column() { public void test_wrap_column() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWrap(YogaWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(30f); root_child0.setWidth(30f);
root_child0.setHeight(30f); root_child0.setHeight(30f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(30f); root_child1.setWidth(30f);
root_child1.setHeight(30f); root_child1.setHeight(30f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(30f); root_child2.setWidth(30f);
root_child2.setHeight(30f); root_child2.setHeight(30f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode(); final YogaNode root_child3 = new YogaNode();
root_child3.setWidth(30f); root_child3.setWidth(30f);
root_child3.setHeight(30f); root_child3.setHeight(30f);
root.addChildAt(root_child3, 3); root.addChildAt(root_child3, 3);
@@ -100,27 +100,27 @@ public class YGFlexWrapTest {
@Test @Test
public void test_wrap_row() { public void test_wrap_row() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWrap(YogaWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setWidth(100f); root.setWidth(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(30f); root_child0.setWidth(30f);
root_child0.setHeight(30f); root_child0.setHeight(30f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(30f); root_child1.setWidth(30f);
root_child1.setHeight(30f); root_child1.setHeight(30f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(30f); root_child2.setWidth(30f);
root_child2.setHeight(30f); root_child2.setHeight(30f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode(); final YogaNode root_child3 = new YogaNode();
root_child3.setWidth(30f); root_child3.setWidth(30f);
root_child3.setHeight(30f); root_child3.setHeight(30f);
root.addChildAt(root_child3, 3); root.addChildAt(root_child3, 3);
@@ -183,28 +183,28 @@ public class YGFlexWrapTest {
@Test @Test
public void test_wrap_row_align_items_flex_end() { public void test_wrap_row_align_items_flex_end() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setAlignItems(YogaAlign.FLEX_END); root.setAlignItems(YogaAlign.FLEX_END);
root.setWrap(YogaWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setWidth(100f); root.setWidth(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(30f); root_child0.setWidth(30f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(30f); root_child1.setWidth(30f);
root_child1.setHeight(20f); root_child1.setHeight(20f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(30f); root_child2.setWidth(30f);
root_child2.setHeight(30f); root_child2.setHeight(30f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode(); final YogaNode root_child3 = new YogaNode();
root_child3.setWidth(30f); root_child3.setWidth(30f);
root_child3.setHeight(30f); root_child3.setHeight(30f);
root.addChildAt(root_child3, 3); root.addChildAt(root_child3, 3);
@@ -267,28 +267,28 @@ public class YGFlexWrapTest {
@Test @Test
public void test_wrap_row_align_items_center() { public void test_wrap_row_align_items_center() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setAlignItems(YogaAlign.CENTER); root.setAlignItems(YogaAlign.CENTER);
root.setWrap(YogaWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setWidth(100f); root.setWidth(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(30f); root_child0.setWidth(30f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(30f); root_child1.setWidth(30f);
root_child1.setHeight(20f); root_child1.setHeight(20f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(30f); root_child2.setWidth(30f);
root_child2.setHeight(30f); root_child2.setHeight(30f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode(); final YogaNode root_child3 = new YogaNode();
root_child3.setWidth(30f); root_child3.setWidth(30f);
root_child3.setHeight(30f); root_child3.setHeight(30f);
root.addChildAt(root_child3, 3); root.addChildAt(root_child3, 3);

View File

@@ -18,20 +18,20 @@ import static org.junit.Assert.assertEquals;
public class YGJustifyContentTest { public class YGJustifyContentTest {
@Test @Test
public void test_justify_content_row_flex_start() { public void test_justify_content_row_flex_start() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(10f); root_child1.setWidth(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -83,21 +83,21 @@ public class YGJustifyContentTest {
@Test @Test
public void test_justify_content_row_flex_end() { public void test_justify_content_row_flex_end() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setJustifyContent(YogaJustify.FLEX_END); root.setJustifyContent(YogaJustify.FLEX_END);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(10f); root_child1.setWidth(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -149,21 +149,21 @@ public class YGJustifyContentTest {
@Test @Test
public void test_justify_content_row_center() { public void test_justify_content_row_center() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setJustifyContent(YogaJustify.CENTER); root.setJustifyContent(YogaJustify.CENTER);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(10f); root_child1.setWidth(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -215,21 +215,21 @@ public class YGJustifyContentTest {
@Test @Test
public void test_justify_content_row_space_between() { public void test_justify_content_row_space_between() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setJustifyContent(YogaJustify.SPACE_BETWEEN); root.setJustifyContent(YogaJustify.SPACE_BETWEEN);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(10f); root_child1.setWidth(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -281,21 +281,21 @@ public class YGJustifyContentTest {
@Test @Test
public void test_justify_content_row_space_around() { public void test_justify_content_row_space_around() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setJustifyContent(YogaJustify.SPACE_AROUND); root.setJustifyContent(YogaJustify.SPACE_AROUND);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setWidth(10f); root_child1.setWidth(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -347,18 +347,18 @@ public class YGJustifyContentTest {
@Test @Test
public void test_justify_content_column_flex_start() { public void test_justify_content_column_flex_start() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -410,20 +410,20 @@ public class YGJustifyContentTest {
@Test @Test
public void test_justify_content_column_flex_end() { public void test_justify_content_column_flex_end() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setJustifyContent(YogaJustify.FLEX_END); root.setJustifyContent(YogaJustify.FLEX_END);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -475,20 +475,20 @@ public class YGJustifyContentTest {
@Test @Test
public void test_justify_content_column_center() { public void test_justify_content_column_center() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setJustifyContent(YogaJustify.CENTER); root.setJustifyContent(YogaJustify.CENTER);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -540,20 +540,20 @@ public class YGJustifyContentTest {
@Test @Test
public void test_justify_content_column_space_between() { public void test_justify_content_column_space_between() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setJustifyContent(YogaJustify.SPACE_BETWEEN); root.setJustifyContent(YogaJustify.SPACE_BETWEEN);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -605,20 +605,20 @@ public class YGJustifyContentTest {
@Test @Test
public void test_justify_content_column_space_around() { public void test_justify_content_column_space_around() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setJustifyContent(YogaJustify.SPACE_AROUND); root.setJustifyContent(YogaJustify.SPACE_AROUND);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);

View File

@@ -18,12 +18,12 @@ import static org.junit.Assert.assertEquals;
public class YGMarginTest { public class YGMarginTest {
@Test @Test
public void test_margin_start() { public void test_margin_start() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setMargin(YogaEdge.START, 10f); root_child0.setMargin(YogaEdge.START, 10f);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -56,11 +56,11 @@ public class YGMarginTest {
@Test @Test
public void test_margin_top() { public void test_margin_top() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setMargin(YogaEdge.TOP, 10f); root_child0.setMargin(YogaEdge.TOP, 10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -93,13 +93,13 @@ public class YGMarginTest {
@Test @Test
public void test_margin_end() { public void test_margin_end() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setJustifyContent(YogaJustify.FLEX_END); root.setJustifyContent(YogaJustify.FLEX_END);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setMargin(YogaEdge.END, 10f); root_child0.setMargin(YogaEdge.END, 10f);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -132,12 +132,12 @@ public class YGMarginTest {
@Test @Test
public void test_margin_bottom() { public void test_margin_bottom() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setJustifyContent(YogaJustify.FLEX_END); root.setJustifyContent(YogaJustify.FLEX_END);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setMargin(YogaEdge.BOTTOM, 10f); root_child0.setMargin(YogaEdge.BOTTOM, 10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -170,12 +170,12 @@ public class YGMarginTest {
@Test @Test
public void test_margin_and_flex_row() { public void test_margin_and_flex_row() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setMargin(YogaEdge.START, 10f); root_child0.setMargin(YogaEdge.START, 10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -208,11 +208,11 @@ public class YGMarginTest {
@Test @Test
public void test_margin_and_flex_column() { public void test_margin_and_flex_column() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setMargin(YogaEdge.TOP, 10f); root_child0.setMargin(YogaEdge.TOP, 10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -245,12 +245,12 @@ public class YGMarginTest {
@Test @Test
public void test_margin_and_stretch_row() { public void test_margin_and_stretch_row() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setMargin(YogaEdge.TOP, 10f); root_child0.setMargin(YogaEdge.TOP, 10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -283,11 +283,11 @@ public class YGMarginTest {
@Test @Test
public void test_margin_and_stretch_column() { public void test_margin_and_stretch_column() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setMargin(YogaEdge.START, 10f); root_child0.setMargin(YogaEdge.START, 10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -320,16 +320,16 @@ public class YGMarginTest {
@Test @Test
public void test_margin_with_sibling_row() { public void test_margin_with_sibling_row() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -371,15 +371,15 @@ public class YGMarginTest {
@Test @Test
public void test_margin_with_sibling_column() { public void test_margin_with_sibling_column() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);

View File

@@ -18,11 +18,11 @@ import static org.junit.Assert.assertEquals;
public class YGMinMaxDimensionTest { public class YGMinMaxDimensionTest {
@Test @Test
public void test_max_width() { public void test_max_width() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setMaxWidth(50f); root_child0.setMaxWidth(50f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -55,12 +55,12 @@ public class YGMinMaxDimensionTest {
@Test @Test
public void test_max_height() { public void test_max_height() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setMaxHeight(50f); root_child0.setMaxHeight(50f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -93,16 +93,16 @@ public class YGMinMaxDimensionTest {
@Test @Test
public void test_min_height() { public void test_min_height() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setMinHeight(60f); root_child0.setMinHeight(60f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -144,17 +144,17 @@ public class YGMinMaxDimensionTest {
@Test @Test
public void test_min_width() { public void test_min_width() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setMinWidth(60f); root_child0.setMinWidth(60f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -196,13 +196,13 @@ public class YGMinMaxDimensionTest {
@Test @Test
public void test_justify_content_min_max() { public void test_justify_content_min_max() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setJustifyContent(YogaJustify.CENTER); root.setJustifyContent(YogaJustify.CENTER);
root.setWidth(100f); root.setWidth(100f);
root.setMinHeight(100f); root.setMinHeight(100f);
root.setMaxHeight(200f); root.setMaxHeight(200f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(60f); root_child0.setWidth(60f);
root_child0.setHeight(60f); root_child0.setHeight(60f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -235,13 +235,13 @@ public class YGMinMaxDimensionTest {
@Test @Test
public void test_align_items_min_max() { public void test_align_items_min_max() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setAlignItems(YogaAlign.CENTER); root.setAlignItems(YogaAlign.CENTER);
root.setMinWidth(100f); root.setMinWidth(100f);
root.setMaxWidth(200f); root.setMaxWidth(200f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(60f); root_child0.setWidth(60f);
root_child0.setHeight(60f); root_child0.setHeight(60f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -274,22 +274,22 @@ public class YGMinMaxDimensionTest {
@Test @Test
public void test_justify_content_overflow_min_max() { public void test_justify_content_overflow_min_max() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setJustifyContent(YogaJustify.CENTER); root.setJustifyContent(YogaJustify.CENTER);
root.setMinHeight(100f); root.setMinHeight(100f);
root.setMaxHeight(110f); root.setMaxHeight(110f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
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 YogaNode root_child1 = new YogaNode();
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);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setWidth(50f); root_child2.setWidth(50f);
root_child2.setHeight(50f); root_child2.setHeight(50f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
@@ -342,16 +342,16 @@ public class YGMinMaxDimensionTest {
@Test @Test
public void test_flex_grow_within_max_width() { public void test_flex_grow_within_max_width() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(200f); root.setWidth(200f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setFlexDirection(YogaFlexDirection.ROW);
root_child0.setMaxWidth(100f); root_child0.setMaxWidth(100f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode(); final YogaNode root_child0_child0 = new YogaNode();
root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexGrow(1f);
root_child0_child0.setHeight(20f); root_child0_child0.setHeight(20f);
root_child0.addChildAt(root_child0_child0, 0); root_child0.addChildAt(root_child0_child0, 0);
@@ -394,16 +394,16 @@ public class YGMinMaxDimensionTest {
@Test @Test
public void test_flex_grow_within_constrained_max_width() { public void test_flex_grow_within_constrained_max_width() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(200f); root.setWidth(200f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setFlexDirection(YogaFlexDirection.ROW);
root_child0.setMaxWidth(300f); root_child0.setMaxWidth(300f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode(); final YogaNode root_child0_child0 = new YogaNode();
root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexGrow(1f);
root_child0_child0.setHeight(20f); root_child0_child0.setHeight(20f);
root_child0.addChildAt(root_child0_child0, 0); root_child0.addChildAt(root_child0_child0, 0);

View File

@@ -18,7 +18,7 @@ import static org.junit.Assert.assertEquals;
public class YGPaddingTest { public class YGPaddingTest {
@Test @Test
public void test_padding_no_size() { public void test_padding_no_size() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setPadding(YogaEdge.LEFT, 10); root.setPadding(YogaEdge.LEFT, 10);
root.setPadding(YogaEdge.TOP, 10); root.setPadding(YogaEdge.TOP, 10);
root.setPadding(YogaEdge.RIGHT, 10); root.setPadding(YogaEdge.RIGHT, 10);
@@ -42,13 +42,13 @@ public class YGPaddingTest {
@Test @Test
public void test_padding_container_match_child() { public void test_padding_container_match_child() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setPadding(YogaEdge.LEFT, 10); root.setPadding(YogaEdge.LEFT, 10);
root.setPadding(YogaEdge.TOP, 10); root.setPadding(YogaEdge.TOP, 10);
root.setPadding(YogaEdge.RIGHT, 10); root.setPadding(YogaEdge.RIGHT, 10);
root.setPadding(YogaEdge.BOTTOM, 10); root.setPadding(YogaEdge.BOTTOM, 10);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
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);
@@ -81,7 +81,7 @@ public class YGPaddingTest {
@Test @Test
public void test_padding_flex_child() { public void test_padding_flex_child() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setPadding(YogaEdge.LEFT, 10); root.setPadding(YogaEdge.LEFT, 10);
root.setPadding(YogaEdge.TOP, 10); root.setPadding(YogaEdge.TOP, 10);
root.setPadding(YogaEdge.RIGHT, 10); root.setPadding(YogaEdge.RIGHT, 10);
@@ -89,7 +89,7 @@ public class YGPaddingTest {
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -122,7 +122,7 @@ public class YGPaddingTest {
@Test @Test
public void test_padding_stretch_child() { public void test_padding_stretch_child() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setPadding(YogaEdge.LEFT, 10); root.setPadding(YogaEdge.LEFT, 10);
root.setPadding(YogaEdge.TOP, 10); root.setPadding(YogaEdge.TOP, 10);
root.setPadding(YogaEdge.RIGHT, 10); root.setPadding(YogaEdge.RIGHT, 10);
@@ -130,7 +130,7 @@ public class YGPaddingTest {
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -162,7 +162,7 @@ public class YGPaddingTest {
@Test @Test
public void test_padding_center_child() { public void test_padding_center_child() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setJustifyContent(YogaJustify.CENTER); root.setJustifyContent(YogaJustify.CENTER);
root.setAlignItems(YogaAlign.CENTER); root.setAlignItems(YogaAlign.CENTER);
root.setPadding(YogaEdge.START, 10); root.setPadding(YogaEdge.START, 10);
@@ -171,7 +171,7 @@ public class YGPaddingTest {
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
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);
@@ -204,13 +204,13 @@ public class YGPaddingTest {
@Test @Test
public void test_child_with_padding_align_end() { public void test_child_with_padding_align_end() {
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setJustifyContent(YogaJustify.FLEX_END); root.setJustifyContent(YogaJustify.FLEX_END);
root.setAlignItems(YogaAlign.FLEX_END); root.setAlignItems(YogaAlign.FLEX_END);
root.setWidth(200f); root.setWidth(200f);
root.setHeight(200f); root.setHeight(200f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setPadding(YogaEdge.LEFT, 20); root_child0.setPadding(YogaEdge.LEFT, 20);
root_child0.setPadding(YogaEdge.TOP, 20); root_child0.setPadding(YogaEdge.TOP, 20);
root_child0.setPadding(YogaEdge.RIGHT, 20); root_child0.setPadding(YogaEdge.RIGHT, 20);

View File

@@ -18,22 +18,22 @@ import static org.junit.Assert.assertEquals;
public class YGRoundingTest { public class YGRoundingTest {
@Test @Test
public void test_rounding_flex_basis_flex_grow_row_width_of_100() { public void test_rounding_flex_basis_flex_grow_row_width_of_100() {
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setFlexGrow(1f); root_child2.setFlexGrow(1f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -82,35 +82,35 @@ public class YGRoundingTest {
assertEquals(33f, root_child2.getLayoutWidth(), 0.0f); assertEquals(33f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_flex_basis_flex_grow_row_prime_number_width() { public void test_rounding_flex_basis_flex_grow_row_prime_number_width() {
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(113f); root.setWidth(113f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setFlexGrow(1f); root_child2.setFlexGrow(1f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode(); final YogaNode root_child3 = new YogaNode();
root_child3.setFlexGrow(1f); root_child3.setFlexGrow(1f);
root.addChildAt(root_child3, 3); root.addChildAt(root_child3, 3);
final CSSNode root_child4 = new CSSNode(); final YogaNode root_child4 = new YogaNode();
root_child4.setFlexGrow(1f); root_child4.setFlexGrow(1f);
root.addChildAt(root_child4, 4); root.addChildAt(root_child4, 4);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -179,28 +179,28 @@ public class YGRoundingTest {
assertEquals(23f, root_child4.getLayoutWidth(), 0.0f); assertEquals(23f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_flex_basis_flex_shrink_row() { public void test_rounding_flex_basis_flex_shrink_row() {
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(101f); root.setWidth(101f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexShrink(1f); root_child0.setFlexShrink(1f);
root_child0.setFlexBasis(100f); root_child0.setFlexBasis(100f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexBasis(25f); root_child1.setFlexBasis(25f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setFlexBasis(25f); root_child2.setFlexBasis(25f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR); root.setDirection(YogaDirection.LTR);
@@ -249,29 +249,29 @@ public class YGRoundingTest {
assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_flex_basis_overrides_main_size() { public void test_rounding_flex_basis_overrides_main_size() {
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(113f); root.setHeight(113f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f); root_child0.setFlexBasis(50f);
root_child0.setHeight(20f); root_child0.setHeight(20f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setFlexGrow(1f); root_child2.setFlexGrow(1f);
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
@@ -321,29 +321,29 @@ public class YGRoundingTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_total_fractial() { public void test_rounding_total_fractial() {
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(87.4f); root.setWidth(87.4f);
root.setHeight(113.4f); root.setHeight(113.4f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(0.7f); root_child0.setFlexGrow(0.7f);
root_child0.setFlexBasis(50.3f); root_child0.setFlexBasis(50.3f);
root_child0.setHeight(20.3f); root_child0.setHeight(20.3f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1.6f); root_child1.setFlexGrow(1.6f);
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setFlexGrow(1.1f); root_child2.setFlexGrow(1.1f);
root_child2.setHeight(10.7f); root_child2.setHeight(10.7f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
@@ -393,43 +393,43 @@ public class YGRoundingTest {
assertEquals(87f, root_child2.getLayoutWidth(), 0.0f); assertEquals(87f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_total_fractial_nested() { public void test_rounding_total_fractial_nested() {
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(87.4f); root.setWidth(87.4f);
root.setHeight(113.4f); root.setHeight(113.4f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(0.7f); root_child0.setFlexGrow(0.7f);
root_child0.setFlexBasis(50.3f); root_child0.setFlexBasis(50.3f);
root_child0.setHeight(20.3f); root_child0.setHeight(20.3f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode(); final YogaNode root_child0_child0 = new YogaNode();
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(YogaEdge.BOTTOM, 13.3f); root_child0_child0.setPosition(YogaEdge.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 YogaNode root_child0_child1 = new YogaNode();
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(YogaEdge.TOP, 13.3f); root_child0_child1.setPosition(YogaEdge.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);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1.6f); root_child1.setFlexGrow(1.6f);
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setFlexGrow(1.1f); root_child2.setFlexGrow(1.1f);
root_child2.setHeight(10.7f); root_child2.setHeight(10.7f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
@@ -499,29 +499,29 @@ public class YGRoundingTest {
assertEquals(87f, root_child2.getLayoutWidth(), 0.0f); assertEquals(87f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_fractial_input_1() { public void test_rounding_fractial_input_1() {
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(113.4f); root.setHeight(113.4f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f); root_child0.setFlexBasis(50f);
root_child0.setHeight(20f); root_child0.setHeight(20f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setFlexGrow(1f); root_child2.setFlexGrow(1f);
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
@@ -571,29 +571,29 @@ public class YGRoundingTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_fractial_input_2() { public void test_rounding_fractial_input_2() {
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setWidth(100f); root.setWidth(100f);
root.setHeight(113.6f); root.setHeight(113.6f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f); root_child0.setFlexBasis(50f);
root_child0.setHeight(20f); root_child0.setHeight(20f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setFlexGrow(1f); root_child2.setFlexGrow(1f);
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
@@ -643,30 +643,30 @@ public class YGRoundingTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_fractial_input_3() { public void test_rounding_fractial_input_3() {
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setPosition(YogaEdge.TOP, 0.3f); root.setPosition(YogaEdge.TOP, 0.3f);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(113.4f); root.setHeight(113.4f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f); root_child0.setFlexBasis(50f);
root_child0.setHeight(20f); root_child0.setHeight(20f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setFlexGrow(1f); root_child2.setFlexGrow(1f);
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
@@ -716,30 +716,30 @@ public class YGRoundingTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_fractial_input_4() { public void test_rounding_fractial_input_4() {
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final YogaNode root = new YogaNode();
root.setPosition(YogaEdge.TOP, 0.7f); root.setPosition(YogaEdge.TOP, 0.7f);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(113.4f); root.setHeight(113.4f);
final CSSNode root_child0 = new CSSNode(); final YogaNode root_child0 = new YogaNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f); root_child0.setFlexBasis(50f);
root_child0.setHeight(20f); root_child0.setHeight(20f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final YogaNode root_child1 = new YogaNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root_child1.setHeight(10f); root_child1.setHeight(10f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode(); final YogaNode root_child2 = new YogaNode();
root_child2.setFlexGrow(1f); root_child2.setFlexGrow(1f);
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
@@ -789,7 +789,7 @@ public class YGRoundingTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
} }

View File

@@ -18,22 +18,22 @@ public class YogaNodeTest {
@Test @Test
public void testInit() { public void testInit() {
final int refCount = CSSNode.jni_YGNodeGetInstanceCount(); final int refCount = YogaNode.jni_YGNodeGetInstanceCount();
final CSSNode node = new CSSNode(); final YogaNode node = new YogaNode();
assertEquals(refCount + 1, CSSNode.jni_YGNodeGetInstanceCount()); assertEquals(refCount + 1, YogaNode.jni_YGNodeGetInstanceCount());
} }
@Test @Test
public void testMeasure() { public void testMeasure() {
final CSSNode node = new CSSNode(); final YogaNode node = new YogaNode();
node.setMeasureFunction(new CSSNodeAPI.MeasureFunction() { node.setMeasureFunction(new YogaMeasureFunction() {
public long measure( public long measure(
CSSNodeAPI node, YogaNodeAPI node,
float width, float width,
YogaMeasureMode widthMode, YogaMeasureMode widthMode,
float height, float height,
YogaMeasureMode heightMode) { YogaMeasureMode heightMode) {
return MeasureOutput.make(100, 100); return YogaMeasureOutput.make(100, 100);
} }
}); });
node.calculateLayout(); node.calculateLayout();
@@ -46,39 +46,39 @@ public class YogaNodeTest {
@Test @Test
public void testLogger() { public void testLogger() {
CSSNode.setLogger(new CSSLogger() { YogaNode.setLogger(new YogaLogger() {
public void log(YogaLogLevel level, String message) { public void log(YogaLogLevel level, String message) {
mLogLevel = level; mLogLevel = level;
mLogMessage = message; mLogMessage = message;
} }
}); });
CSSNode.jni_YGLog(YogaLogLevel.DEBUG.intValue(), "Hello"); YogaNode.jni_YGLog(YogaLogLevel.DEBUG.intValue(), "Hello");
assertEquals(YogaLogLevel.DEBUG, mLogLevel); assertEquals(YogaLogLevel.DEBUG, mLogLevel);
assertEquals("Hello", mLogMessage); assertEquals("Hello", mLogMessage);
} }
@Test @Test
public void testUpdateLogger() { public void testUpdateLogger() {
CSSNode.setLogger(new CSSLogger() { YogaNode.setLogger(new YogaLogger() {
public void log(YogaLogLevel level, String message) {} public void log(YogaLogLevel level, String message) {}
}); });
CSSNode.setLogger(new CSSLogger() { YogaNode.setLogger(new YogaLogger() {
public void log(YogaLogLevel level, String message) { public void log(YogaLogLevel level, String message) {
mLogLevel = level; mLogLevel = level;
mLogMessage = message; mLogMessage = message;
} }
}); });
CSSNode.jni_YGLog(YogaLogLevel.VERBOSE.intValue(), "Flexbox"); YogaNode.jni_YGLog(YogaLogLevel.VERBOSE.intValue(), "Flexbox");
assertEquals(YogaLogLevel.VERBOSE, mLogLevel); assertEquals(YogaLogLevel.VERBOSE, mLogLevel);
assertEquals("Flexbox", mLogMessage); assertEquals("Flexbox", mLogMessage);
} }
@Test @Test
public void testCopyStyle() { public void testCopyStyle() {
final CSSNode node0 = new CSSNode(); final YogaNode node0 = new YogaNode();
assertTrue(YogaConstants.isUndefined(node0.getMaxHeight())); assertTrue(YogaConstants.isUndefined(node0.getMaxHeight()));
final CSSNode node1 = new CSSNode(); final YogaNode node1 = new YogaNode();
node1.setMaxHeight(100); node1.setMaxHeight(100);
node0.copyStyle(node1); node0.copyStyle(node1);