rename csharp code

Summary: new name

Reviewed By: splhack

Differential Revision: D4247106

fbshipit-source-id: 6e1097de104f3a011c78ae65b33e57865b007711
This commit is contained in:
Emil Sjolander
2016-12-02 11:18:16 -08:00
committed by Facebook Github Bot
parent 4bbf35832e
commit f7cc614d67
56 changed files with 506 additions and 512 deletions

View File

@@ -24,7 +24,7 @@ script:
- buck test //:CSSLayout
- buck test //java:java
- buck test //YogaKit:YogaKit --config cxx.default_platform=iphonesimulator-x86_64 --config cxx.cflags=-DTRAVIS_CI
- sh csharp/tests/Facebook.CSSLayout/test_macos.sh
- sh csharp/tests/Facebook.Yoga/test_macos.sh
- buck run //benchmark:benchmark
- git checkout HEAD^
- buck run //benchmark:benchmark

View File

@@ -7,14 +7,14 @@
csharp_library(
name = 'csslibnet46',
dll_name = 'Facebook.CSSLayout.dll',
dll_name = 'Facebook.Yoga.dll',
framework_ver = 'net46',
srcs = glob(['**/*.cs']),
)
csharp_library(
name = 'csslibnet45',
dll_name = 'Facebook.CSSLayout.dll',
dll_name = 'Facebook.Yoga.dll',
framework_ver = 'net45',
srcs = glob(['**/*.cs']),
)

View File

@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSSLayout", "CSSLayout\CSSLayout.vcxproj", "{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Yoga", "Yoga\Yoga.vcxproj", "{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Facebook.CSSLayout", "Facebook.CSSLayout\Facebook.CSSLayout.xproj", "{75BB7605-E54B-4EDE-8F5A-FF1F24464236}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Facebook.Yoga", "Facebook.Yoga\Facebook.Yoga.xproj", "{75BB7605-E54B-4EDE-8F5A-FF1F24464236}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@@ -8,7 +8,7 @@
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>75bb7605-e54b-4ede-8f5a-ff1f24464236</ProjectGuid>
<RootNamespace>Facebook.CSSLayout</RootNamespace>
<RootNamespace>Facebook.Yoga</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>

View File

@@ -7,10 +7,10 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public delegate long MeasureFunction(
CSSNode node,
YogaNode node,
float width,
YogaMeasureMode widthMode,
float height,

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public class MeasureOutput
{

View File

@@ -10,19 +10,19 @@
using System;
using System.Runtime.InteropServices;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
internal static class Native
{
#if UNITY_IOS && !UNITY_EDITOR
private const string DllName = "__Internal";
#else
private const string DllName = "CSSLayout";
private const string DllName = "yoga";
#endif
[DllImport(DllName)]
public static extern void CSSInteropSetLogger(
[MarshalAs(UnmanagedType.FunctionPtr)] CSSLogger.Func func);
public static extern void YGInteropSetLogger(
[MarshalAs(UnmanagedType.FunctionPtr)] YogaLogger.Func func);
[DllImport(DllName)]
public static extern IntPtr CSSNodeNew();
@@ -94,11 +94,11 @@ namespace Facebook.CSSLayout
[DllImport(DllName)]
public static extern void CSSNodeSetMeasureFunc(
IntPtr node,
[MarshalAs(UnmanagedType.FunctionPtr)] CSSMeasureFunc measureFunc);
[MarshalAs(UnmanagedType.FunctionPtr)] YogaMeasureFunc measureFunc);
[DllImport(DllName)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern CSSMeasureFunc CSSNodeGetMeasureFunc(IntPtr node);
public static extern YogaMeasureFunc CSSNodeGetMeasureFunc(IntPtr node);
[DllImport(DllName)]
public static extern void CSSNodeSetHasNewLayout(IntPtr node, [MarshalAs(UnmanagedType.I1)] bool hasNewLayout);

View File

@@ -16,7 +16,7 @@ using System.Runtime.InteropServices;
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Facebook, Inc.")]
[assembly: AssemblyProduct("Facebook.CSSLayout")]
[assembly: AssemblyProduct("Facebook.Yoga")]
[assembly: AssemblyTrademark("Copyright (c) 2014-present, Facebook, Inc.")]
// Setting ComVisible to false makes the types in this assembly not visible

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public class Spacing
{

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public enum YogaAlign
{

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public static class YogaConstants
{

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public enum YogaDimension
{

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public enum YogaDirection
{

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public enum YogaEdge
{

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public enum YogaExperimentalFeature
{

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public enum YogaFlexDirection
{

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public enum YogaJustify
{

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public enum YogaLogLevel
{

View File

@@ -10,9 +10,9 @@
using System;
using System.Runtime.InteropServices;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
internal static class CSSLogger
internal static class YogaLogger
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void Func(YogaLogLevel level, string message);
@@ -37,7 +37,7 @@ namespace Facebook.CSSLayout
throw new InvalidOperationException(message);
}
};
Native.CSSInteropSetLogger(_managedLogger);
Native.YGInteropSetLogger(_managedLogger);
_initialized = true;
}
}

View File

@@ -10,10 +10,10 @@
using System;
using System.Runtime.InteropServices;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate CSSSize CSSMeasureFunc(
public delegate YogaSize YogaMeasureFunc(
IntPtr node,
float width,
YogaMeasureMode widthMode,

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public enum YogaMeasureMode
{

View File

@@ -9,11 +9,11 @@
using System;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public partial class CSSNode
public partial class YogaNode
{
public static CSSNode Create(
public static YogaNode Create(
YogaDirection? styleDirection = null,
YogaFlexDirection? flexDirection = null,
YogaJustify? justifyContent = null,
@@ -31,15 +31,14 @@ namespace Facebook.CSSLayout
Spacing margin = null,
Spacing padding = null,
Spacing border = null,
float? width = null,
float? height = null,
float? maxWidth = null,
float? maxHeight = null,
float? minWidth = null,
float? minHeight = null,
float? aspectRatio = null)
float? Width = null,
float? Height = null,
float? MaxWidth = null,
float? MaxHeight = null,
float? MinWidth = null,
float? MinHeight = null)
{
CSSNode node = new CSSNode();
YogaNode node = new YogaNode();
if (styleDirection.HasValue)
{
@@ -198,39 +197,34 @@ namespace Facebook.CSSLayout
}
}
if (width.HasValue)
if (Width.HasValue)
{
node.Width = width.Value;
node.Width = Width.Value;
}
if (height.HasValue)
if (Height.HasValue)
{
node.Height = height.Value;
node.Height = Height.Value;
}
if (minWidth.HasValue)
if (MinWidth.HasValue)
{
node.MinWidth = minWidth.Value;
node.MinWidth = MinWidth.Value;
}
if (minHeight.HasValue)
if (MinHeight.HasValue)
{
node.MinHeight = minHeight.Value;
node.MinHeight = MinHeight.Value;
}
if (maxWidth.HasValue)
if (MaxWidth.HasValue)
{
node.MaxWidth = maxWidth.Value;
node.MaxWidth = MaxWidth.Value;
}
if (maxHeight.HasValue)
if (MaxHeight.HasValue)
{
node.MaxHeight = maxHeight.Value;
}
if (aspectRatio.HasValue)
{
node.AspectRatio = aspectRatio.Value;
node.MaxHeight = MaxHeight.Value;
}
return node;

View File

@@ -13,20 +13,20 @@ using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public partial class CSSNode : IEnumerable<CSSNode>
public partial class YogaNode : IEnumerable<YogaNode>
{
private IntPtr _cssNode;
private WeakReference _parent;
private List<CSSNode> _children;
private List<YogaNode> _children;
private MeasureFunction _measureFunction;
private CSSMeasureFunc _cssMeasureFunc;
private YogaMeasureFunc _cssMeasureFunc;
private object _data;
public CSSNode()
public YogaNode()
{
CSSLogger.Initialize();
YogaLogger.Initialize();
_cssNode = Native.CSSNodeNew();
if (_cssNode == IntPtr.Zero)
@@ -35,7 +35,7 @@ namespace Facebook.CSSLayout
}
}
~CSSNode()
~YogaNode()
{
Native.CSSNodeFree(_cssNode);
}
@@ -74,11 +74,11 @@ namespace Facebook.CSSLayout
Native.CSSNodeSetHasNewLayout(_cssNode, true);
}
public CSSNode Parent
public YogaNode Parent
{
get
{
return _parent != null ? _parent.Target as CSSNode : null;
return _parent != null ? _parent.Target as YogaNode : null;
}
}
@@ -90,7 +90,7 @@ namespace Facebook.CSSLayout
}
}
public void CopyStyle(CSSNode srcNode)
public void CopyStyle(YogaNode srcNode)
{
Native.CSSNodeCopyStyle(_cssNode, srcNode._cssNode);
}
@@ -364,7 +364,7 @@ namespace Facebook.CSSLayout
}
}
public float AspectRatio
public float StyleAspectRatio
{
get
{
@@ -443,7 +443,7 @@ namespace Facebook.CSSLayout
}
}
public CSSNode this[int index]
public YogaNode this[int index]
{
get
{
@@ -474,11 +474,11 @@ namespace Facebook.CSSLayout
return Math.Abs(f2 - f1) < float.Epsilon;
}
public void Insert(int index, CSSNode node)
public void Insert(int index, YogaNode node)
{
if (_children == null)
{
_children = new List<CSSNode>(4);
_children = new List<YogaNode>(4);
}
_children.Insert(index, node);
node._parent = new WeakReference(this);
@@ -504,7 +504,7 @@ namespace Facebook.CSSLayout
}
}
public int IndexOf(CSSNode node)
public int IndexOf(YogaNode node)
{
return _children != null ? _children.IndexOf(node) : -1;
}
@@ -512,7 +512,7 @@ namespace Facebook.CSSLayout
public void SetMeasureFunction(MeasureFunction measureFunction)
{
_measureFunction = measureFunction;
_cssMeasureFunc = measureFunction != null ? MeasureInternal : (CSSMeasureFunc)null;
_cssMeasureFunc = measureFunction != null ? MeasureInternal : (YogaMeasureFunc)null;
Native.CSSNodeSetMeasureFunc(_cssNode, _cssMeasureFunc);
}
@@ -525,7 +525,7 @@ namespace Facebook.CSSLayout
Native.CSSNodeStyleGetDirection(_cssNode));
}
private CSSSize MeasureInternal(
private YogaSize MeasureInternal(
IntPtr node,
float width,
YogaMeasureMode widthMode,
@@ -538,30 +538,30 @@ namespace Facebook.CSSLayout
}
long output = _measureFunction(this, width, widthMode, height, heightMode);
return new CSSSize { width = MeasureOutput.GetWidth(output), height = MeasureOutput.GetHeight(output) };
return new YogaSize { width = MeasureOutput.GetWidth(output), height = MeasureOutput.GetHeight(output) };
}
public string Print(YogaPrintOptions options =
YogaPrintOptions.Layout|YogaPrintOptions.Style|YogaPrintOptions.Children)
{
StringBuilder sb = new StringBuilder();
CSSLogger.Func orig = CSSLogger.Logger;
CSSLogger.Logger = (level, message) => {sb.Append(message);};
YogaLogger.Func orig = YogaLogger.Logger;
YogaLogger.Logger = (level, message) => {sb.Append(message);};
Native.CSSNodePrint(_cssNode, options);
CSSLogger.Logger = orig;
YogaLogger.Logger = orig;
return sb.ToString();
}
public IEnumerator<CSSNode> GetEnumerator()
public IEnumerator<YogaNode> GetEnumerator()
{
return _children != null ? ((IEnumerable<CSSNode>)_children).GetEnumerator() :
System.Linq.Enumerable.Empty<CSSNode>().GetEnumerator();
return _children != null ? ((IEnumerable<YogaNode>)_children).GetEnumerator() :
System.Linq.Enumerable.Empty<YogaNode>().GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return _children != null ? ((IEnumerable<CSSNode>)_children).GetEnumerator() :
System.Linq.Enumerable.Empty<CSSNode>().GetEnumerator();
return _children != null ? ((IEnumerable<YogaNode>)_children).GetEnumerator() :
System.Linq.Enumerable.Empty<YogaNode>().GetEnumerator();
}
public static int GetInstanceCount()

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public enum YogaOverflow
{

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public enum YogaPositionType
{

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public enum YogaPrintOptions
{

View File

@@ -9,10 +9,10 @@
using System.Runtime.InteropServices;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[StructLayout(LayoutKind.Sequential)]
public struct CSSSize
public struct YogaSize
{
public float width;
public float height;

View File

@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
public enum YogaWrap
{

View File

@@ -7,9 +7,9 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#include "CSSInterop.h"
#include "YGInterop.h"
static CSSInteropLoggerFunc gManagedFunc;
static YGInteropLoggerFunc gManagedFunc;
static int unmanagedLogger(YGLogLevel level, const char *format, va_list args) {
int result = 0;
@@ -21,7 +21,7 @@ static int unmanagedLogger(YGLogLevel level, const char *format, va_list args) {
return result;
}
void CSSInteropSetLogger(CSSInteropLoggerFunc managedFunc) {
void YGInteropSetLogger(YGInteropLoggerFunc managedFunc) {
gManagedFunc = managedFunc;
CSSLayoutSetLogger(&unmanagedLogger);
}

View File

@@ -13,8 +13,8 @@
CSS_EXTERN_C_BEGIN
typedef void (*CSSInteropLoggerFunc)(YGLogLevel level, const char *message);
typedef void (*YGInteropLoggerFunc)(YGLogLevel level, const char *message);
WIN_EXPORT void CSSInteropSetLogger(CSSInteropLoggerFunc managedFunc);
WIN_EXPORT void YGInteropSetLogger(YGInteropLoggerFunc managedFunc);
CSS_EXTERN_C_END

View File

@@ -21,7 +21,7 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>CSSLayout</RootNamespace>
<RootNamespace>Yoga</RootNamespace>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
@@ -153,14 +153,14 @@
<ClInclude Include="..\..\CSSLayout\CSSLayout.h" />
<ClInclude Include="..\..\CSSLayout\CSSMacros.h" />
<ClInclude Include="..\..\CSSLayout\CSSNodeList.h" />
<ClInclude Include="CSSInterop.h" />
<ClInclude Include="YGInterop.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\CSSLayout\CSSLayout.c" />
<ClCompile Include="..\..\CSSLayout\CSSNodeList.c" />
<ClCompile Include="CSSInterop.cpp" />
<ClCompile Include="YGInterop.cpp" />
<ClCompile Include="dllmain.cpp">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@@ -180,4 +180,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@@ -30,7 +30,7 @@
<ClInclude Include="..\..\CSSLayout\CSSNodeList.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CSSInterop.h">
<ClInclude Include="YGInterop.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
@@ -47,8 +47,8 @@
<ClCompile Include="..\..\CSSLayout\CSSNodeList.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="CSSInterop.cpp">
<ClCompile Include="YGInterop.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
</Project>

View File

@@ -8,7 +8,7 @@
*/
// stdafx.cpp : source file that includes just the standard includes
// CSSLayout.pch will be the pre-compiled header
// Yoga.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -12,7 +12,7 @@
using System;
using NUnit.Framework;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[TestFixture]
public class CSSLayoutAbsolutePositionTest
@@ -20,11 +20,11 @@ namespace Facebook.CSSLayout
[Test]
public void Test_absolute_layout_width_height_start_top()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.SetPosition(YogaEdge.Start, 10f);
root_child0.SetPosition(YogaEdge.Top, 10f);
@@ -61,11 +61,11 @@ namespace Facebook.CSSLayout
[Test]
public void Test_absolute_layout_width_height_end_bottom()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.SetPosition(YogaEdge.End, 10f);
root_child0.SetPosition(YogaEdge.Bottom, 10f);
@@ -102,11 +102,11 @@ namespace Facebook.CSSLayout
[Test]
public void Test_absolute_layout_start_top_end_bottom()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.SetPosition(YogaEdge.Start, 10f);
root_child0.SetPosition(YogaEdge.Top, 10f);
@@ -143,11 +143,11 @@ namespace Facebook.CSSLayout
[Test]
public void Test_absolute_layout_width_height_start_top_end_bottom()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.SetPosition(YogaEdge.Start, 10f);
root_child0.SetPosition(YogaEdge.Top, 10f);
@@ -186,19 +186,19 @@ namespace Facebook.CSSLayout
[Test]
public void Test_do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Overflow = YogaOverflow.Hidden;
root.Width = 50f;
root.Height = 50f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.SetPosition(YogaEdge.Start, 0f);
root_child0.SetPosition(YogaEdge.Top, 0f);
root.Insert(0, root_child0);
CSSNode root_child0_child0 = new CSSNode();
YogaNode root_child0_child0 = new YogaNode();
root_child0_child0.Width = 100f;
root_child0_child0.Height = 100f;
root_child0.Insert(0, root_child0_child0);
@@ -242,7 +242,7 @@ namespace Facebook.CSSLayout
[Test]
public void Test_absolute_layout_within_border()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.SetMargin(YogaEdge.Left, 10f);
root.SetMargin(YogaEdge.Top, 10f);
root.SetMargin(YogaEdge.Right, 10f);
@@ -258,7 +258,7 @@ namespace Facebook.CSSLayout
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.SetPosition(YogaEdge.Left, 0f);
root_child0.SetPosition(YogaEdge.Top, 0f);
@@ -266,7 +266,7 @@ namespace Facebook.CSSLayout
root_child0.Height = 50f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.PositionType = YogaPositionType.Absolute;
root_child1.SetPosition(YogaEdge.Right, 0f);
root_child1.SetPosition(YogaEdge.Bottom, 0f);

View File

@@ -12,7 +12,7 @@
using System;
using NUnit.Framework;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[TestFixture]
public class CSSLayoutAlignContentTest
@@ -20,32 +20,32 @@ namespace Facebook.CSSLayout
[Test]
public void Test_align_content_flex_start()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Wrap = YogaWrap.Wrap;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 50f;
root_child0.Height = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 50f;
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 50f;
root_child2.Height = 10f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
YogaNode root_child3 = new YogaNode();
root_child3.Width = 50f;
root_child3.Height = 10f;
root.Insert(3, root_child3);
CSSNode root_child4 = new CSSNode();
YogaNode root_child4 = new YogaNode();
root_child4.Width = 50f;
root_child4.Height = 10f;
root.Insert(4, root_child4);
@@ -119,33 +119,33 @@ namespace Facebook.CSSLayout
[Test]
public void Test_align_content_flex_end()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.AlignContent = YogaAlign.FlexEnd;
root.Wrap = YogaWrap.Wrap;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 50f;
root_child0.Height = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 50f;
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 50f;
root_child2.Height = 10f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
YogaNode root_child3 = new YogaNode();
root_child3.Width = 50f;
root_child3.Height = 10f;
root.Insert(3, root_child3);
CSSNode root_child4 = new CSSNode();
YogaNode root_child4 = new YogaNode();
root_child4.Width = 50f;
root_child4.Height = 10f;
root.Insert(4, root_child4);
@@ -219,33 +219,33 @@ namespace Facebook.CSSLayout
[Test]
public void Test_align_content_center()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.AlignContent = YogaAlign.Center;
root.Wrap = YogaWrap.Wrap;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 50f;
root_child0.Height = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 50f;
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 50f;
root_child2.Height = 10f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
YogaNode root_child3 = new YogaNode();
root_child3.Width = 50f;
root_child3.Height = 10f;
root.Insert(3, root_child3);
CSSNode root_child4 = new CSSNode();
YogaNode root_child4 = new YogaNode();
root_child4.Width = 50f;
root_child4.Height = 10f;
root.Insert(4, root_child4);
@@ -319,29 +319,29 @@ namespace Facebook.CSSLayout
[Test]
public void Test_align_content_stretch()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.AlignContent = YogaAlign.Stretch;
root.Wrap = YogaWrap.Wrap;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 50f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 50f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 50f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
YogaNode root_child3 = new YogaNode();
root_child3.Width = 50f;
root.Insert(3, root_child3);
CSSNode root_child4 = new CSSNode();
YogaNode root_child4 = new YogaNode();
root_child4.Width = 50f;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;

View File

@@ -12,7 +12,7 @@
using System;
using NUnit.Framework;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[TestFixture]
public class CSSLayoutAlignItemsTest
@@ -20,11 +20,11 @@ namespace Facebook.CSSLayout
[Test]
public void Test_align_items_stretch()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root.Insert(0, root_child0);
root.StyleDirection = YogaDirection.LTR;
@@ -57,12 +57,12 @@ namespace Facebook.CSSLayout
[Test]
public void Test_align_items_center()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.AlignItems = YogaAlign.Center;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Height = 10f;
root.Insert(0, root_child0);
@@ -96,12 +96,12 @@ namespace Facebook.CSSLayout
[Test]
public void Test_align_items_flex_start()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.AlignItems = YogaAlign.FlexStart;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Height = 10f;
root.Insert(0, root_child0);
@@ -135,12 +135,12 @@ namespace Facebook.CSSLayout
[Test]
public void Test_align_items_flex_end()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.AlignItems = YogaAlign.FlexEnd;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Height = 10f;
root.Insert(0, root_child0);

View File

@@ -12,7 +12,7 @@
using System;
using NUnit.Framework;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[TestFixture]
public class CSSLayoutAlignSelfTest
@@ -20,11 +20,11 @@ namespace Facebook.CSSLayout
[Test]
public void Test_align_self_center()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.AlignSelf = YogaAlign.Center;
root_child0.Width = 10f;
root_child0.Height = 10f;
@@ -59,11 +59,11 @@ namespace Facebook.CSSLayout
[Test]
public void Test_align_self_flex_end()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.AlignSelf = YogaAlign.FlexEnd;
root_child0.Width = 10f;
root_child0.Height = 10f;
@@ -98,11 +98,11 @@ namespace Facebook.CSSLayout
[Test]
public void Test_align_self_flex_start()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.AlignSelf = YogaAlign.FlexStart;
root_child0.Width = 10f;
root_child0.Height = 10f;
@@ -137,12 +137,12 @@ namespace Facebook.CSSLayout
[Test]
public void Test_align_self_flex_end_override_flex_start()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.AlignItems = YogaAlign.FlexStart;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.AlignSelf = YogaAlign.FlexEnd;
root_child0.Width = 10f;
root_child0.Height = 10f;

View File

@@ -12,7 +12,7 @@
using System;
using NUnit.Framework;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[TestFixture]
public class CSSLayoutBorderTest
@@ -20,7 +20,7 @@ namespace Facebook.CSSLayout
[Test]
public void Test_border_no_size()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.SetBorder(YogaEdge.Left, 10f);
root.SetBorder(YogaEdge.Top, 10f);
root.SetBorder(YogaEdge.Right, 10f);
@@ -45,13 +45,13 @@ namespace Facebook.CSSLayout
[Test]
public void Test_border_container_match_child()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.SetBorder(YogaEdge.Left, 10f);
root.SetBorder(YogaEdge.Top, 10f);
root.SetBorder(YogaEdge.Right, 10f);
root.SetBorder(YogaEdge.Bottom, 10f);
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Height = 10f;
root.Insert(0, root_child0);
@@ -85,7 +85,7 @@ namespace Facebook.CSSLayout
[Test]
public void Test_border_flex_child()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.SetBorder(YogaEdge.Left, 10f);
root.SetBorder(YogaEdge.Top, 10f);
root.SetBorder(YogaEdge.Right, 10f);
@@ -93,7 +93,7 @@ namespace Facebook.CSSLayout
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.Width = 10f;
root.Insert(0, root_child0);
@@ -127,7 +127,7 @@ namespace Facebook.CSSLayout
[Test]
public void Test_border_stretch_child()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.SetBorder(YogaEdge.Left, 10f);
root.SetBorder(YogaEdge.Top, 10f);
root.SetBorder(YogaEdge.Right, 10f);
@@ -135,7 +135,7 @@ namespace Facebook.CSSLayout
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root.Insert(0, root_child0);
root.StyleDirection = YogaDirection.LTR;
@@ -168,7 +168,7 @@ namespace Facebook.CSSLayout
[Test]
public void Test_border_center_child()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.JustifyContent = YogaJustify.Center;
root.AlignItems = YogaAlign.Center;
root.SetBorder(YogaEdge.Start, 10f);
@@ -177,7 +177,7 @@ namespace Facebook.CSSLayout
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Height = 10f;
root.Insert(0, root_child0);

View File

@@ -12,7 +12,7 @@
using System;
using NUnit.Framework;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[TestFixture]
public class CSSLayoutFlexDirectionTest
@@ -20,18 +20,18 @@ namespace Facebook.CSSLayout
[Test]
public void Test_flex_direction_column_no_height()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Height = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -84,19 +84,19 @@ namespace Facebook.CSSLayout
[Test]
public void Test_flex_direction_row_no_width()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -149,19 +149,19 @@ namespace Facebook.CSSLayout
[Test]
public void Test_flex_direction_column()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Height = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -214,20 +214,20 @@ namespace Facebook.CSSLayout
[Test]
public void Test_flex_direction_row()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -280,20 +280,20 @@ namespace Facebook.CSSLayout
[Test]
public void Test_flex_direction_column_reverse()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.ColumnReverse;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Height = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -346,20 +346,20 @@ namespace Facebook.CSSLayout
[Test]
public void Test_flex_direction_row_reverse()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.RowReverse;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;

View File

@@ -12,7 +12,7 @@
using System;
using NUnit.Framework;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[TestFixture]
public class CSSLayoutFlexTest
@@ -20,16 +20,16 @@ namespace Facebook.CSSLayout
[Test]
public void Test_flex_basis_flex_grow_column()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -72,17 +72,17 @@ namespace Facebook.CSSLayout
[Test]
public void Test_flex_basis_flex_grow_row()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -125,16 +125,16 @@ namespace Facebook.CSSLayout
[Test]
public void Test_flex_basis_flex_shrink_column()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexShrink = 1f;
root_child0.FlexBasis = 100f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexBasis = 50f;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -177,17 +177,17 @@ namespace Facebook.CSSLayout
[Test]
public void Test_flex_basis_flex_shrink_row()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexShrink = 1f;
root_child0.FlexBasis = 100f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexBasis = 50f;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -230,21 +230,21 @@ namespace Facebook.CSSLayout
[Test]
public void Test_flex_shrink_to_zero()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Height = 75f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 50f;
root_child0.Height = 50f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexShrink = 1f;
root_child1.Width = 50f;
root_child1.Height = 50f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 50f;
root_child2.Height = 50f;
root.Insert(2, root_child2);
@@ -298,22 +298,22 @@ namespace Facebook.CSSLayout
[Test]
public void Test_flex_basis_overrides_main_size()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.Height = 20f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.FlexGrow = 1f;
root_child2.Height = 10f;
root.Insert(2, root_child2);
@@ -367,14 +367,14 @@ namespace Facebook.CSSLayout
[Test]
public void Test_flex_grow_shrink_at_most()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root.Insert(0, root_child0);
CSSNode root_child0_child0 = new CSSNode();
YogaNode root_child0_child0 = new YogaNode();
root_child0_child0.FlexGrow = 1f;
root_child0_child0.FlexShrink = 1f;
root_child0.Insert(0, root_child0_child0);

View File

@@ -12,7 +12,7 @@
using System;
using NUnit.Framework;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[TestFixture]
public class CSSLayoutFlexWrapTest
@@ -20,26 +20,26 @@ namespace Facebook.CSSLayout
[Test]
public void Test_wrap_column()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Wrap = YogaWrap.Wrap;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 30f;
root_child0.Height = 30f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 30f;
root_child1.Height = 30f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 30f;
root_child2.Height = 30f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
YogaNode root_child3 = new YogaNode();
root_child3.Width = 30f;
root_child3.Height = 30f;
root.Insert(3, root_child3);
@@ -103,27 +103,27 @@ namespace Facebook.CSSLayout
[Test]
public void Test_wrap_row()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Wrap = YogaWrap.Wrap;
root.Width = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 30f;
root_child0.Height = 30f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 30f;
root_child1.Height = 30f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 30f;
root_child2.Height = 30f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
YogaNode root_child3 = new YogaNode();
root_child3.Width = 30f;
root_child3.Height = 30f;
root.Insert(3, root_child3);
@@ -187,28 +187,28 @@ namespace Facebook.CSSLayout
[Test]
public void Test_wrap_row_align_items_flex_end()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.FlexEnd;
root.Wrap = YogaWrap.Wrap;
root.Width = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 30f;
root_child0.Height = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 30f;
root_child1.Height = 20f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 30f;
root_child2.Height = 30f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
YogaNode root_child3 = new YogaNode();
root_child3.Width = 30f;
root_child3.Height = 30f;
root.Insert(3, root_child3);
@@ -272,28 +272,28 @@ namespace Facebook.CSSLayout
[Test]
public void Test_wrap_row_align_items_center()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Center;
root.Wrap = YogaWrap.Wrap;
root.Width = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 30f;
root_child0.Height = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 30f;
root_child1.Height = 20f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 30f;
root_child2.Height = 30f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
YogaNode root_child3 = new YogaNode();
root_child3.Width = 30f;
root_child3.Height = 30f;
root.Insert(3, root_child3);

View File

@@ -12,7 +12,7 @@
using System;
using NUnit.Framework;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[TestFixture]
public class CSSLayoutJustifyContentTest
@@ -20,20 +20,20 @@ namespace Facebook.CSSLayout
[Test]
public void Test_justify_content_row_flex_start()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 102f;
root.Height = 102f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -86,21 +86,21 @@ namespace Facebook.CSSLayout
[Test]
public void Test_justify_content_row_flex_end()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.JustifyContent = YogaJustify.FlexEnd;
root.Width = 102f;
root.Height = 102f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -153,21 +153,21 @@ namespace Facebook.CSSLayout
[Test]
public void Test_justify_content_row_center()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.JustifyContent = YogaJustify.Center;
root.Width = 102f;
root.Height = 102f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -220,21 +220,21 @@ namespace Facebook.CSSLayout
[Test]
public void Test_justify_content_row_space_between()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.JustifyContent = YogaJustify.SpaceBetween;
root.Width = 102f;
root.Height = 102f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -287,21 +287,21 @@ namespace Facebook.CSSLayout
[Test]
public void Test_justify_content_row_space_around()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.JustifyContent = YogaJustify.SpaceAround;
root.Width = 102f;
root.Height = 102f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -354,18 +354,18 @@ namespace Facebook.CSSLayout
[Test]
public void Test_justify_content_column_flex_start()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 102f;
root.Height = 102f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Height = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -418,20 +418,20 @@ namespace Facebook.CSSLayout
[Test]
public void Test_justify_content_column_flex_end()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.JustifyContent = YogaJustify.FlexEnd;
root.Width = 102f;
root.Height = 102f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Height = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -484,20 +484,20 @@ namespace Facebook.CSSLayout
[Test]
public void Test_justify_content_column_center()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.JustifyContent = YogaJustify.Center;
root.Width = 102f;
root.Height = 102f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Height = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -550,20 +550,20 @@ namespace Facebook.CSSLayout
[Test]
public void Test_justify_content_column_space_between()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.JustifyContent = YogaJustify.SpaceBetween;
root.Width = 102f;
root.Height = 102f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Height = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -616,20 +616,20 @@ namespace Facebook.CSSLayout
[Test]
public void Test_justify_content_column_space_around()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.JustifyContent = YogaJustify.SpaceAround;
root.Width = 102f;
root.Height = 102f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Height = 10f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;

View File

@@ -12,7 +12,7 @@
using System;
using NUnit.Framework;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[TestFixture]
public class CSSLayoutMarginTest
@@ -20,12 +20,12 @@ namespace Facebook.CSSLayout
[Test]
public void Test_margin_start()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.SetMargin(YogaEdge.Start, 10f);
root_child0.Width = 10f;
root.Insert(0, root_child0);
@@ -59,11 +59,11 @@ namespace Facebook.CSSLayout
[Test]
public void Test_margin_top()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.SetMargin(YogaEdge.Top, 10f);
root_child0.Height = 10f;
root.Insert(0, root_child0);
@@ -97,13 +97,13 @@ namespace Facebook.CSSLayout
[Test]
public void Test_margin_end()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.JustifyContent = YogaJustify.FlexEnd;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.SetMargin(YogaEdge.End, 10f);
root_child0.Width = 10f;
root.Insert(0, root_child0);
@@ -137,12 +137,12 @@ namespace Facebook.CSSLayout
[Test]
public void Test_margin_bottom()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.JustifyContent = YogaJustify.FlexEnd;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.SetMargin(YogaEdge.Bottom, 10f);
root_child0.Height = 10f;
root.Insert(0, root_child0);
@@ -176,12 +176,12 @@ namespace Facebook.CSSLayout
[Test]
public void Test_margin_and_flex_row()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.SetMargin(YogaEdge.Start, 10f);
root.Insert(0, root_child0);
@@ -215,11 +215,11 @@ namespace Facebook.CSSLayout
[Test]
public void Test_margin_and_flex_column()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.SetMargin(YogaEdge.Top, 10f);
root.Insert(0, root_child0);
@@ -253,12 +253,12 @@ namespace Facebook.CSSLayout
[Test]
public void Test_margin_and_stretch_row()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.SetMargin(YogaEdge.Top, 10f);
root.Insert(0, root_child0);
@@ -292,11 +292,11 @@ namespace Facebook.CSSLayout
[Test]
public void Test_margin_and_stretch_column()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.SetMargin(YogaEdge.Start, 10f);
root.Insert(0, root_child0);
@@ -330,16 +330,16 @@ namespace Facebook.CSSLayout
[Test]
public void Test_margin_with_sibling_row()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -382,15 +382,15 @@ namespace Facebook.CSSLayout
[Test]
public void Test_margin_with_sibling_column()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;

View File

@@ -12,7 +12,7 @@
using System;
using NUnit.Framework;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[TestFixture]
public class CSSLayoutMinMaxDimensionTest
@@ -20,11 +20,11 @@ namespace Facebook.CSSLayout
[Test]
public void Test_max_width()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.MaxWidth = 50f;
root_child0.Height = 10f;
root.Insert(0, root_child0);
@@ -58,12 +58,12 @@ namespace Facebook.CSSLayout
[Test]
public void Test_max_height()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.MaxHeight = 50f;
root.Insert(0, root_child0);
@@ -97,16 +97,16 @@ namespace Facebook.CSSLayout
[Test]
public void Test_min_height()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.MinHeight = 60f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -149,17 +149,17 @@ namespace Facebook.CSSLayout
[Test]
public void Test_min_width()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.MinWidth = 60f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -202,13 +202,13 @@ namespace Facebook.CSSLayout
[Test]
public void Test_justify_content_min_max()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.JustifyContent = YogaJustify.Center;
root.Width = 100f;
root.MinHeight = 100f;
root.MaxHeight = 200f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 60f;
root_child0.Height = 60f;
root.Insert(0, root_child0);
@@ -242,13 +242,13 @@ namespace Facebook.CSSLayout
[Test]
public void Test_align_items_min_max()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.AlignItems = YogaAlign.Center;
root.MinWidth = 100f;
root.MaxWidth = 200f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 60f;
root_child0.Height = 60f;
root.Insert(0, root_child0);
@@ -282,22 +282,22 @@ namespace Facebook.CSSLayout
[Test]
public void Test_justify_content_overflow_min_max()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.JustifyContent = YogaJustify.Center;
root.MinHeight = 100f;
root.MaxHeight = 110f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 50f;
root_child0.Height = 50f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.Width = 50f;
root_child1.Height = 50f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.Width = 50f;
root_child2.Height = 50f;
root.Insert(2, root_child2);
@@ -351,16 +351,16 @@ namespace Facebook.CSSLayout
[Test]
public void Test_flex_grow_within_max_width()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 200f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexDirection = YogaFlexDirection.Row;
root_child0.MaxWidth = 100f;
root.Insert(0, root_child0);
CSSNode root_child0_child0 = new CSSNode();
YogaNode root_child0_child0 = new YogaNode();
root_child0_child0.FlexGrow = 1f;
root_child0_child0.Height = 20f;
root_child0.Insert(0, root_child0_child0);
@@ -404,16 +404,16 @@ namespace Facebook.CSSLayout
[Test]
public void Test_flex_grow_within_constrained_max_width()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 200f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexDirection = YogaFlexDirection.Row;
root_child0.MaxWidth = 300f;
root.Insert(0, root_child0);
CSSNode root_child0_child0 = new CSSNode();
YogaNode root_child0_child0 = new YogaNode();
root_child0_child0.FlexGrow = 1f;
root_child0_child0.Height = 20f;
root_child0.Insert(0, root_child0_child0);

View File

@@ -12,7 +12,7 @@
using System;
using NUnit.Framework;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[TestFixture]
public class CSSLayoutPaddingTest
@@ -20,7 +20,7 @@ namespace Facebook.CSSLayout
[Test]
public void Test_padding_no_size()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.SetPadding(YogaEdge.Left, 10f);
root.SetPadding(YogaEdge.Top, 10f);
root.SetPadding(YogaEdge.Right, 10f);
@@ -45,13 +45,13 @@ namespace Facebook.CSSLayout
[Test]
public void Test_padding_container_match_child()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.SetPadding(YogaEdge.Left, 10f);
root.SetPadding(YogaEdge.Top, 10f);
root.SetPadding(YogaEdge.Right, 10f);
root.SetPadding(YogaEdge.Bottom, 10f);
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Height = 10f;
root.Insert(0, root_child0);
@@ -85,7 +85,7 @@ namespace Facebook.CSSLayout
[Test]
public void Test_padding_flex_child()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.SetPadding(YogaEdge.Left, 10f);
root.SetPadding(YogaEdge.Top, 10f);
root.SetPadding(YogaEdge.Right, 10f);
@@ -93,7 +93,7 @@ namespace Facebook.CSSLayout
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.Width = 10f;
root.Insert(0, root_child0);
@@ -127,7 +127,7 @@ namespace Facebook.CSSLayout
[Test]
public void Test_padding_stretch_child()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.SetPadding(YogaEdge.Left, 10f);
root.SetPadding(YogaEdge.Top, 10f);
root.SetPadding(YogaEdge.Right, 10f);
@@ -135,7 +135,7 @@ namespace Facebook.CSSLayout
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root.Insert(0, root_child0);
root.StyleDirection = YogaDirection.LTR;
@@ -168,7 +168,7 @@ namespace Facebook.CSSLayout
[Test]
public void Test_padding_center_child()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.JustifyContent = YogaJustify.Center;
root.AlignItems = YogaAlign.Center;
root.SetPadding(YogaEdge.Start, 10f);
@@ -177,7 +177,7 @@ namespace Facebook.CSSLayout
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Height = 10f;
root.Insert(0, root_child0);
@@ -211,13 +211,13 @@ namespace Facebook.CSSLayout
[Test]
public void Test_child_with_padding_align_end()
{
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.JustifyContent = YogaJustify.FlexEnd;
root.AlignItems = YogaAlign.FlexEnd;
root.Width = 200f;
root.Height = 200f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.SetPadding(YogaEdge.Left, 20f);
root_child0.SetPadding(YogaEdge.Top, 20f);
root_child0.SetPadding(YogaEdge.Right, 20f);

View File

@@ -12,7 +12,7 @@
using System;
using NUnit.Framework;
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[TestFixture]
public class CSSLayoutRoundingTest
@@ -20,22 +20,22 @@ namespace Facebook.CSSLayout
[Test]
public void Test_rounding_flex_basis_flex_grow_row_width_of_100()
{
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.FlexGrow = 1f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -84,36 +84,36 @@ namespace Facebook.CSSLayout
Assert.AreEqual(33f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_flex_basis_flex_grow_row_prime_number_width()
{
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 113f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.FlexGrow = 1f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
YogaNode root_child3 = new YogaNode();
root_child3.FlexGrow = 1f;
root.Insert(3, root_child3);
CSSNode root_child4 = new CSSNode();
YogaNode root_child4 = new YogaNode();
root_child4.FlexGrow = 1f;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
@@ -182,29 +182,29 @@ namespace Facebook.CSSLayout
Assert.AreEqual(23f, root_child4.LayoutWidth);
Assert.AreEqual(100f, root_child4.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_flex_basis_flex_shrink_row()
{
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 101f;
root.Height = 100f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexShrink = 1f;
root_child0.FlexBasis = 100f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexBasis = 25f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.FlexBasis = 25f;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -253,30 +253,30 @@ namespace Facebook.CSSLayout
Assert.AreEqual(25f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_flex_basis_overrides_main_size()
{
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 113f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.Height = 20f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.FlexGrow = 1f;
root_child2.Height = 10f;
root.Insert(2, root_child2);
@@ -326,30 +326,30 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_total_fractial()
{
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 87.4f;
root.Height = 113.4f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 0.7f;
root_child0.FlexBasis = 50.3f;
root_child0.Height = 20.3f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1.6f;
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.FlexGrow = 1.1f;
root_child2.Height = 10.7f;
root.Insert(2, root_child2);
@@ -399,44 +399,44 @@ namespace Facebook.CSSLayout
Assert.AreEqual(87f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_total_fractial_nested()
{
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 87.4f;
root.Height = 113.4f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 0.7f;
root_child0.FlexBasis = 50.3f;
root_child0.Height = 20.3f;
root.Insert(0, root_child0);
CSSNode root_child0_child0 = new CSSNode();
YogaNode root_child0_child0 = new YogaNode();
root_child0_child0.FlexGrow = 1f;
root_child0_child0.FlexBasis = 0.3f;
root_child0_child0.SetPosition(YogaEdge.Bottom, 13.3f);
root_child0_child0.Height = 9.9f;
root_child0.Insert(0, root_child0_child0);
CSSNode root_child0_child1 = new CSSNode();
YogaNode root_child0_child1 = new YogaNode();
root_child0_child1.FlexGrow = 4f;
root_child0_child1.FlexBasis = 0.3f;
root_child0_child1.SetPosition(YogaEdge.Top, 13.3f);
root_child0_child1.Height = 1.1f;
root_child0.Insert(1, root_child0_child1);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1.6f;
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.FlexGrow = 1.1f;
root_child2.Height = 10.7f;
root.Insert(2, root_child2);
@@ -506,30 +506,30 @@ namespace Facebook.CSSLayout
Assert.AreEqual(87f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_fractial_input_1()
{
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 113.4f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.Height = 20f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.FlexGrow = 1f;
root_child2.Height = 10f;
root.Insert(2, root_child2);
@@ -579,30 +579,30 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_fractial_input_2()
{
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 113.6f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.Height = 20f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.FlexGrow = 1f;
root_child2.Height = 10f;
root.Insert(2, root_child2);
@@ -652,31 +652,31 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(25f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_fractial_input_3()
{
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.SetPosition(YogaEdge.Top, 0.3f);
root.Width = 100f;
root.Height = 113.4f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.Height = 20f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.FlexGrow = 1f;
root_child2.Height = 10f;
root.Insert(2, root_child2);
@@ -726,31 +726,31 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_fractial_input_4()
{
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
YogaNode root = new YogaNode();
root.SetPosition(YogaEdge.Top, 0.7f);
root.Width = 100f;
root.Height = 113.4f;
CSSNode root_child0 = new CSSNode();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.Height = 20f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root_child1.Height = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
YogaNode root_child2 = new YogaNode();
root_child2.FlexGrow = 1f;
root_child2.Height = 10f;
root.Insert(2, root_child2);
@@ -800,7 +800,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
}

View File

@@ -11,18 +11,18 @@ using NUnit.Framework;
using System;
/**
* Tests for {@link CSSNode}.
* Tests for {@link YogaNode}.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[TestFixture]
public class CSSNodeCreateTest
public class YogaNodeCreateTest
{
[Test]
public void TestSimple()
{
CSSNode nodeDefault = new CSSNode();
CSSNode nodeCreated = CSSNode.Create(flexDirection: YogaFlexDirection.Row);
YogaNode nodeDefault = new YogaNode();
YogaNode nodeCreated = YogaNode.Create(flexDirection: YogaFlexDirection.Row);
Assert.AreEqual(YogaFlexDirection.Row, nodeCreated.FlexDirection);
Assert.IsFalse(nodeDefault.IsDirty);
nodeDefault.CopyStyle(nodeCreated);
@@ -32,8 +32,8 @@ namespace Facebook.CSSLayout
[Test]
public void TestSame()
{
CSSNode nodeDefault = new CSSNode();
CSSNode nodeCreated = CSSNode.Create();
YogaNode nodeDefault = new YogaNode();
YogaNode nodeCreated = YogaNode.Create();
Assert.IsFalse(nodeDefault.IsDirty);
nodeDefault.CopyStyle(nodeCreated);
Assert.IsFalse(nodeDefault.IsDirty);
@@ -42,7 +42,7 @@ namespace Facebook.CSSLayout
[Test]
public void TestMultiple()
{
CSSNode node = CSSNode.Create(
YogaNode node = YogaNode.Create(
positionType: YogaPositionType.Absolute,
wrap: YogaWrap.Wrap,
position: new Spacing(top:6, right:4),
@@ -64,7 +64,7 @@ namespace Facebook.CSSLayout
[Test]
public void TestFull()
{
CSSNode node = CSSNode.Create(
YogaNode node = YogaNode.Create(
styleDirection: YogaDirection.RTL,
flexDirection: YogaFlexDirection.RowReverse,
@@ -87,12 +87,12 @@ namespace Facebook.CSSLayout
padding: new Spacing(top: 13, bottom: 14, left: 15, right: 16),
border: new Spacing(top: 17, bottom: 18, left: 19, right: 20),
width: 21,
height: 22,
minWidth: 23,
minHeight: 24,
maxWidth: 25,
maxHeight: 26);
Width: 21,
Height: 22,
MinWidth: 23,
MinHeight: 24,
MaxWidth: 25,
MaxHeight: 26);
Assert.AreEqual(YogaDirection.RTL, node.StyleDirection);
Assert.AreEqual(YogaFlexDirection.RowReverse, node.FlexDirection);

View File

@@ -11,18 +11,18 @@ using NUnit.Framework;
using System;
/**
* Tests for {@link CSSNode}.
* Tests for {@link YogaNode}.
*/
namespace Facebook.CSSLayout
namespace Facebook.Yoga
{
[TestFixture]
public class CSSNodeTest
public class YogaNodeTest
{
[Test]
public void TestAddChildGetParent()
{
CSSNode parent = new CSSNode();
CSSNode child = new CSSNode();
YogaNode parent = new YogaNode();
YogaNode child = new YogaNode();
Assert.IsNull(child.Parent);
Assert.AreEqual(0, parent.Count);
@@ -42,22 +42,22 @@ namespace Facebook.CSSLayout
[Test]
public void TestChildren()
{
CSSNode parent = new CSSNode();
foreach (CSSNode node in parent) {
YogaNode parent = new YogaNode();
foreach (YogaNode node in parent) {
Assert.Fail(node.ToString());
}
CSSNode child0 = new CSSNode();
YogaNode child0 = new YogaNode();
Assert.AreEqual(-1, parent.IndexOf(child0));
parent.Insert(0, child0);
foreach (CSSNode node in parent) {
foreach (YogaNode node in parent) {
Assert.AreEqual(0, parent.IndexOf(node));
}
CSSNode child1 = new CSSNode();
YogaNode child1 = new YogaNode();
parent.Insert(1, child1);
int index = 0;
foreach (CSSNode node in parent) {
foreach (YogaNode node in parent) {
Assert.AreEqual(index++, parent.IndexOf(node));
}
@@ -76,7 +76,7 @@ namespace Facebook.CSSLayout
[ExpectedException("System.NullReferenceException")]
public void TestRemoveAtFromEmpty()
{
CSSNode parent = new CSSNode();
YogaNode parent = new YogaNode();
parent.RemoveAt(0);
}
@@ -84,8 +84,8 @@ namespace Facebook.CSSLayout
[ExpectedException("System.ArgumentOutOfRangeException")]
public void TestRemoveAtOutOfRange()
{
CSSNode parent = new CSSNode();
CSSNode child = new CSSNode();
YogaNode parent = new YogaNode();
YogaNode child = new YogaNode();
parent.Insert(0, child);
parent.RemoveAt(1);
}
@@ -94,9 +94,9 @@ namespace Facebook.CSSLayout
[ExpectedException("System.InvalidOperationException")]
public void TestCannotAddChildToMultipleParents()
{
CSSNode parent1 = new CSSNode();
CSSNode parent2 = new CSSNode();
CSSNode child = new CSSNode();
YogaNode parent1 = new YogaNode();
YogaNode parent2 = new YogaNode();
YogaNode child = new YogaNode();
parent1.Insert(0, child);
parent2.Insert(0, child);
@@ -105,19 +105,19 @@ namespace Facebook.CSSLayout
[Test]
public void TestReset()
{
int instanceCount = CSSNode.GetInstanceCount();
CSSNode node = new CSSNode();
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
int instanceCount = YogaNode.GetInstanceCount();
YogaNode node = new YogaNode();
Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
node.Reset();
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
}
[Test]
[ExpectedException("System.InvalidOperationException")]
public void TestResetParent()
{
CSSNode parent = new CSSNode();
CSSNode child = new CSSNode();
YogaNode parent = new YogaNode();
YogaNode child = new YogaNode();
parent.Insert(0, child);
parent.Reset();
}
@@ -126,8 +126,8 @@ namespace Facebook.CSSLayout
[ExpectedException("System.InvalidOperationException")]
public void TestResetChild()
{
CSSNode parent = new CSSNode();
CSSNode child = new CSSNode();
YogaNode parent = new YogaNode();
YogaNode child = new YogaNode();
parent.Insert(0, child);
child.Reset();
}
@@ -135,24 +135,24 @@ namespace Facebook.CSSLayout
[Test]
public void TestClear()
{
int instanceCount = CSSNode.GetInstanceCount();
CSSNode parent = new CSSNode();
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
CSSNode child = new CSSNode();
Assert.AreEqual(instanceCount + 2, CSSNode.GetInstanceCount());
int instanceCount = YogaNode.GetInstanceCount();
YogaNode parent = new YogaNode();
Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
YogaNode child = new YogaNode();
Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount());
parent.Insert(0, child);
Assert.AreEqual(1, parent.Count);
Assert.AreEqual(parent, child.Parent);
parent.Clear();
Assert.AreEqual(0, parent.Count);
Assert.IsNull(child.Parent);
Assert.AreEqual(instanceCount + 2, CSSNode.GetInstanceCount());
Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount());
}
[Test]
public void TestMeasureFunc()
{
CSSNode node = new CSSNode();
YogaNode node = new YogaNode();
node.SetMeasureFunction((_, width, widthMode, height, heightMode) => {
return MeasureOutput.Make(100, 150);
});
@@ -164,7 +164,7 @@ namespace Facebook.CSSLayout
[Test]
public void TestMeasureFuncWithFloat()
{
CSSNode node = new CSSNode();
YogaNode node = new YogaNode();
node.SetMeasureFunction((_, width, widthMode, height, heightMode) => {
return MeasureOutput.Make(123.4f, 81.7f);
});
@@ -177,11 +177,11 @@ namespace Facebook.CSSLayout
[ExpectedException("System.InvalidOperationException")]
public void TestChildWithMeasureFunc()
{
CSSNode node = new CSSNode();
YogaNode node = new YogaNode();
node.SetMeasureFunction((_, width, widthMode, height, heightMode) => {
return MeasureOutput.Make(100, 150);
});
CSSNode child = new CSSNode();
YogaNode child = new YogaNode();
node.Insert(0, child);
}
@@ -189,8 +189,8 @@ namespace Facebook.CSSLayout
[ExpectedException("System.InvalidOperationException")]
public void TestMeasureFuncWithChild()
{
CSSNode node = new CSSNode();
CSSNode child = new CSSNode();
YogaNode node = new YogaNode();
YogaNode child = new YogaNode();
node.Insert(0, child);
node.SetMeasureFunction((_, width, widthMode, height, heightMode) => {
return MeasureOutput.Make(100, 150);
@@ -200,13 +200,13 @@ namespace Facebook.CSSLayout
[Test]
public void TestPrint()
{
CSSNode parent = new CSSNode();
YogaNode parent = new YogaNode();
parent.Width = 100;
parent.Height = 120;
CSSNode child0 = new CSSNode();
YogaNode child0 = new YogaNode();
child0.Width = 30;
child0.Height = 40;
CSSNode child1 = new CSSNode();
YogaNode child1 = new YogaNode();
child1.Width = 35;
child1.Height = 45;
parent.Insert(0, child0);
@@ -218,10 +218,10 @@ namespace Facebook.CSSLayout
[Test]
public void TestCopyStyle()
{
CSSNode node0 = new CSSNode();
YogaNode node0 = new YogaNode();
Assert.IsTrue(YogaConstants.IsUndefined(node0.MaxHeight));
CSSNode node1 = new CSSNode();
YogaNode node1 = new YogaNode();
node1.MaxHeight = 100;
node0.CopyStyle(node1);
@@ -239,17 +239,17 @@ namespace Facebook.CSSLayout
public void TestDestructor()
{
ForceGC();
int instanceCount = CSSNode.GetInstanceCount();
int instanceCount = YogaNode.GetInstanceCount();
TestDestructorForGC(instanceCount);
ForceGC();
Assert.AreEqual(instanceCount, CSSNode.GetInstanceCount());
Assert.AreEqual(instanceCount, YogaNode.GetInstanceCount());
}
private void TestDestructorForGC(int instanceCount)
{
CSSNode node = new CSSNode();
YogaNode node = new YogaNode();
Assert.IsNotNull(node);
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
node = null;
}
@@ -257,32 +257,32 @@ namespace Facebook.CSSLayout
public void TestDestructorWithChildren()
{
ForceGC();
int instanceCount = CSSNode.GetInstanceCount();
int instanceCount = YogaNode.GetInstanceCount();
TestDestructorWithChildrenForGC1(instanceCount);
ForceGC();
Assert.AreEqual(instanceCount, CSSNode.GetInstanceCount());
Assert.AreEqual(instanceCount, YogaNode.GetInstanceCount());
}
private void TestDestructorWithChildrenForGC1(int instanceCount)
{
CSSNode node = new CSSNode();
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
YogaNode node = new YogaNode();
Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
TestDestructorWithChildrenForGC2(node, instanceCount + 1);
ForceGC();
Assert.AreEqual(instanceCount + 2, CSSNode.GetInstanceCount());
Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount());
TestDestructorWithChildrenForGC2(node, instanceCount + 2);
ForceGC();
Assert.AreEqual(instanceCount + 3, CSSNode.GetInstanceCount());
Assert.AreEqual(instanceCount + 3, YogaNode.GetInstanceCount());
node = null;
}
private void TestDestructorWithChildrenForGC2(CSSNode parent, int instanceCount)
private void TestDestructorWithChildrenForGC2(YogaNode parent, int instanceCount)
{
CSSNode child = new CSSNode();
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
YogaNode child = new YogaNode();
Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
parent.Insert(0, child);
child = null;
@@ -292,21 +292,21 @@ namespace Facebook.CSSLayout
public void TestParentDestructor()
{
ForceGC();
int instanceCount = CSSNode.GetInstanceCount();
CSSNode child = new CSSNode();
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
int instanceCount = YogaNode.GetInstanceCount();
YogaNode child = new YogaNode();
Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
TestParentDestructorForGC(child, instanceCount + 1);
ForceGC();
Assert.IsNull(child.Parent);
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
}
private void TestParentDestructorForGC(CSSNode child, int instanceCount)
private void TestParentDestructorForGC(YogaNode child, int instanceCount)
{
CSSNode parent = new CSSNode();
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
YogaNode parent = new YogaNode();
Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
parent.Insert(0, child);
}
@@ -314,22 +314,22 @@ namespace Facebook.CSSLayout
public void TestClearWithChildDestructor()
{
ForceGC();
int instanceCount = CSSNode.GetInstanceCount();
CSSNode node = new CSSNode();
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
int instanceCount = YogaNode.GetInstanceCount();
YogaNode node = new YogaNode();
Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
TestClearWithChildDestructorForGC(node, instanceCount + 1);
ForceGC();
Assert.AreEqual(instanceCount + 2, CSSNode.GetInstanceCount());
Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount());
node.Clear();
Assert.AreEqual(0, node.Count);
ForceGC();
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
}
private void TestClearWithChildDestructorForGC(CSSNode parent, int instanceCount)
private void TestClearWithChildDestructorForGC(YogaNode parent, int instanceCount)
{
CSSNode child = new CSSNode();
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
YogaNode child = new YogaNode();
Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
parent.Insert(0, child);
}
@@ -337,20 +337,20 @@ namespace Facebook.CSSLayout
public void TestMeasureFuncWithDestructor()
{
ForceGC();
int instanceCount = CSSNode.GetInstanceCount();
CSSNode parent = new CSSNode();
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
int instanceCount = YogaNode.GetInstanceCount();
YogaNode parent = new YogaNode();
Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
TestMeasureFuncWithDestructorForGC(parent);
ForceGC();
Assert.AreEqual(instanceCount + 2, CSSNode.GetInstanceCount());
Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount());
parent.CalculateLayout();
Assert.AreEqual(120, (int)parent.LayoutWidth);
Assert.AreEqual(130, (int)parent.LayoutHeight);
}
private void TestMeasureFuncWithDestructorForGC(CSSNode parent)
private void TestMeasureFuncWithDestructorForGC(YogaNode parent)
{
CSSNode child = new CSSNode();
YogaNode child = new YogaNode();
parent.Insert(0, child);
child.SetMeasureFunction((_, width, widthMode, height, heightMode) => {
return MeasureOutput.Make(120, 130);

View File

@@ -28,6 +28,6 @@ if [ -d $NUNIT \
rm NUnit-2.6.4.zip
fi
clang -g -Wall -Wextra -dynamiclib -o libCSSLayout.dylib -I../../.. ../../../CSSLayout/*.c ../../CSSLayout/CSSInterop.cpp
mcs -debug -t:library -r:$NUNIT/nunit.framework.dll -out:CSSLayoutTest.dll *.cs ../../../csharp/Facebook.CSSLayout/*cs
MONO_PATH=$NUNIT mono --arch=64 --debug $NUNIT/nunit-console.exe CSSLayoutTest.dll
clang -g -Wall -Wextra -dynamiclib -o libyoga.dylib -I../../.. ../../../CSSLayout/*.c ../../Yoga/YGInterop.cpp
mcs -debug -t:library -r:$NUNIT/nunit.framework.dll -out:YogaTest.dll *.cs ../../../csharp/Facebook.Yoga/*cs
MONO_PATH=$NUNIT mono --arch=64 --debug $NUNIT/nunit-console.exe YogaTest.dll

View File

@@ -175,9 +175,9 @@ for name, values in ENUMS.items():
# write out csharp files
for name, values in ENUMS.items():
with open(root + '/csharp/Facebook.CSSLayout/Yoga%s.cs' % name, 'w') as f:
with open(root + '/csharp/Facebook.Yoga/Yoga%s.cs' % name, 'w') as f:
f.write(LICENSE)
f.write('namespace Facebook.CSSLayout\n{\n')
f.write('namespace Facebook.Yoga\n{\n')
f.write(' public enum Yoga%s\n {\n' % name)
for value in values:
if isinstance(value, tuple):

View File

@@ -19,13 +19,13 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
'using System;',
'using NUnit.Framework;',
'',
'namespace Facebook.CSSLayout',
'namespace Facebook.Yoga',
'{',
]);
this.pushIndent();
this.push([
'[TestFixture]',
'public class CSSNodeLayoutTest',
'public class YogaTest',
'{',
]);
this.pushIndent();
@@ -39,21 +39,21 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
if (experiments.length > 0) {
for (var i in experiments) {
this.push('CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.' + experiments[i] +', true);');
this.push('YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.' + experiments[i] +', true);');
}
this.push('');
}
}},
emitTestTreePrologue:{value:function(nodeName) {
this.push('CSSNode ' + nodeName + ' = new CSSNode();');
this.push('YogaNode ' + nodeName + ' = new YogaNode();');
}},
emitTestEpilogue:{value:function(experiments) {
if (experiments.length > 0) {
this.push('');
for (var i in experiments) {
this.push('CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.' + experiments[i] +', false);');
this.push('YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.' + experiments[i] +', false);');
}
}

View File

@@ -44,8 +44,8 @@ Dir['fixtures/*.html'].each do |file|
f.write eval(logs[1].message.sub(/^[^"]*/, '')).sub('CSSNodeLayoutTest', name)
f.close
f = File.open("../csharp/tests/Facebook.CSSLayout/#{name}.cs", 'w')
f.write eval(logs[2].message.sub(/^[^"]*/, '')).sub('CSSNodeLayoutTest', name)
f = File.open("../csharp/tests/Facebook.Yoga/#{name}.cs", 'w')
f.write eval(logs[2].message.sub(/^[^"]*/, '')).sub('YogaTest', name)
f.close
end
File.delete('test.html')