diff --git a/csharp/.gitignore b/csharp/.gitignore deleted file mode 100644 index 0f3547e370..0000000000 --- a/csharp/.gitignore +++ /dev/null @@ -1,272 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml -tests/Facebook.Yoga/NUnit-[0-9\.]*/ -tests/Facebook.Yoga/YogaTest.dll -tests/Facebook.Yoga/YogaTest.dll.mdb -tests/Facebook.Yoga/libyoga.dylib - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# DNX -project.lock.json -project.fragment.lock.json -artifacts/ - -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/packages/* -# except build/, which is used as an MSBuild target. -!**/packages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/packages/repositories.config -# NuGet v3's project.json files produces more ignoreable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -node_modules/ -orleans.codegen.cs - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# SQL Server files -*.mdf -*.ldf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml - -# CodeRush -.cr/ - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# local buck build -lib/ diff --git a/csharp/Android/.gitignore b/csharp/Android/.gitignore deleted file mode 100644 index c3af857904..0000000000 --- a/csharp/Android/.gitignore +++ /dev/null @@ -1 +0,0 @@ -lib/ diff --git a/csharp/Android/Facebook.Yoga.Android.Tests/Facebook.Yoga.Android.Tests.csproj b/csharp/Android/Facebook.Yoga.Android.Tests/Facebook.Yoga.Android.Tests.csproj deleted file mode 100644 index 876ebb5288..0000000000 --- a/csharp/Android/Facebook.Yoga.Android.Tests/Facebook.Yoga.Android.Tests.csproj +++ /dev/null @@ -1,63 +0,0 @@ - - - - Debug - AnyCPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6} - {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - Facebook.Yoga.Android.Tests - Facebook.Yoga.Android.Tests - v7.1 - True - Resources\Resource.designer.cs - Resource - Resources - Assets - true - Properties\AndroidManifest.xml - - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - None - - - true - pdbonly - true - bin\Release - prompt - 4 - true - false - - - - - - - - - - - - - - - - - - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363} - Facebook.Yoga.Android - - - - - \ No newline at end of file diff --git a/csharp/Android/Facebook.Yoga.Android.Tests/MainActivity.cs b/csharp/Android/Facebook.Yoga.Android.Tests/MainActivity.cs deleted file mode 100644 index aac02bf3c7..0000000000 --- a/csharp/Android/Facebook.Yoga.Android.Tests/MainActivity.cs +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System.Reflection; -using Android.App; -using Android.OS; -using Xamarin.Android.NUnitLite; - -namespace Facebook.Yoga.Android.Tests -{ - [Activity(Label = "Facebook.Yoga.Android.Tests", MainLauncher = true)] - public class MainActivity : TestSuiteActivity - { - protected override void OnCreate(Bundle bundle) - { - AddTest(Assembly.GetExecutingAssembly()); - base.OnCreate(bundle); - } - } -} diff --git a/csharp/Android/Facebook.Yoga.Android.Tests/Properties/AndroidManifest.xml b/csharp/Android/Facebook.Yoga.Android.Tests/Properties/AndroidManifest.xml deleted file mode 100644 index fd00462f4f..0000000000 --- a/csharp/Android/Facebook.Yoga.Android.Tests/Properties/AndroidManifest.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - diff --git a/csharp/Android/Facebook.Yoga.Android.Tests/Resources/Resource.designer.cs b/csharp/Android/Facebook.Yoga.Android.Tests/Resources/Resource.designer.cs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/csharp/Android/Facebook.Yoga.Android.sln b/csharp/Android/Facebook.Yoga.Android.sln deleted file mode 100644 index 46e57ed95d..0000000000 --- a/csharp/Android/Facebook.Yoga.Android.sln +++ /dev/null @@ -1,33 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Android.Tests", "Facebook.Yoga.Android.Tests\Facebook.Yoga.Android.Tests.csproj", "{2021459E-8FB1-44A4-89F1-E291769CD2C6}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Android", "Facebook.Yoga.Android\Facebook.Yoga.Android.csproj", "{EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{4804A8E6-E7B7-4F9E-A446-3DE8E73DB38A}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared.Tests", "..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.shproj", "{4EDC82D9-A201-4831-8FE0-98F468F8E4AE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Release|Any CPU.Build.0 = Release|Any CPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {91C42D32-291D-4B72-90B4-551663D60B8B} = {4804A8E6-E7B7-4F9E-A446-3DE8E73DB38A} - {4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {4804A8E6-E7B7-4F9E-A446-3DE8E73DB38A} - EndGlobalSection -EndGlobal diff --git a/csharp/Android/Facebook.Yoga.Android/CustomBuildAction.targets b/csharp/Android/Facebook.Yoga.Android/CustomBuildAction.targets deleted file mode 100644 index 7ee8767ce4..0000000000 --- a/csharp/Android/Facebook.Yoga.Android/CustomBuildAction.targets +++ /dev/null @@ -1,20 +0,0 @@ - - - - NativeLibraryARMV7;NativeLibraryX86;$(BuildDependsOn) - - - - - - - - - - - diff --git a/csharp/Android/Facebook.Yoga.Android/Facebook.Yoga.Android.csproj b/csharp/Android/Facebook.Yoga.Android/Facebook.Yoga.Android.csproj deleted file mode 100644 index a1ed698909..0000000000 --- a/csharp/Android/Facebook.Yoga.Android/Facebook.Yoga.Android.csproj +++ /dev/null @@ -1,64 +0,0 @@ - - - - Debug - AnyCPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363} - {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - Facebook.Yoga.Android - Facebook.Yoga - v7.1 - Resources\Resource.designer.cs - Resource - Resources - Assets - true - - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - None - arm64-v8a;armeabi;armeabi-v7a;x86 - - - true - pdbonly - true - bin\Release - prompt - 4 - true - false - - - - - - - - - - - - - - - - - Always - - - Always - - - - - - \ No newline at end of file diff --git a/csharp/Android/Facebook.Yoga.Android/Resources/Resource.designer.cs b/csharp/Android/Facebook.Yoga.Android/Resources/Resource.designer.cs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/csharp/Facebook.Yoga.Xamarin.sln b/csharp/Facebook.Yoga.Xamarin.sln deleted file mode 100644 index 3b5f07a1fc..0000000000 --- a/csharp/Facebook.Yoga.Xamarin.sln +++ /dev/null @@ -1,130 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Android", "Android", "{B674A497-DC8E-4286-A889-0C004235AA18}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "iOS", "iOS", "{AC14A7DE-A180-46EC-8A88-77F60E73A099}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{09905D88-652D-4A72-8521-6CB1AF347795}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "macOS", "macOS", "{9BDE3670-188E-470F-9B89-CEC0EB042AB5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS", "iOS\Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj", "{128FB32A-C4A1-4363-BF06-0A36E700B7FA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS.Tests", "iOS\Facebook.Yoga.iOS.Tests\Facebook.Yoga.iOS.Tests.csproj", "{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared.Tests", "tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.shproj", "{4EDC82D9-A201-4831-8FE0-98F468F8E4AE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Android", "Android\Facebook.Yoga.Android\Facebook.Yoga.Android.csproj", "{EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Android.Tests", "Android\Facebook.Yoga.Android.Tests\Facebook.Yoga.Android.Tests.csproj", "{2021459E-8FB1-44A4-89F1-E291769CD2C6}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nuspec", "nuspec", "{2C3685DB-91B9-4207-9446-1C513DB36978}" - ProjectSection(SolutionItems) = preProject - nuget\Facebook.Yoga.dll.config = nuget\Facebook.Yoga.dll.config - nuget\Facebook.Yoga.nuspec = nuget\Facebook.Yoga.nuspec - nuget\Facebook.Yoga.OSX.targets = nuget\Facebook.Yoga.OSX.targets - nuget\Facebook.Yoga.targets = nuget\Facebook.Yoga.targets - nuget\Facebook.Yoga.Universal.targets = nuget\Facebook.Yoga.Universal.targets - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac", "Mac\Facebook.Yoga.Mac.csproj", "{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac.Tests", "Mac\Facebook.Yoga.Mac.Tests\Facebook.Yoga.Mac.Tests.csproj", "{9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Release|iPhone = Release|iPhone - Release|iPhoneSimulator = Release|iPhoneSimulator - Debug|iPhone = Debug|iPhone - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.Build.0 = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.ActiveCfg = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.Build.0 = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.Build.0 = Debug|Any CPU - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|Any CPU.ActiveCfg = Release|iPhone - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|Any CPU.Build.0 = Release|iPhone - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhone.ActiveCfg = Release|iPhone - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhone.Build.0 = Release|iPhone - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhone.ActiveCfg = Debug|iPhone - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhone.Build.0 = Debug|iPhone - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Release|Any CPU.Build.0 = Release|Any CPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Release|iPhone.ActiveCfg = Release|Any CPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Release|iPhone.Build.0 = Release|Any CPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Debug|iPhone.Build.0 = Debug|Any CPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Release|Any CPU.Build.0 = Release|Any CPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Release|iPhone.ActiveCfg = Release|Any CPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Release|iPhone.Build.0 = Release|Any CPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {2021459E-8FB1-44A4-89F1-E291769CD2C6}.Debug|iPhone.Build.0 = Debug|Any CPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|Any CPU.Build.0 = Debug|Any CPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|Any CPU.ActiveCfg = Release|Any CPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|Any CPU.Build.0 = Release|Any CPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|iPhone.ActiveCfg = Release|Any CPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|iPhone.Build.0 = Release|Any CPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|iPhone.Build.0 = Debug|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Release|Any CPU.Build.0 = Release|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Release|iPhone.ActiveCfg = Release|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Release|iPhone.Build.0 = Release|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Debug|iPhone.Build.0 = Debug|Any CPU - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {128FB32A-C4A1-4363-BF06-0A36E700B7FA} = {AC14A7DE-A180-46EC-8A88-77F60E73A099} - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71} = {AC14A7DE-A180-46EC-8A88-77F60E73A099} - {91C42D32-291D-4B72-90B4-551663D60B8B} = {09905D88-652D-4A72-8521-6CB1AF347795} - {4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {09905D88-652D-4A72-8521-6CB1AF347795} - {EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363} = {B674A497-DC8E-4286-A889-0C004235AA18} - {2021459E-8FB1-44A4-89F1-E291769CD2C6} = {B674A497-DC8E-4286-A889-0C004235AA18} - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71} = {9BDE3670-188E-470F-9B89-CEC0EB042AB5} - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77} = {9BDE3670-188E-470F-9B89-CEC0EB042AB5} - EndGlobalSection -EndGlobal diff --git a/csharp/Facebook.Yoga/BaselineFunction.cs b/csharp/Facebook.Yoga/BaselineFunction.cs deleted file mode 100644 index 098ef3b714..0000000000 --- a/csharp/Facebook.Yoga/BaselineFunction.cs +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -namespace Facebook.Yoga -{ - public delegate float BaselineFunction(YogaNode node, float width, float height); -} diff --git a/csharp/Facebook.Yoga/Facebook.Yoga.Shared.projitems b/csharp/Facebook.Yoga/Facebook.Yoga.Shared.projitems deleted file mode 100644 index cf020c6cfc..0000000000 --- a/csharp/Facebook.Yoga/Facebook.Yoga.Shared.projitems +++ /dev/null @@ -1,45 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - 91c42d32-291d-4b72-90b4-551663d60b8b - - - Facebook.Yoga.Shared - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/csharp/Facebook.Yoga/Facebook.Yoga.Shared.shproj b/csharp/Facebook.Yoga/Facebook.Yoga.Shared.shproj deleted file mode 100644 index 6d2da463c2..0000000000 --- a/csharp/Facebook.Yoga/Facebook.Yoga.Shared.shproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - 91c42d32-291d-4b72-90b4-551663d60b8b - 14.0 - - - - - - - - diff --git a/csharp/Facebook.Yoga/Logger.cs b/csharp/Facebook.Yoga/Logger.cs deleted file mode 100644 index 3335e7fe3a..0000000000 --- a/csharp/Facebook.Yoga/Logger.cs +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -namespace Facebook.Yoga -{ - public delegate void Logger( - YogaConfig config, - YogaNode node, - YogaLogLevel level, - string message); -} diff --git a/csharp/Facebook.Yoga/MeasureFunction.cs b/csharp/Facebook.Yoga/MeasureFunction.cs deleted file mode 100644 index 96914b3661..0000000000 --- a/csharp/Facebook.Yoga/MeasureFunction.cs +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -namespace Facebook.Yoga -{ - public delegate YogaSize MeasureFunction( - YogaNode node, - float width, - YogaMeasureMode widthMode, - float height, - YogaMeasureMode heightMode); -} diff --git a/csharp/Facebook.Yoga/MeasureOutput.cs b/csharp/Facebook.Yoga/MeasureOutput.cs deleted file mode 100644 index 4d445154b6..0000000000 --- a/csharp/Facebook.Yoga/MeasureOutput.cs +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -namespace Facebook.Yoga -{ - public class MeasureOutput - { - public static YogaSize Make(float width, float height) - { - return new YogaSize { width = width, height = height}; - } - } -} diff --git a/csharp/Facebook.Yoga/Native.cs b/csharp/Facebook.Yoga/Native.cs deleted file mode 100644 index f22e58886d..0000000000 --- a/csharp/Facebook.Yoga/Native.cs +++ /dev/null @@ -1,397 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Facebook.Yoga -{ - internal static class Native - { -#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__ - private const string DllName = "__Internal"; -#else - private const string DllName = "yoga"; -#endif - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGInteropSetLogger( - [MarshalAs(UnmanagedType.FunctionPtr)] YogaLogger logger); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YGNodeHandle YGNodeNew(); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YGNodeHandle YGNodeNewWithConfig(YGConfigHandle config); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeFree(IntPtr node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeReset(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YGConfigHandle YGConfigGetDefault(); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YGConfigHandle YGConfigNew(); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGConfigFree(IntPtr node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern int YGConfigGetInstanceCount(); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGConfigSetExperimentalFeatureEnabled( - YGConfigHandle config, - YogaExperimentalFeature feature, - bool enabled); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern bool YGConfigIsExperimentalFeatureEnabled( - YGConfigHandle config, - YogaExperimentalFeature feature); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGConfigSetUseWebDefaults( - YGConfigHandle config, - bool useWebDefaults); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern bool YGConfigGetUseWebDefaults(YGConfigHandle config); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGConfigSetUseLegacyStretchBehaviour( - YGConfigHandle config, - bool useLegacyStretchBehavior); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern bool YGConfigGetUseLegacyStretchBehaviour(YGConfigHandle config); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGConfigSetErrata(YGConfigHandle config, YogaErrata errata); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaErrata YGConfigGetErrata(YGConfigHandle config); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGConfigSetPointScaleFactor( - YGConfigHandle config, - float pixelsInPoint); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeInsertChild( - YGNodeHandle node, - YGNodeHandle child, - uint index); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeRemoveChild(YGNodeHandle node, YGNodeHandle child); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeSetIsReferenceBaseline( - YGNodeHandle node, - bool isReferenceBaseline); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern bool YGNodeIsReferenceBaseline(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeCalculateLayout( - YGNodeHandle node, - float availableWidth, - float availableHeight, - YogaDirection parentDirection); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeMarkDirty(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - [return: MarshalAs(UnmanagedType.I1)] - public static extern bool YGNodeIsDirty(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodePrint(YGNodeHandle node, YogaPrintOptions options); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeCopyStyle(YGNodeHandle dstNode, YGNodeHandle srcNode); - -#region YG_NODE_PROPERTY - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeSetMeasureFunc( - YGNodeHandle node, - [MarshalAs(UnmanagedType.FunctionPtr)] YogaMeasureFunc measureFunc); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeSetBaselineFunc( - YGNodeHandle node, - [MarshalAs(UnmanagedType.FunctionPtr)] YogaBaselineFunc baselineFunc); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeSetHasNewLayout( - YGNodeHandle node, - [MarshalAs(UnmanagedType.I1)] bool hasNewLayout); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - [return: MarshalAs(UnmanagedType.I1)] - public static extern bool YGNodeGetHasNewLayout(YGNodeHandle node); - -#endregion - -#region YG_NODE_STYLE_PROPERTY - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetDirection(YGNodeHandle node, YogaDirection direction); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaDirection YGNodeStyleGetDirection(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetFlexDirection(YGNodeHandle node, YogaFlexDirection flexDirection); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaFlexDirection YGNodeStyleGetFlexDirection(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetJustifyContent(YGNodeHandle node, YogaJustify justifyContent); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaJustify YGNodeStyleGetJustifyContent(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetAlignContent(YGNodeHandle node, YogaAlign alignContent); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaAlign YGNodeStyleGetAlignContent(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetAlignItems(YGNodeHandle node, YogaAlign alignItems); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaAlign YGNodeStyleGetAlignItems(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetAlignSelf(YGNodeHandle node, YogaAlign alignSelf); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaAlign YGNodeStyleGetAlignSelf(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetPositionType(YGNodeHandle node, YogaPositionType positionType); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaPositionType YGNodeStyleGetPositionType(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetFlexWrap(YGNodeHandle node, YogaWrap flexWrap); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaWrap YGNodeStyleGetFlexWrap(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetOverflow(YGNodeHandle node, YogaOverflow flexWrap); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaOverflow YGNodeStyleGetOverflow(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetDisplay(YGNodeHandle node, YogaDisplay display); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaDisplay YGNodeStyleGetDisplay(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetFlex(YGNodeHandle node, float flex); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetFlexGrow(YGNodeHandle node, float flexGrow); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern float YGNodeStyleGetFlexGrow(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetFlexShrink(YGNodeHandle node, float flexShrink); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern float YGNodeStyleGetFlexShrink(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetFlexBasis(YGNodeHandle node, float flexBasis); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetFlexBasisPercent(YGNodeHandle node, float flexBasis); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetFlexBasisAuto(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaValue YGNodeStyleGetFlexBasis(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetWidth(YGNodeHandle node, float width); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetWidthPercent(YGNodeHandle node, float width); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetWidthAuto(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaValue YGNodeStyleGetWidth(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetHeight(YGNodeHandle node, float height); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetHeightPercent(YGNodeHandle node, float height); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetHeightAuto(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaValue YGNodeStyleGetHeight(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetMinWidth(YGNodeHandle node, float minWidth); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetMinWidthPercent(YGNodeHandle node, float minWidth); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaValue YGNodeStyleGetMinWidth(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetMinHeight(YGNodeHandle node, float minHeight); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetMinHeightPercent(YGNodeHandle node, float minHeight); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaValue YGNodeStyleGetMinHeight(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetMaxWidth(YGNodeHandle node, float maxWidth); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetMaxWidthPercent(YGNodeHandle node, float maxWidth); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaValue YGNodeStyleGetMaxWidth(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetMaxHeight(YGNodeHandle node, float maxHeight); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetMaxHeightPercent(YGNodeHandle node, float maxHeight); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaValue YGNodeStyleGetMaxHeight(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetAspectRatio(YGNodeHandle node, float aspectRatio); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern float YGNodeStyleGetAspectRatio(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetGap(YGNodeHandle node, YogaGutter gutter, float gapLength); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern float YGNodeStyleGetGap(YGNodeHandle node, YogaGutter gutter); - -#endregion - -#region YG_NODE_STYLE_EDGE_PROPERTY - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetPosition(YGNodeHandle node, YogaEdge edge, float position); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetPositionPercent(YGNodeHandle node, YogaEdge edge, float position); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaValue YGNodeStyleGetPosition(YGNodeHandle node, YogaEdge edge); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetMargin(YGNodeHandle node, YogaEdge edge, float margin); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetMarginPercent(YGNodeHandle node, YogaEdge edge, float margin); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetMarginAuto(YGNodeHandle node, YogaEdge edge); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaValue YGNodeStyleGetMargin(YGNodeHandle node, YogaEdge edge); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetPadding(YGNodeHandle node, YogaEdge edge, float padding); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetPaddingPercent(YGNodeHandle node, YogaEdge edge, float padding); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaValue YGNodeStyleGetPadding(YGNodeHandle node, YogaEdge edge); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeStyleSetBorder(YGNodeHandle node, YogaEdge edge, float border); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern float YGNodeStyleGetBorder(YGNodeHandle node, YogaEdge edge); - -#endregion - -#region YG_NODE_LAYOUT_PROPERTY - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern float YGNodeLayoutGetLeft(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern float YGNodeLayoutGetTop(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern float YGNodeLayoutGetRight(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern float YGNodeLayoutGetBottom(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern float YGNodeLayoutGetWidth(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern float YGNodeLayoutGetHeight(YGNodeHandle node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern float YGNodeLayoutGetMargin(YGNodeHandle node, YogaEdge edge); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern float YGNodeLayoutGetPadding(YGNodeHandle node, YogaEdge edge); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern YogaDirection YGNodeLayoutGetDirection(YGNodeHandle node); - -#endregion - -#region Context - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern IntPtr YGNodeGetContext(IntPtr node); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGNodeSetContext(IntPtr node, IntPtr managed); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern IntPtr YGConfigGetContext(IntPtr config); - - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - public static extern void YGConfigSetContext(IntPtr config, IntPtr managed); - -#endregion - } -} diff --git a/csharp/Facebook.Yoga/YGConfigHandle.cs b/csharp/Facebook.Yoga/YGConfigHandle.cs deleted file mode 100644 index 07e72a745a..0000000000 --- a/csharp/Facebook.Yoga/YGConfigHandle.cs +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Facebook.Yoga -{ - internal class YGConfigHandle : SafeHandle - { - internal static readonly YGConfigHandle Default = Native.YGConfigGetDefault(); - private GCHandle _managedConfigHandle; - - private YGConfigHandle() : base(IntPtr.Zero, true) - { - } - - public override bool IsInvalid - { - get - { - return this.handle == IntPtr.Zero; - } - } - - protected override bool ReleaseHandle() - { - if (this.handle != Default.handle) - { - ReleaseManaged(); - if (!IsInvalid) - { - Native.YGConfigFree(this.handle); - } - } - GC.KeepAlive(this); - return true; - } - - public void SetContext(YogaConfig config) - { - if (!_managedConfigHandle.IsAllocated) - { -#if UNITY_5_4_OR_NEWER - // Weak causes 'GCHandle value belongs to a different domain' error - _managedConfigHandle = GCHandle.Alloc(config); -#else - _managedConfigHandle = GCHandle.Alloc(config, GCHandleType.Weak); -#endif - var managedConfigPtr = GCHandle.ToIntPtr(_managedConfigHandle); - Native.YGConfigSetContext(this.handle, managedConfigPtr); - } - } - - private void ReleaseManaged() - { - if (_managedConfigHandle.IsAllocated) - { - _managedConfigHandle.Free(); - } - } - - public static YogaConfig GetManaged(IntPtr unmanagedConfigPtr) - { - if (unmanagedConfigPtr != IntPtr.Zero) - { - var managedConfigPtr = Native.YGConfigGetContext(unmanagedConfigPtr); - var config = GCHandle.FromIntPtr(managedConfigPtr).Target as YogaConfig; - if (config == null) - { - throw new InvalidOperationException("YogaConfig is already deallocated"); - } - return config; - } - return null; - } - } -} diff --git a/csharp/Facebook.Yoga/YGNodeHandle.cs b/csharp/Facebook.Yoga/YGNodeHandle.cs deleted file mode 100644 index 9adb9c5591..0000000000 --- a/csharp/Facebook.Yoga/YGNodeHandle.cs +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Facebook.Yoga -{ - internal class YGNodeHandle : SafeHandle - { - private GCHandle _managedNodeHandle; - - private YGNodeHandle() : base(IntPtr.Zero, true) - { - } - - public override bool IsInvalid - { - get - { - return this.handle == IntPtr.Zero; - } - } - - protected override bool ReleaseHandle() - { - ReleaseManaged(); - if (!IsInvalid) - { - Native.YGNodeFree(this.handle); - GC.KeepAlive(this); - } - return true; - } - - public void SetContext(YogaNode node) - { - if (!_managedNodeHandle.IsAllocated) - { -#if UNITY_5_4_OR_NEWER - // Weak causes 'GCHandle value belongs to a different domain' error - _managedNodeHandle = GCHandle.Alloc(node); -#else - _managedNodeHandle = GCHandle.Alloc(node, GCHandleType.Weak); -#endif - var managedNodePtr = GCHandle.ToIntPtr(_managedNodeHandle); - Native.YGNodeSetContext(this.handle, managedNodePtr); - } - } - - public void ReleaseManaged() - { - if (_managedNodeHandle.IsAllocated) - { - _managedNodeHandle.Free(); - } - } - - public static YogaNode GetManaged(IntPtr unmanagedNodePtr) - { - if (unmanagedNodePtr != IntPtr.Zero) - { - var managedNodePtr = Native.YGNodeGetContext(unmanagedNodePtr); - var node = GCHandle.FromIntPtr(managedNodePtr).Target as YogaNode; - if (node == null) - { - throw new InvalidOperationException("YogaNode is already deallocated"); - } - return node; - } - return null; - } - } -} diff --git a/csharp/Facebook.Yoga/YogaAlign.cs b/csharp/Facebook.Yoga/YogaAlign.cs deleted file mode 100644 index b80987bb85..0000000000 --- a/csharp/Facebook.Yoga/YogaAlign.cs +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaAlign - { - Auto, - FlexStart, - Center, - FlexEnd, - Stretch, - Baseline, - SpaceBetween, - SpaceAround, - } -} diff --git a/csharp/Facebook.Yoga/YogaBaselineFunc.cs b/csharp/Facebook.Yoga/YogaBaselineFunc.cs deleted file mode 100644 index bce29da556..0000000000 --- a/csharp/Facebook.Yoga/YogaBaselineFunc.cs +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Facebook.Yoga -{ - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate float YogaBaselineFunc(IntPtr unmanagedNodePtr, float width, float height); -} diff --git a/csharp/Facebook.Yoga/YogaConfig.cs b/csharp/Facebook.Yoga/YogaConfig.cs deleted file mode 100644 index c4162d3144..0000000000 --- a/csharp/Facebook.Yoga/YogaConfig.cs +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Runtime.InteropServices; - -#if __IOS__ -using ObjCRuntime; -#endif -#if ENABLE_IL2CPP -using AOT; -#endif - -namespace Facebook.Yoga -{ - public class YogaConfig - { - internal static readonly YogaConfig Default = new YogaConfig(YGConfigHandle.Default); - private static YogaLogger _managedLogger; - - private YGConfigHandle _ygConfig; - private Logger _logger; - - private YogaConfig(YGConfigHandle ygConfig) - { - _ygConfig = ygConfig; - if (_ygConfig.IsInvalid) - { - throw new InvalidOperationException("Failed to allocate native memory"); - } - - _ygConfig.SetContext(this); - - if (_ygConfig == YGConfigHandle.Default) - { - _managedLogger = LoggerInternal; - Native.YGInteropSetLogger(_managedLogger); - } - } - - public YogaConfig() - : this(Native.YGConfigNew()) - { - } - - internal YGConfigHandle Handle - { - get { - return _ygConfig; - } - } - -#if (UNITY_IOS && !UNITY_EDITOR) || ENABLE_IL2CPP || __IOS__ - [MonoPInvokeCallback(typeof(YogaLogger))] -#endif - private static void LoggerInternal( - IntPtr unmanagedConfigPtr, - IntPtr unmanagedNodePtr, - YogaLogLevel level, - string message) - { - var config = YGConfigHandle.GetManaged(unmanagedConfigPtr); - if (config == null || config._logger == null) - { - // Default logger - System.Diagnostics.Debug.WriteLine(message); - } - else - { - var node = YGNodeHandle.GetManaged(unmanagedNodePtr); - config._logger(config, node, level, message); - } - - if (level == YogaLogLevel.Error || level == YogaLogLevel.Fatal) - { - throw new InvalidOperationException(message); - } - } - - public Logger Logger - { - get { - return _logger; - } - - set { - _logger = value; - } - } - - public void SetExperimentalFeatureEnabled( - YogaExperimentalFeature feature, - bool enabled) - { - Native.YGConfigSetExperimentalFeatureEnabled(_ygConfig, feature, enabled); - } - - public bool IsExperimentalFeatureEnabled(YogaExperimentalFeature feature) - { - return Native.YGConfigIsExperimentalFeatureEnabled(_ygConfig, feature); - } - - public bool UseWebDefaults - { - get - { - return Native.YGConfigGetUseWebDefaults(_ygConfig); - } - - set - { - Native.YGConfigSetUseWebDefaults(_ygConfig, value); - } - } - - [ObsoleteAttribute("\"UseLegacyStretchBehaviour\" will be removed in the next release. " + - "Usage should be replaced with \"Errata\" set to \"YogaErrata.All\" to opt out of all " + - "future breaking conformance fixes, or \"YogaErrata.StretchFlexBasis\" toopt out of " + - "the specific conformance fix previously disabled by \"UseLegacyStretchBehaviour\".", - true /*error*/)] - public bool UseLegacyStretchBehaviour { - get - { - return Native.YGConfigGetUseLegacyStretchBehaviour(_ygConfig); - } - - set - { - Native.YGConfigSetUseLegacyStretchBehaviour(_ygConfig, value); - } - } - - public YogaErrata Errata - { - get - { - return Native.YGConfigGetErrata(_ygConfig); - } - - set - { - Native.YGConfigSetErrata(_ygConfig, value); - } - } - - public float PointScaleFactor - { - set - { - Native.YGConfigSetPointScaleFactor(_ygConfig, value); - } - } - - public static int GetInstanceCount() - { - return Native.YGConfigGetInstanceCount(); - } - - public static void SetDefaultLogger(Logger logger) - { - Default.Logger = logger; - } - } -} diff --git a/csharp/Facebook.Yoga/YogaConstants.cs b/csharp/Facebook.Yoga/YogaConstants.cs deleted file mode 100644 index 938fde4209..0000000000 --- a/csharp/Facebook.Yoga/YogaConstants.cs +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -namespace Facebook.Yoga -{ - public static class YogaConstants - { - public const float Undefined = float.NaN; - - public static bool IsUndefined(float value) - { - return float.IsNaN(value); - } - - public static bool IsUndefined(YogaValue value) - { - return value.Unit == YogaUnit.Undefined; - } - } -} diff --git a/csharp/Facebook.Yoga/YogaDimension.cs b/csharp/Facebook.Yoga/YogaDimension.cs deleted file mode 100644 index 33ac99bdf0..0000000000 --- a/csharp/Facebook.Yoga/YogaDimension.cs +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaDimension - { - Width, - Height, - } -} diff --git a/csharp/Facebook.Yoga/YogaDirection.cs b/csharp/Facebook.Yoga/YogaDirection.cs deleted file mode 100644 index de31a0bdb0..0000000000 --- a/csharp/Facebook.Yoga/YogaDirection.cs +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaDirection - { - Inherit, - LTR, - RTL, - } -} diff --git a/csharp/Facebook.Yoga/YogaDisplay.cs b/csharp/Facebook.Yoga/YogaDisplay.cs deleted file mode 100644 index 6e7ee6e26b..0000000000 --- a/csharp/Facebook.Yoga/YogaDisplay.cs +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaDisplay - { - Flex, - None, - } -} diff --git a/csharp/Facebook.Yoga/YogaEdge.cs b/csharp/Facebook.Yoga/YogaEdge.cs deleted file mode 100644 index 2d1937d07f..0000000000 --- a/csharp/Facebook.Yoga/YogaEdge.cs +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaEdge - { - Left, - Top, - Right, - Bottom, - Start, - End, - Horizontal, - Vertical, - All, - } -} diff --git a/csharp/Facebook.Yoga/YogaErrata.cs b/csharp/Facebook.Yoga/YogaErrata.cs deleted file mode 100644 index d123f50fbd..0000000000 --- a/csharp/Facebook.Yoga/YogaErrata.cs +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - [System.Flags] - public enum YogaErrata - { - None = 0, - StretchFlexBasis = 1, - All = 2147483647, - Classic = 2147483646, - } -} diff --git a/csharp/Facebook.Yoga/YogaExperimentalFeature.cs b/csharp/Facebook.Yoga/YogaExperimentalFeature.cs deleted file mode 100644 index 748101c420..0000000000 --- a/csharp/Facebook.Yoga/YogaExperimentalFeature.cs +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaExperimentalFeature - { - WebFlexBasis, - AbsolutePercentageAgainstPaddingEdge, - FixAbsoluteTrailingColumnMargin, - } -} diff --git a/csharp/Facebook.Yoga/YogaFlexDirection.cs b/csharp/Facebook.Yoga/YogaFlexDirection.cs deleted file mode 100644 index 38d75ffb6c..0000000000 --- a/csharp/Facebook.Yoga/YogaFlexDirection.cs +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaFlexDirection - { - Column, - ColumnReverse, - Row, - RowReverse, - } -} diff --git a/csharp/Facebook.Yoga/YogaGutter.cs b/csharp/Facebook.Yoga/YogaGutter.cs deleted file mode 100644 index 3a16d79693..0000000000 --- a/csharp/Facebook.Yoga/YogaGutter.cs +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaGutter - { - Column, - Row, - All, - } -} diff --git a/csharp/Facebook.Yoga/YogaJustify.cs b/csharp/Facebook.Yoga/YogaJustify.cs deleted file mode 100644 index 696325b688..0000000000 --- a/csharp/Facebook.Yoga/YogaJustify.cs +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaJustify - { - FlexStart, - Center, - FlexEnd, - SpaceBetween, - SpaceAround, - SpaceEvenly, - } -} diff --git a/csharp/Facebook.Yoga/YogaLogLevel.cs b/csharp/Facebook.Yoga/YogaLogLevel.cs deleted file mode 100644 index b1236e63f9..0000000000 --- a/csharp/Facebook.Yoga/YogaLogLevel.cs +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaLogLevel - { - Error, - Warn, - Info, - Debug, - Verbose, - Fatal, - } -} diff --git a/csharp/Facebook.Yoga/YogaLogger.cs b/csharp/Facebook.Yoga/YogaLogger.cs deleted file mode 100644 index 2544fad0d6..0000000000 --- a/csharp/Facebook.Yoga/YogaLogger.cs +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Facebook.Yoga -{ - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void YogaLogger( - IntPtr unmanagedConfigPtr, - IntPtr unmanagedNotePtr, - YogaLogLevel level, - string message); -} diff --git a/csharp/Facebook.Yoga/YogaMeasureFunc.cs b/csharp/Facebook.Yoga/YogaMeasureFunc.cs deleted file mode 100644 index cdaf6f8844..0000000000 --- a/csharp/Facebook.Yoga/YogaMeasureFunc.cs +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Facebook.Yoga -{ - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate YogaSize YogaMeasureFunc( - IntPtr unmanagedNodePtr, - float width, - YogaMeasureMode widthMode, - float height, - YogaMeasureMode heightMode); -} diff --git a/csharp/Facebook.Yoga/YogaMeasureMode.cs b/csharp/Facebook.Yoga/YogaMeasureMode.cs deleted file mode 100644 index 6c9b8c3bf8..0000000000 --- a/csharp/Facebook.Yoga/YogaMeasureMode.cs +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaMeasureMode - { - Undefined, - Exactly, - AtMost, - } -} diff --git a/csharp/Facebook.Yoga/YogaNode.Spacing.cs b/csharp/Facebook.Yoga/YogaNode.Spacing.cs deleted file mode 100644 index 2c8e083ebb..0000000000 --- a/csharp/Facebook.Yoga/YogaNode.Spacing.cs +++ /dev/null @@ -1,551 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -namespace Facebook.Yoga -{ - public partial class YogaNode - { - public YogaValue Left - { - get - { - return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Left); - } - - set - { - SetStylePosition(YogaEdge.Left, value); - } - } - - public YogaValue Top - { - get - { - return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Top); - } - - set - { - SetStylePosition(YogaEdge.Top, value); - } - } - - public YogaValue Right - { - get - { - return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Right); - } - - set - { - SetStylePosition(YogaEdge.Right, value); - } - } - - public YogaValue Bottom - { - get - { - return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Bottom); - } - - set - { - SetStylePosition(YogaEdge.Bottom, value); - } - } - - public YogaValue Start - { - get - { - return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Start); - } - - set - { - SetStylePosition(YogaEdge.Start, value); - } - } - - public YogaValue End - { - get - { - return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.End); - } - - set - { - SetStylePosition(YogaEdge.End, value); - } - } - - private void SetStylePosition(YogaEdge edge, YogaValue value) - { - if (value.Unit == YogaUnit.Percent) - { - Native.YGNodeStyleSetPositionPercent(_ygNode, edge, value.Value); - } - else - { - Native.YGNodeStyleSetPosition(_ygNode, edge, value.Value); - } - } - - public YogaValue MarginLeft - { - get - { - return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Left); - } - - set - { - SetStyleMargin(YogaEdge.Left, value); - } - } - - public YogaValue MarginTop - { - get - { - return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Top); - } - - set - { - SetStyleMargin(YogaEdge.Top, value); - } - } - - public YogaValue MarginRight - { - get - { - return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Right); - } - - set - { - SetStyleMargin(YogaEdge.Right, value); - } - } - - public YogaValue MarginBottom - { - get - { - return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Bottom); - } - - set - { - SetStyleMargin(YogaEdge.Bottom, value); - } - } - - public YogaValue MarginStart - { - get - { - return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Start); - } - - set - { - SetStyleMargin(YogaEdge.Start, value); - } - } - - public YogaValue MarginEnd - { - get - { - return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.End); - } - - set - { - SetStyleMargin(YogaEdge.End, value); - } - } - - public YogaValue MarginHorizontal - { - get - { - return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Horizontal); - } - - set - { - SetStyleMargin(YogaEdge.Horizontal, value); - } - } - - public YogaValue MarginVertical - { - get - { - return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Vertical); - } - - set - { - SetStyleMargin(YogaEdge.Vertical, value); - } - } - - public YogaValue Margin - { - get - { - return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.All); - } - - set - { - SetStyleMargin(YogaEdge.All, value); - } - } - - private void SetStyleMargin(YogaEdge edge, YogaValue value) - { - if (value.Unit == YogaUnit.Percent) - { - Native.YGNodeStyleSetMarginPercent(_ygNode, edge, value.Value); - } - else if (value.Unit == YogaUnit.Auto) - { - Native.YGNodeStyleSetMarginAuto(_ygNode, edge); - } - else - { - Native.YGNodeStyleSetMargin(_ygNode, edge, value.Value); - } - } - - public YogaValue PaddingLeft - { - get - { - return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Left); - } - - set - { - SetStylePadding(YogaEdge.Left, value); - } - } - - public YogaValue PaddingTop - { - get - { - return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Top); - } - - set - { - SetStylePadding(YogaEdge.Top, value); - } - } - - public YogaValue PaddingRight - { - get - { - return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Right); - } - - set - { - SetStylePadding(YogaEdge.Right, value); - } - } - - public YogaValue PaddingBottom - { - get - { - return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Bottom); - } - - set - { - SetStylePadding(YogaEdge.Bottom, value); - } - } - - public YogaValue PaddingStart - { - get - { - return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Start); - } - - set - { - SetStylePadding(YogaEdge.Start, value); - } - } - - public YogaValue PaddingEnd - { - get - { - return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.End); - } - - set - { - SetStylePadding(YogaEdge.End, value); - } - } - - public YogaValue PaddingHorizontal - { - get - { - return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Horizontal); - } - - set - { - SetStylePadding(YogaEdge.Horizontal, value); - } - } - - public YogaValue PaddingVertical - { - get - { - return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Vertical); - } - - set - { - SetStylePadding(YogaEdge.Vertical, value); - } - } - - public YogaValue Padding - { - get - { - return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.All); - } - - set - { - SetStylePadding(YogaEdge.All, value); - } - } - - private void SetStylePadding(YogaEdge edge, YogaValue value) - { - if (value.Unit == YogaUnit.Percent) - { - Native.YGNodeStyleSetPaddingPercent(_ygNode, edge, value.Value); - } - else - { - Native.YGNodeStyleSetPadding(_ygNode, edge, value.Value); - } - } - - public float BorderLeftWidth - { - get - { - return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.Left); - } - - set - { - Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.Left, value); - } - } - - public float BorderTopWidth - { - get - { - return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.Top); - } - - set - { - Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.Top, value); - } - } - - public float BorderRightWidth - { - get - { - return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.Right); - } - - set - { - Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.Right, value); - } - } - - public float BorderBottomWidth - { - get - { - return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.Bottom); - } - - set - { - Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.Bottom, value); - } - } - - public float BorderStartWidth - { - get - { - return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.Start); - } - - set - { - Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.Start, value); - } - } - - public float BorderEndWidth - { - get - { - return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.End); - } - - set - { - Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.End, value); - } - } - - public float BorderWidth - { - get - { - return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.All); - } - - set - { - Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.All, value); - } - } - - public float LayoutMarginLeft - { - get - { - return Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.Left); - } - } - - public float LayoutMarginTop - { - get - { - return Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.Top); - } - } - - public float LayoutMarginRight - { - get - { - return Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.Right); - } - } - - public float LayoutMarginBottom - { - get - { - return Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.Bottom); - } - } - - public float LayoutMarginStart - { - get - { - return Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.Start); - } - } - - public float LayoutMarginEnd - { - get - { - return Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.End); - } - } - - public float LayoutPaddingLeft - { - get - { - return Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.Left); - } - } - - public float LayoutPaddingTop - { - get - { - return Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.Top); - } - } - - public float LayoutPaddingRight - { - get - { - return Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.Right); - } - } - - public float LayoutPaddingBottom - { - get - { - return Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.Bottom); - } - } - - public float LayoutPaddingStart - { - get - { - return Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.Start); - } - } - - public float LayoutPaddingEnd - { - get - { - return Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.End); - } - } - } -} diff --git a/csharp/Facebook.Yoga/YogaNode.cs b/csharp/Facebook.Yoga/YogaNode.cs deleted file mode 100644 index 7a24df76e8..0000000000 --- a/csharp/Facebook.Yoga/YogaNode.cs +++ /dev/null @@ -1,716 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -#if __IOS__ -using ObjCRuntime; -#endif -#if ENABLE_IL2CPP -using AOT; -#endif - -namespace Facebook.Yoga -{ - public partial class YogaNode : IEnumerable - { - private readonly YGNodeHandle _ygNode; - private readonly YogaConfig _config; - private WeakReference _parent; - private List _children; - private MeasureFunction _measureFunction; - private BaselineFunction _baselineFunction; - private YogaMeasureFunc _managedMeasure; - private YogaBaselineFunc _managedBaseline; - private object _data; - - public YogaNode(YogaConfig config = null) - { - _config = config == null ? YogaConfig.Default : config; - _ygNode = Native.YGNodeNewWithConfig(_config.Handle); - if (_ygNode.IsInvalid) - { - throw new InvalidOperationException("Failed to allocate native memory"); - } - - _ygNode.SetContext(this); - } - - public YogaNode(YogaNode srcNode) - : this(srcNode._config) - { - CopyStyle(srcNode); - } - - public void Reset() - { - _measureFunction = null; - _baselineFunction = null; - _data = null; - - _ygNode.ReleaseManaged(); - Native.YGNodeReset(_ygNode); - _ygNode.SetContext(this); - } - - public bool IsDirty - { - get - { - return Native.YGNodeIsDirty(_ygNode); - } - } - - public virtual void MarkDirty() - { - Native.YGNodeMarkDirty(_ygNode); - } - - public bool HasNewLayout - { - get - { - return Native.YGNodeGetHasNewLayout(_ygNode); - } - } - - public void MarkHasNewLayout() - { - Native.YGNodeSetHasNewLayout(_ygNode, true); - } - - public YogaNode Parent - { - get - { - return _parent != null ? _parent.Target as YogaNode : null; - } - } - - public bool IsMeasureDefined - { - get - { - return _measureFunction != null; - } - } - - public bool IsBaselineDefined - { - get - { - return _baselineFunction != null; - } - } - - public void CopyStyle(YogaNode srcNode) - { - Native.YGNodeCopyStyle(_ygNode, srcNode._ygNode); - } - - public YogaDirection StyleDirection - { - get - { - return Native.YGNodeStyleGetDirection(_ygNode); - } - - set - { - Native.YGNodeStyleSetDirection(_ygNode, value); - } - } - - public YogaFlexDirection FlexDirection - { - get - { - return Native.YGNodeStyleGetFlexDirection(_ygNode); - } - - set - { - Native.YGNodeStyleSetFlexDirection(_ygNode, value); - } - } - - public YogaJustify JustifyContent - { - get - { - return Native.YGNodeStyleGetJustifyContent(_ygNode); - } - - set - { - Native.YGNodeStyleSetJustifyContent(_ygNode, value); - } - } - - public YogaDisplay Display - { - get - { - return Native.YGNodeStyleGetDisplay(_ygNode); - } - - set - { - Native.YGNodeStyleSetDisplay(_ygNode, value); - } - } - - public YogaAlign AlignItems - { - get - { - return Native.YGNodeStyleGetAlignItems(_ygNode); - } - - set - { - Native.YGNodeStyleSetAlignItems(_ygNode, value); - } - } - - public YogaAlign AlignSelf - { - get - { - return Native.YGNodeStyleGetAlignSelf(_ygNode); - } - - set - { - Native.YGNodeStyleSetAlignSelf(_ygNode, value); - } - } - - public YogaAlign AlignContent - { - get - { - return Native.YGNodeStyleGetAlignContent(_ygNode); - } - - set - { - Native.YGNodeStyleSetAlignContent(_ygNode, value); - } - } - - public YogaPositionType PositionType - { - get - { - return Native.YGNodeStyleGetPositionType(_ygNode); - } - - set - { - Native.YGNodeStyleSetPositionType(_ygNode, value); - } - } - - public YogaWrap Wrap - { - get - { - return Native.YGNodeStyleGetFlexWrap(_ygNode); - } - - set - { - Native.YGNodeStyleSetFlexWrap(_ygNode, value); - } - } - - public float Flex - { - set - { - Native.YGNodeStyleSetFlex(_ygNode, value); - } - } - - public float FlexGrow - { - get - { - return Native.YGNodeStyleGetFlexGrow(_ygNode); - } - - set - { - Native.YGNodeStyleSetFlexGrow(_ygNode, value); - } - } - - public float FlexShrink - { - get - { - return Native.YGNodeStyleGetFlexShrink(_ygNode); - } - - set - { - Native.YGNodeStyleSetFlexShrink(_ygNode, value); - } - } - - public YogaValue FlexBasis - { - get - { - return Native.YGNodeStyleGetFlexBasis(_ygNode); - } - - set - { - if (value.Unit == YogaUnit.Percent) - { - Native.YGNodeStyleSetFlexBasisPercent(_ygNode, value.Value); - } - else if (value.Unit == YogaUnit.Auto) - { - Native.YGNodeStyleSetFlexBasisAuto(_ygNode); - } - else - { - Native.YGNodeStyleSetFlexBasis(_ygNode, value.Value); - } - } - } - - public YogaValue Width - { - get - { - return Native.YGNodeStyleGetWidth(_ygNode); - } - - set - { - if (value.Unit == YogaUnit.Percent) - { - Native.YGNodeStyleSetWidthPercent(_ygNode, value.Value); - } - else if (value.Unit == YogaUnit.Auto) - { - Native.YGNodeStyleSetWidthAuto(_ygNode); - } - else - { - Native.YGNodeStyleSetWidth(_ygNode, value.Value); - } - } - } - - public YogaValue Height - { - get - { - return Native.YGNodeStyleGetHeight(_ygNode); - } - - set - { - if (value.Unit == YogaUnit.Percent) - { - Native.YGNodeStyleSetHeightPercent(_ygNode, value.Value); - } - else if (value.Unit == YogaUnit.Auto) - { - Native.YGNodeStyleSetHeightAuto(_ygNode); - } - else - { - Native.YGNodeStyleSetHeight(_ygNode, value.Value); - } - } - } - - public YogaValue MaxWidth - { - get - { - return Native.YGNodeStyleGetMaxWidth(_ygNode); - } - - set - { - if (value.Unit == YogaUnit.Percent) - { - Native.YGNodeStyleSetMaxWidthPercent(_ygNode, value.Value); - } - else - { - Native.YGNodeStyleSetMaxWidth(_ygNode, value.Value); - } - } - } - - public YogaValue MaxHeight - { - get - { - return Native.YGNodeStyleGetMaxHeight(_ygNode); - } - - set - { - if (value.Unit == YogaUnit.Percent) - { - Native.YGNodeStyleSetMaxHeightPercent(_ygNode, value.Value); - } - else - { - Native.YGNodeStyleSetMaxHeight(_ygNode, value.Value); - } - } - } - - public YogaValue MinWidth - { - get - { - return Native.YGNodeStyleGetMinWidth(_ygNode); - } - - set - { - if (value.Unit == YogaUnit.Percent) - { - Native.YGNodeStyleSetMinWidthPercent(_ygNode, value.Value); - } - else - { - Native.YGNodeStyleSetMinWidth(_ygNode, value.Value); - } - } - } - - public YogaValue MinHeight - { - get - { - return Native.YGNodeStyleGetMinHeight(_ygNode); - } - - set - { - if (value.Unit == YogaUnit.Percent) - { - Native.YGNodeStyleSetMinHeightPercent(_ygNode, value.Value); - } - else - { - Native.YGNodeStyleSetMinHeight(_ygNode, value.Value); - } - } - } - - public float AspectRatio - { - get - { - return Native.YGNodeStyleGetAspectRatio(_ygNode); - } - - set - { - Native.YGNodeStyleSetAspectRatio(_ygNode, value); - } - } - - public float Gap - { - get - { - return Native.YGNodeStyleGetGap(_ygNode, YogaGutter.All); - } - - set - { - Native.YGNodeStyleSetGap(_ygNode, YogaGutter.All, value); - } - } - - public float ColumnGap - { - get - { - return Native.YGNodeStyleGetGap(_ygNode, YogaGutter.Column); - } - - set - { - Native.YGNodeStyleSetGap(_ygNode, YogaGutter.Column, value); - } - } - - public float RowGap - { - get - { - return Native.YGNodeStyleGetGap(_ygNode, YogaGutter.Row); - } - - set - { - Native.YGNodeStyleSetGap(_ygNode, YogaGutter.Row, value); - } - } - - public float LayoutX - { - get - { - return Native.YGNodeLayoutGetLeft(_ygNode); - } - } - - public float LayoutY - { - get - { - return Native.YGNodeLayoutGetTop(_ygNode); - } - } - - public float LayoutWidth - { - get - { - return Native.YGNodeLayoutGetWidth(_ygNode); - } - } - - public float LayoutHeight - { - get - { - return Native.YGNodeLayoutGetHeight(_ygNode); - } - } - - public YogaDirection LayoutDirection - { - get - { - return Native.YGNodeLayoutGetDirection(_ygNode); - } - } - - public YogaOverflow Overflow - { - get - { - return Native.YGNodeStyleGetOverflow(_ygNode); - } - - set - { - Native.YGNodeStyleSetOverflow(_ygNode, value); - } - } - - public object Data - { - get - { - return _data; - } - - set - { - _data = value; - } - } - - public YogaNode this[int index] - { - get - { - return _children[index]; - } - } - - public int Count - { - get - { - return _children != null ? _children.Count : 0; - } - } - - public void MarkLayoutSeen() - { - Native.YGNodeSetHasNewLayout(_ygNode, false); - } - - public bool IsReferenceBaseline - { - get - { - return Native.YGNodeIsReferenceBaseline(_ygNode); - } - - set - { - Native.YGNodeSetIsReferenceBaseline(_ygNode, value); - } - } - - public bool ValuesEqual(float f1, float f2) - { - if (float.IsNaN(f1) || float.IsNaN(f2)) - { - return float.IsNaN(f1) && float.IsNaN(f2); - } - - return Math.Abs(f2 - f1) < float.Epsilon; - } - - public void Insert(int index, YogaNode node) - { - if (_children == null) - { - _children = new List(4); - } - _children.Insert(index, node); - node._parent = new WeakReference(this); - Native.YGNodeInsertChild(_ygNode, node._ygNode, (uint)index); - } - - public void RemoveAt(int index) - { - var child = _children[index]; - child._parent = null; - _children.RemoveAt(index); - Native.YGNodeRemoveChild(_ygNode, child._ygNode); - } - - public void AddChild(YogaNode child) - { - Insert(Count, child); - } - - public void RemoveChild(YogaNode child) - { - int index = IndexOf(child); - if (index >= 0) - { - RemoveAt(index); - } - } - - public void Clear() - { - if (_children != null) - { - while (_children.Count > 0) - { - RemoveAt(_children.Count-1); - } - } - } - - public int IndexOf(YogaNode node) - { - return _children != null ? _children.IndexOf(node) : -1; - } - - public void SetMeasureFunction(MeasureFunction measureFunction) - { - _measureFunction = measureFunction; - _managedMeasure = measureFunction != null ? MeasureInternal : (YogaMeasureFunc)null; - Native.YGNodeSetMeasureFunc(_ygNode, _managedMeasure); - } - - public void SetBaselineFunction(BaselineFunction baselineFunction) - { - _baselineFunction = baselineFunction; - _managedBaseline = - baselineFunction != null ? BaselineInternal : (YogaBaselineFunc)null; - Native.YGNodeSetBaselineFunc(_ygNode, _managedBaseline); - } - - public void CalculateLayout( - float width = YogaConstants.Undefined, - float height = YogaConstants.Undefined) - { - Native.YGNodeCalculateLayout( - _ygNode, - width, - height, - Native.YGNodeStyleGetDirection(_ygNode)); - } - -#if (UNITY_IOS && !UNITY_EDITOR) || ENABLE_IL2CPP || __IOS__ - [MonoPInvokeCallback(typeof(YogaMeasureFunc))] -#endif - private static YogaSize MeasureInternal( - IntPtr unmanagedNodePtr, - float width, - YogaMeasureMode widthMode, - float height, - YogaMeasureMode heightMode) - { - var node = YGNodeHandle.GetManaged(unmanagedNodePtr); - if (node == null || node._measureFunction == null) - { - throw new InvalidOperationException("Measure function is not defined."); - } - return node._measureFunction(node, width, widthMode, height, heightMode); - } - -#if (UNITY_IOS && !UNITY_EDITOR) || ENABLE_IL2CPP || __IOS__ - [MonoPInvokeCallback(typeof(YogaBaselineFunc))] -#endif - private static float BaselineInternal( - IntPtr unmanagedNodePtr, - float width, - float height) - { - var node = YGNodeHandle.GetManaged(unmanagedNodePtr); - if (node == null || node._baselineFunction == null) - { - throw new InvalidOperationException("Baseline function is not defined."); - } - return node._baselineFunction(node, width, height); - } - - public string Print(YogaPrintOptions options = - YogaPrintOptions.Layout|YogaPrintOptions.Style|YogaPrintOptions.Children) - { - StringBuilder sb = new StringBuilder(); - Logger orig = _config.Logger; - _config.Logger = (config, node, level, message) => {sb.Append(message);}; - Native.YGNodePrint(_ygNode, options); - _config.Logger = orig; - return sb.ToString(); - } - - public IEnumerator GetEnumerator() - { - return _children != null ? ((IEnumerable)_children).GetEnumerator() : - System.Linq.Enumerable.Empty().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return _children != null ? ((IEnumerable)_children).GetEnumerator() : - System.Linq.Enumerable.Empty().GetEnumerator(); - } - } -} diff --git a/csharp/Facebook.Yoga/YogaNodeType.cs b/csharp/Facebook.Yoga/YogaNodeType.cs deleted file mode 100644 index 8834589b8a..0000000000 --- a/csharp/Facebook.Yoga/YogaNodeType.cs +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaNodeType - { - Default, - Text, - } -} diff --git a/csharp/Facebook.Yoga/YogaOverflow.cs b/csharp/Facebook.Yoga/YogaOverflow.cs deleted file mode 100644 index 02b1f805ad..0000000000 --- a/csharp/Facebook.Yoga/YogaOverflow.cs +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaOverflow - { - Visible, - Hidden, - Scroll, - } -} diff --git a/csharp/Facebook.Yoga/YogaPositionType.cs b/csharp/Facebook.Yoga/YogaPositionType.cs deleted file mode 100644 index f1ac93ade2..0000000000 --- a/csharp/Facebook.Yoga/YogaPositionType.cs +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaPositionType - { - Static, - Relative, - Absolute, - } -} diff --git a/csharp/Facebook.Yoga/YogaPrintOptions.cs b/csharp/Facebook.Yoga/YogaPrintOptions.cs deleted file mode 100644 index a268f7b40c..0000000000 --- a/csharp/Facebook.Yoga/YogaPrintOptions.cs +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - [System.Flags] - public enum YogaPrintOptions - { - Layout = 1, - Style = 2, - Children = 4, - } -} diff --git a/csharp/Facebook.Yoga/YogaSize.cs b/csharp/Facebook.Yoga/YogaSize.cs deleted file mode 100644 index a6aa0aaed7..0000000000 --- a/csharp/Facebook.Yoga/YogaSize.cs +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System.Runtime.InteropServices; - -namespace Facebook.Yoga -{ - [StructLayout(LayoutKind.Sequential)] - public struct YogaSize - { - public float width; - public float height; - } -} diff --git a/csharp/Facebook.Yoga/YogaUnit.cs b/csharp/Facebook.Yoga/YogaUnit.cs deleted file mode 100644 index 0b62efc006..0000000000 --- a/csharp/Facebook.Yoga/YogaUnit.cs +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaUnit - { - Undefined, - Point, - Percent, - Auto, - } -} diff --git a/csharp/Facebook.Yoga/YogaValue.cs b/csharp/Facebook.Yoga/YogaValue.cs deleted file mode 100644 index 7d0dae4c19..0000000000 --- a/csharp/Facebook.Yoga/YogaValue.cs +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Facebook.Yoga -{ - [StructLayout(LayoutKind.Sequential)] - public struct YogaValue - { - private float value; - private YogaUnit unit; - - public YogaUnit Unit - { - get - { - return unit; - } - } - - public float Value - { - get - { - return value; - } - } - - public static YogaValue Point(float value) - { - return new YogaValue - { - value = value, - unit = YogaConstants.IsUndefined(value) ? YogaUnit.Undefined : YogaUnit.Point - }; - } - - public bool Equals(YogaValue other) - { - return Unit == other.Unit && (Value.Equals(other.Value) || Unit == YogaUnit.Undefined); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - return obj is YogaValue && Equals((YogaValue) obj); - } - - public override int GetHashCode() - { - unchecked - { - return (Value.GetHashCode() * 397) ^ (int) Unit; - } - } - - public static YogaValue Undefined() - { - return new YogaValue - { - value = YogaConstants.Undefined, - unit = YogaUnit.Undefined - }; - } - - public static YogaValue Auto() - { - return new YogaValue - { - value = 0f, - unit = YogaUnit.Auto - }; - } - - public static YogaValue Percent(float value) - { - return new YogaValue - { - value = value, - unit = YogaConstants.IsUndefined(value) ? YogaUnit.Undefined : YogaUnit.Percent - }; - } - - public static implicit operator YogaValue(float pointValue) - { - return Point(pointValue); - } - } -} diff --git a/csharp/Facebook.Yoga/YogaValueExtensions.cs b/csharp/Facebook.Yoga/YogaValueExtensions.cs deleted file mode 100644 index d0e138f9d0..0000000000 --- a/csharp/Facebook.Yoga/YogaValueExtensions.cs +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -namespace Facebook.Yoga -{ - public static class YogaValueExtensions - { - public static YogaValue Percent(this float value) - { - return YogaValue.Percent(value); - } - - public static YogaValue Pt(this float value) - { - return YogaValue.Point(value); - } - - public static YogaValue Percent(this int value) - { - return YogaValue.Percent(value); - } - - public static YogaValue Pt(this int value) - { - return YogaValue.Point(value); - } - } -} \ No newline at end of file diff --git a/csharp/Facebook.Yoga/YogaWrap.cs b/csharp/Facebook.Yoga/YogaWrap.cs deleted file mode 100644 index a18357771f..0000000000 --- a/csharp/Facebook.Yoga/YogaWrap.cs +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -namespace Facebook.Yoga -{ - public enum YogaWrap - { - NoWrap, - Wrap, - WrapReverse, - } -} diff --git a/csharp/Facebook.Yoga/project.json b/csharp/Facebook.Yoga/project.json deleted file mode 100644 index a188a05681..0000000000 --- a/csharp/Facebook.Yoga/project.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "language": "en", - "version": "3.0.0-*", - - "dependencies": { - "NETStandard.Library": "1.6.0", - "System.Runtime.Handles": "4.3.0" - }, - - "frameworks": { - "netstandard1.6": { - "imports": "dnxcore50" - } - } -} diff --git a/csharp/Facebook.YogaKit/Facebook.YogaKit.Shared.shproj b/csharp/Facebook.YogaKit/Facebook.YogaKit.Shared.shproj deleted file mode 100644 index 0943de3627..0000000000 --- a/csharp/Facebook.YogaKit/Facebook.YogaKit.Shared.shproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - {A24B3BA6-3143-4FFF-B8B8-1EDF166F5F4A} - - - - - - - \ No newline at end of file diff --git a/csharp/Facebook.YogaKit/Facebook.YogaKit.projitems b/csharp/Facebook.YogaKit/Facebook.YogaKit.projitems deleted file mode 100644 index af8db3270f..0000000000 --- a/csharp/Facebook.YogaKit/Facebook.YogaKit.projitems +++ /dev/null @@ -1,16 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - {A24B3BA6-3143-4FFF-B8B8-1EDF166F5F4A} - - - Facebook.YogaKit - - - - - - - \ No newline at end of file diff --git a/csharp/Facebook.YogaKit/IYogaLayout.cs b/csharp/Facebook.YogaKit/IYogaLayout.cs deleted file mode 100644 index 6a964136be..0000000000 --- a/csharp/Facebook.YogaKit/IYogaLayout.cs +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Drawing; -using Facebook.Yoga; - -namespace Facebook.YogaKit -{ - public interface IYogaLayout : IDisposable - { - bool IsEnabled { get; set; } - bool IsIncludeInLayout { get; set; } - - //YogaDirection Direction { get; set; } - YogaFlexDirection FlexDirection { get; set; } - YogaJustify JustifyContent { get; set; } - YogaAlign AlignContent { get; set; } - YogaAlign AlignSelf { get; set; } - YogaAlign AlignItems { get; set; } - YogaPositionType Position { get; set; } - YogaWrap FlexWrap { get; set; } - YogaOverflow Overflow { get; set; } - - - float FlexGrow { get; set; } - float FlexShrink { get; set; } - float FlexBasis { get; set; } - - float Left { get; set; } - float Top { get; set; } - float Right { get; set; } - float Bottom { get; set; } - float Start { get; set; } - float End { get; set; } - - float MarginLeft { get; set; } - float MarginTop { get; set; } - float MarginRight { get; set; } - float MarginBottom { get; set; } - float MarginStart { get; set; } - float MarginEnd { get; set; } - float MarginHorizontal { get; set; } - float MarginVertical { get; set; } - float Margin { get; set; } - - float PaddingLeft { get; set; } - float PaddingTop { get; set; } - float PaddingRight { get; set; } - float PaddingBottom { get; set; } - float PaddingStart { get; set; } - float PaddingEnd { get; set; } - float PaddingHorizontal { get; set; } - float PaddingVertical { get; set; } - float Padding { get; set; } - - float BorderLeftWidth { get; set; } - float BorderTopWidth { get; set; } - float BorderRightWidth { get; set; } - float BorderBottomWidth { get; set; } - float BorderStartWidth { get; set; } - float BorderEndWidth { get; set; } - float BorderWidth { get; set; } - - float Width { get; set; } - float Height { get; set; } - float MinWidth { get; set; } - float MinHeight { get; set; } - float MaxWidth { get; set; } - float MaxHeight { get; set; } - - // Yoga specific properties, not compatible with flexbox specification - - // Returns the size of the view if no constraints were given. This could equivalent to calling [self sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)]; - SizeF IntrinsicSize { get; } - float AspectRatio { get; set; } - // Get the resolved direction of this node. This won't be YGDirectionInherit - YogaDirection ResolvedDirection { get; } - // Returns the number of children that are using Flexbox. - int NumberOfChildren { get; } - // Return a BOOL indiciating whether or not we this node contains any subviews that are included in Yoga's layout. - bool IsLeaf { get; } - // Perform a layout calculation and update the frames of the views in the hierarchy with the results - void ApplyLayout(); - // Mark that a view's layout needs to be recalculated. Only works for leaf views. - void MarkDirty(); - } -} diff --git a/csharp/Facebook.YogaKit/YogaKit.cs b/csharp/Facebook.YogaKit/YogaKit.cs deleted file mode 100644 index ee90a40d9e..0000000000 --- a/csharp/Facebook.YogaKit/YogaKit.cs +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System.Collections.Generic; -using Facebook.Yoga; - -namespace Facebook.YogaKit -{ - public static partial class YogaKit - { - internal static Dictionary Bridges = new Dictionary(); - } -} diff --git a/csharp/Facebook.YogaKit/YogaLayout.cs b/csharp/Facebook.YogaKit/YogaLayout.cs deleted file mode 100644 index 8aedb3fc11..0000000000 --- a/csharp/Facebook.YogaKit/YogaLayout.cs +++ /dev/null @@ -1,905 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using Facebook.Yoga; -using System.Collections.Generic; -using System.Drawing; -#if __IOS__ -using NativeView = UIKit.UIView; -using NativeScrollView = UIKit.UIScrollView; -#endif - -namespace Facebook.YogaKit -{ - public partial class YogaLayout : IYogaLayout - { - WeakReference _viewRef; - YogaNode _node; - - internal YogaLayout(NativeView view) - { - _viewRef = new WeakReference(view); - _node = new YogaNode(); - YogaKit.Bridges.Add(_node, view); - - IsEnabled = false; - IsIncludeInLayout = true; - } - - public new void MarkDirty() - { - if (IsLeaf) - _node.MarkDirty(); - } - - public bool IsLeaf - { - get - { - if (IsEnabled) - { - NativeView view = null; - if (_viewRef.TryGetTarget(out view)) - { - foreach (NativeView subview in GetChildren(view)) - { - var layout = subview.Yoga(); - if (layout.IsEnabled && layout.IsIncludeInLayout) - { - return false; - } - } - } - - } - return true; - } - } - - - - public bool IsEnabled - { - get; - set; - } - - public bool IsIncludeInLayout - { - get; - set; - } - - public int NumberOfChildren => _node.Count; - - public YogaDirection ResolvedDirection => _node.LayoutDirection; - - public YogaFlexDirection FlexDirection - { - get - { - return _node.FlexDirection; - } - - set - { - _node.FlexDirection = value; - } - } - - public YogaAlign AlignItems - { - get - { - return _node.AlignItems; - } - - set - { - _node.AlignItems = value; - } - } - - public YogaJustify JustifyContent - { - get - { - return _node.JustifyContent; - } - - set - { - _node.JustifyContent = value; - } - } - - public YogaAlign AlignContent - { - get - { - return _node.AlignContent; - } - - set - { - _node.AlignContent = value; - } - } - - public YogaAlign AlignSelf - { - get - { - return _node.AlignSelf; - } - - set - { - _node.AlignSelf = value; - } - } - - public YogaPositionType Position - { - get - { - return _node.PositionType; - } - - set - { - _node.PositionType = value; - } - } - - public YogaWrap FlexWrap - { - get - { - return _node.Wrap; - } - - set - { - _node.Wrap = value; - } - } - - public YogaOverflow Overflow - { - get - { - return _node.Overflow; - } - - set - { - _node.Overflow = value; - } - } - - public float FlexGrow - { - get - { - return _node.FlexGrow; - } - - set - { - _node.FlexGrow = value; - } - } - - public float FlexShrink - { - get - { - return _node.FlexShrink; - } - - set - { - _node.FlexShrink = value; - } - } - - public float FlexBasis - { - get - { - return (float)_node.FlexBasis.Value; - } - - set - { - _node.FlexBasis = value; - } - } - - public float Left - { - get - { - return _node.Left.Value; - } - - set - { - _node.Left = value; - } - } - - public float Top - { - get - { - return _node.Top.Value; - } - - set - { - _node.Top = value; - } - } - - public float Right - { - get - { - return _node.Right.Value; - } - - set - { - _node.Right = value; - } - } - - public float Bottom - { - get - { - return _node.Bottom.Value; - } - - set - { - _node.Bottom = value; - } - } - - public float Start - { - get - { - return _node.Start.Value; - } - - set - { - _node.Start = value; - } - } - - public float End - { - get - { - return _node.End.Value; - } - - set - { - _node.End = value; - } - } - - public float MarginLeft - { - get - { - return _node.MarginLeft.Value; - } - - set - { - _node.MarginLeft = value; - } - } - - public float MarginTop - { - get - { - return _node.MarginTop.Value; - } - - set - { - _node.MarginTop = value; - } - } - - public float MarginRight - { - get - { - return _node.MarginRight.Value; - } - - set - { - _node.MarginRight = value; - } - } - - public float MarginBottom - { - get - { - return _node.MarginBottom.Value; - } - - set - { - _node.MarginBottom = value; - } - } - - public float MarginStart - { - get - { - return _node.MarginStart.Value; - } - - set - { - _node.MarginStart = value; - } - } - - public float MarginEnd - { - get - { - return _node.MarginEnd.Value; - } - - set - { - _node.MarginEnd = value; - } - } - - public float MarginHorizontal - { - get - { - return _node.MarginHorizontal.Value; - } - - set - { - _node.MarginHorizontal = value; - } - } - - public float MarginVertical - { - get - { - return _node.MarginVertical.Value; - } - - set - { - _node.MarginVertical = value; - } - } - - public float Margin - { - get - { - return _node.Margin.Value; - } - - set - { - _node.Margin = value; - } - } - - public float PaddingLeft - { - get - { - return _node.PaddingLeft.Value; - } - - set - { - _node.PaddingLeft = value; - } - } - - public float PaddingTop - { - get - { - return _node.PaddingTop.Value; - } - - set - { - _node.PaddingTop = value; - } - } - - public float PaddingRight - { - get - { - return _node.PaddingRight.Value; - } - - set - { - _node.PaddingRight = value; - } - } - - public float PaddingBottom - { - get - { - return _node.PaddingBottom.Value; - } - - set - { - _node.PaddingBottom = value; - } - } - - public float PaddingStart - { - get - { - return _node.PaddingStart.Value; - } - - set - { - _node.PaddingStart = value; - } - } - - public float PaddingEnd - { - get - { - return _node.PaddingEnd.Value; - } - - set - { - _node.PaddingEnd = value; - } - } - - public float PaddingHorizontal - { - get - { - return _node.PaddingHorizontal.Value; - } - - set - { - _node.PaddingHorizontal = value; - } - } - - public float PaddingVertical - { - get - { - return _node.PaddingVertical.Value; - } - - set - { - _node.PaddingHorizontal = value; - } - } - - public float Padding - { - get - { - return _node.Padding.Value; - } - - set - { - _node.Padding = value; - } - } - - public float BorderLeftWidth - { - get - { - return _node.BorderLeftWidth; - } - - set - { - _node.BorderLeftWidth = value; - } - } - - public float BorderTopWidth - { - get - { - return _node.BorderTopWidth; - } - - set - { - _node.BorderTopWidth = value; - } - } - - public float BorderRightWidth - { - get - { - return _node.BorderRightWidth; - } - - set - { - _node.BorderRightWidth = value; - } - } - - public float BorderBottomWidth - { - get - { - return _node.BorderBottomWidth; - } - - set - { - _node.BorderBottomWidth = value; - } - } - - public float BorderStartWidth - { - get - { - return _node.BorderStartWidth; - } - - set - { - _node.BorderStartWidth = value; - } - } - - public float BorderEndWidth - { - get - { - return _node.BorderEndWidth; - } - - set - { - _node.BorderEndWidth = value; - } - } - - public float BorderWidth - { - get - { - return _node.BorderWidth; - } - - set - { - _node.BorderWidth = value; - } - } - - public float Height - { - get - { - return _node.Height.Value; - } - - set - { - _node.Height = value; - } - } - - public float Width - { - get - { - return _node.Width.Value; - } - - set - { - _node.Width = value; - } - } - - public float MinWidth - { - get - { - return _node.MinWidth.Value; - } - - set - { - _node.MinWidth = value; - } - } - - public float MinHeight - { - get - { - return _node.MinHeight.Value; - } - - set - { - _node.MinHeight = value; - } - } - - public float MaxWidth - { - get - { - return _node.MaxWidth.Value; - } - - set - { - _node.MaxWidth = value; - } - } - - public float MaxHeight - { - get - { - return _node.MaxHeight.Value; - } - - set - { - _node.MaxHeight = value; - } - } - - public float AspectRatio - { - get - { - return _node.AspectRatio; - } - - set - { - _node.AspectRatio = value; - } - } - - public void ApplyLayout() - { - NativeView view = null; - if (_viewRef.TryGetTarget(out view)) - { - float width = 0; - float height = 0; - GetWidthHeightOfNativeView(view, out width, out height); - if (view is NativeScrollView) - { - if (FlexDirection == YogaFlexDirection.Column || FlexDirection == YogaFlexDirection.ColumnReverse) - { - height = float.NaN; - } - else - { - width = float.NaN; - } - } - CalculateLayoutWithSize(this, width, height); - ApplyLayoutToViewHierarchy(view); - } - } - public SizeF IntrinsicSize - { - get - { - return CalculateLayoutWithSize(this, float.NaN, float.NaN); - } - } - - SizeF CalculateLayoutWithSize(YogaLayout layout, float width, float height) - { - //TODO : Check thread access - if (!layout.IsEnabled) - { - System.Diagnostics.Debug.WriteLine("Doesn't use Yoga"); - } - NativeView view = null; - if (_viewRef.TryGetTarget(out view)) - { - AttachNodesFromViewHierachy(view); - } - - var node = layout._node; - - node.CalculateLayout(width, height); - - return new SizeF { Width = node.LayoutWidth, Height = node.LayoutHeight }; - } - - static YogaSize MeasureView(YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode) - { - var constrainedWidth = (widthMode == YogaMeasureMode.Undefined) ? float.MaxValue : width; - var constrainedHeight = (heightMode == YogaMeasureMode.Undefined) ? float.MaxValue : height; - - NativeView view = null; - if (YogaKit.Bridges.ContainsKey(node)) - view = YogaKit.Bridges[node] as NativeView; - - float sizeThatFitsWidth = 0; - float sizeThatFitsHeight = 0; - - MeasureNativeView(view, constrainedWidth, constrainedHeight, out sizeThatFitsWidth, out sizeThatFitsHeight); - - var finalWidth = SanitizeMeasurement(constrainedWidth, sizeThatFitsWidth, widthMode); - var finalHeight = SanitizeMeasurement(constrainedHeight, sizeThatFitsHeight, heightMode); - - return MeasureOutput.Make(finalWidth, finalHeight); - } - - static float SanitizeMeasurement(float constrainedSize, float measuredSize, YogaMeasureMode measureMode) - { - float result; - if (measureMode == YogaMeasureMode.Exactly) - { - result = constrainedSize; - } - else if (measureMode == YogaMeasureMode.AtMost) - { - result = Math.Min(constrainedSize, measuredSize); - } - else { - result = measuredSize; - } - - return result; - } - - static bool NodeHasExactSameChildren(YogaNode node, NativeView[] subviews) - { - if (node.Count != subviews.Length) - return false; - for (int i = 0; i < subviews.Length; i++) - { - YogaLayout yoga = subviews[i].Yoga() as YogaLayout; - if (node[i] != yoga._node) - { - return false; - } - } - return true; - } - - static void AttachNodesFromViewHierachy(NativeView view) - { - YogaLayout yoga = view.Yoga() as YogaLayout; - var node = yoga._node; - // Only leaf nodes should have a measure function - if (yoga.IsLeaf) - { - RemoveAllChildren(node); - node.SetMeasureFunction(MeasureView); - } - else - { - node.SetMeasureFunction(null); - // Create a list of all the subviews that we are going to use for layout. - var subviewsToInclude = new List(); - foreach (var subview in view.Subviews) - { - if (subview.Yoga().IsEnabled && subview.Yoga().IsIncludeInLayout) - { - subviewsToInclude.Add(subview); - } - } - - if (!NodeHasExactSameChildren(node, subviewsToInclude.ToArray())) - { - RemoveAllChildren(node); - for (int i = 0; i < subviewsToInclude.Count; i++) - { - YogaLayout yogaSubview = subviewsToInclude[i].Yoga() as YogaLayout; - node.Insert(i, yogaSubview._node); - } - } - - foreach (var subView in subviewsToInclude) - { - AttachNodesFromViewHierachy(subView); - } - } - } - - static void RemoveAllChildren(YogaNode node) - { - if (node == null) - return; - - if (node.Count > 0) - { - node.Clear(); - } - } - - static double RoundPointValue(float value) - { - float scale = NativePixelScale; - - return Math.Round(value * scale) / scale; - } - - static void ApplyLayoutToViewHierarchy(NativeView view) - { - //TODO : "Framesetting should only be done on the main thread." - YogaLayout yoga = view.Yoga() as YogaLayout; - - if (!yoga.IsIncludeInLayout) - return; - - var node = yoga._node; - - ApplyLayoutToNativeView(view, node); - - if (!yoga.IsLeaf) - { - for (int i = 0; i < view.Subviews.Length; i++) - { - ApplyLayoutToViewHierarchy(view.Subviews[i]); - } - } - } - - - } -} - diff --git a/csharp/Mac/.gitignore b/csharp/Mac/.gitignore deleted file mode 100644 index 1cf1debb4d..0000000000 --- a/csharp/Mac/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -libyoga.dylib -*.userprefs diff --git a/csharp/Mac/ApiDefinition.cs b/csharp/Mac/ApiDefinition.cs deleted file mode 100644 index 94044b8e50..0000000000 --- a/csharp/Mac/ApiDefinition.cs +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; - -using AppKit; -using Foundation; -using ObjCRuntime; -using CoreGraphics; - -namespace Facebook.Yoga.Mac -{ - // Xamarin.Mac binding projects allow you to include native libraries inside C# DLLs for easy consumption - // later. However, the binding project build files currently assume you are binding some objective-c API - // and that you need an ApiDefinition.cs for that. yoga is all C APIs, so just include this "blank" file so - // the dylib gets packaged -} diff --git a/csharp/Mac/CustomBuildAction.targets b/csharp/Mac/CustomBuildAction.targets deleted file mode 100644 index d8df4e70d3..0000000000 --- a/csharp/Mac/CustomBuildAction.targets +++ /dev/null @@ -1,10 +0,0 @@ - - - - NativeLibrary;$(CompileDependsOn) - - - - - - \ No newline at end of file diff --git a/csharp/Mac/Facebook.Yoga.Mac.Sample/AppDelegate.cs b/csharp/Mac/Facebook.Yoga.Mac.Sample/AppDelegate.cs deleted file mode 100644 index 4264549378..0000000000 --- a/csharp/Mac/Facebook.Yoga.Mac.Sample/AppDelegate.cs +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using AppKit; -using Foundation; - -namespace Facebook.Yoga.Mac.Sample -{ - [Register("AppDelegate")] - public class AppDelegate : NSApplicationDelegate - { - public AppDelegate() - { - } - - public override void DidFinishLaunching(NSNotification notification) - { - } - - public override void WillTerminate(NSNotification notification) - { - // Insert code here to tear down your application - } - } -} diff --git a/csharp/Mac/Facebook.Yoga.Mac.Sample/Entitlements.plist b/csharp/Mac/Facebook.Yoga.Mac.Sample/Entitlements.plist deleted file mode 100644 index 9ae599370b..0000000000 --- a/csharp/Mac/Facebook.Yoga.Mac.Sample/Entitlements.plist +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/csharp/Mac/Facebook.Yoga.Mac.Sample/Facebook.Yoga.Mac.Sample.csproj b/csharp/Mac/Facebook.Yoga.Mac.Sample/Facebook.Yoga.Mac.Sample.csproj deleted file mode 100644 index 4337f0955d..0000000000 --- a/csharp/Mac/Facebook.Yoga.Mac.Sample/Facebook.Yoga.Mac.Sample.csproj +++ /dev/null @@ -1,84 +0,0 @@ - - - - Debug - AnyCPU - {64E0AB97-A904-4607-A535-EEA5A966C09E} - {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - Facebook.Yoga.Mac.Sample - Facebook.Yoga.Mac.Sample - v2.0 - Xamarin.Mac - Resources - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - Mac Developer - false - false - false - true - true - true - HttpClientHandler - Default - None - x86_64 - - - pdbonly - true - bin\Release - - prompt - 4 - false - true - false - true - true - true - SdkOnly - HttpClientHandler - Default - - - - - - - - - - - - - - - - - - - - ViewController.cs - - - - - - - - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71} - Facebook.Yoga.Mac - - - - diff --git a/csharp/Mac/Facebook.Yoga.Mac.Sample/Info.plist b/csharp/Mac/Facebook.Yoga.Mac.Sample/Info.plist deleted file mode 100644 index 3c1e900308..0000000000 --- a/csharp/Mac/Facebook.Yoga.Mac.Sample/Info.plist +++ /dev/null @@ -1,30 +0,0 @@ - - - - - CFBundleName - Facebook.Yoga.Mac.Sample - CFBundleIdentifier - com.facebook.facebook-yoga-mac-sample - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSMinimumSystemVersion - 10.11 - CFBundleDevelopmentRegion - en - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleSignature - ???? - NSHumanReadableCopyright - ${AuthorCopyright} - NSPrincipalClass - NSApplication - NSMainStoryboardFile - Main - - diff --git a/csharp/Mac/Facebook.Yoga.Mac.Sample/Main.cs b/csharp/Mac/Facebook.Yoga.Mac.Sample/Main.cs deleted file mode 100644 index 1f4f960097..0000000000 --- a/csharp/Mac/Facebook.Yoga.Mac.Sample/Main.cs +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using AppKit; - -namespace Facebook.Yoga.Mac.Sample -{ - static class MainClass - { - static void Main(string[] args) - { - NSApplication.Init(); - NSApplication.Main(args); - } - } -} diff --git a/csharp/Mac/Facebook.Yoga.Mac.Sample/Main.storyboard b/csharp/Mac/Facebook.Yoga.Mac.Sample/Main.storyboard deleted file mode 100644 index 6b7fa93d77..0000000000 --- a/csharp/Mac/Facebook.Yoga.Mac.Sample/Main.storyboard +++ /dev/null @@ -1,681 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Default - - - - - - - Left to Right - - - - - - - Right to Left - - - - - - - - - - - Default - - - - - - - Left to Right - - - - - - - Right to Left - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/csharp/Mac/Facebook.Yoga.Mac.Sample/ViewController.cs b/csharp/Mac/Facebook.Yoga.Mac.Sample/ViewController.cs deleted file mode 100644 index dbbd9c6ab0..0000000000 --- a/csharp/Mac/Facebook.Yoga.Mac.Sample/ViewController.cs +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -//#define DEBUG_LAYOUT -using System; - -using AppKit; -using Foundation; -using CoreGraphics; - -namespace Facebook.Yoga.Mac.Sample -{ - public static class NSViewYogaExtensions - { - public static void ApplyYogaLayout (this NSView view, YogaNode n, bool root = true) - { -#if DEBUG_LAYOUT - Console.WriteLine ($"ApplyYogaLayout {view.ToolTip}, {n.LayoutX}, {n.LayoutY}, {n.LayoutWidth}, {n.LayoutHeight}"); -#endif - - // A bit of gross special casing - // This really should mostly go away if/when the UIView+Yoga.m magic gets ported to AppKit - if (root) - view.Frame = new CGRect (n.LayoutX, n.LayoutY, n.LayoutWidth, n.LayoutHeight); -#if DEBUG_LAYOUT - Console.WriteLine ($"Setting {view.ToolTip} frame to {view.Frame}"); -#endif - - // This assumes your YogaNode and NSView children were inserted in same order - for (int i = 0; i < n.Count; ++i) { - YogaNode childNode = n[i]; - // Cocoa coord space is from bottom left not top left - view.Subviews[i].Frame = new CGRect (childNode.LayoutX, n.LayoutHeight - childNode.LayoutY - childNode.LayoutHeight, childNode.LayoutWidth, childNode.LayoutHeight); -#if DEBUG_LAYOUT - Console.WriteLine ($"Setting {view.Subviews[i].ToolTip} frame to {view.Subviews[i].Frame}"); -#endif - if (childNode.Count > 0){ -#if DEBUG_LAYOUT - Console.WriteLine ($"Calling ApplyYogaLayout recursively on {view.Subviews[i].ToolTip}"); -#endif - ApplyYogaLayout (view.Subviews[i], childNode, false); - } - } - } - } - - public partial class ViewController : NSViewController - { - public ViewController(IntPtr handle) : base(handle) - { - } - - public override void ViewDidLoad() - { - base.ViewDidLoad (); - - NSImage image = NSImage.ImageNamed (NSImageName.TrashFull); - - NSView root = CreateViewHierarchy (image); - var rootNode = CalculateLayout (View.Frame, image.Size); - - root.ApplyYogaLayout (rootNode); - - View.AddSubview (root); - } - - static NSView CreateViewHierarchy (NSImage image) - { - var root = new NSView () { - WantsLayer = true, - ToolTip = "Root" - }; - root.Layer.BackgroundColor = NSColor.Red.CGColor; - - NSView child1 = new NSView () { - WantsLayer = true, - ToolTip = "Child 1" - }; - child1.Layer.BackgroundColor = NSColor.Blue.CGColor; - - NSView child2 = new NSView () { - WantsLayer = true, - ToolTip = "Child 2" - }; - child2.Layer.BackgroundColor = NSColor.Green.CGColor; - - NSView child3 = new NSView () { - WantsLayer = true, - ToolTip = "Child 3" - }; - child3.Layer.BackgroundColor = NSColor.Yellow.CGColor; - - root.AddSubview (child1); - root.AddSubview (child2); - child2.AddSubview (child3); - - return root; - } - - static YogaNode CalculateLayout (CGRect rootFrame, CGSize imageSize) - { - var rootNode = new YogaNode () { - Width = (float)rootFrame.Width, - Height = (float)rootFrame.Height, - AlignItems = YogaAlign.Center, - JustifyContent = YogaJustify.Center - }; - - var child1Node = new YogaNode () { - Width = 100, - Height = 100 - }; - - var child2Node = new YogaNode () { - Width = 200, - Height = 100 - }; - - var child3Node = new YogaNode () { - Width = 100, - Height = 100 - }; - - rootNode.Insert (0, child1Node); - rootNode.Insert (1, child2Node); - child2Node.Insert (0, child3Node); - rootNode.CalculateLayout (); - - return rootNode; - } - } -} diff --git a/csharp/Mac/Facebook.Yoga.Mac.Sample/ViewController.designer.cs b/csharp/Mac/Facebook.Yoga.Mac.Sample/ViewController.designer.cs deleted file mode 100644 index 5ec5b65eb7..0000000000 --- a/csharp/Mac/Facebook.Yoga.Mac.Sample/ViewController.designer.cs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// WARNING -// -// This file has been generated automatically by Xamarin Studio to store outlets and -// actions made in the UI designer. If it is removed, they will be lost. -// Manual changes to this file may not be handled correctly. -// -using Foundation; - -namespace Facebook.Yoga.Mac.Sample -{ - [Register("ViewController")] - partial class ViewController - { - void ReleaseDesignerOutlets() - { - } - } -} diff --git a/csharp/Mac/Facebook.Yoga.Mac.Tests/Entitlements.plist b/csharp/Mac/Facebook.Yoga.Mac.Tests/Entitlements.plist deleted file mode 100644 index 9ae599370b..0000000000 --- a/csharp/Mac/Facebook.Yoga.Mac.Tests/Entitlements.plist +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/csharp/Mac/Facebook.Yoga.Mac.Tests/Facebook.Yoga.Mac.Tests.csproj b/csharp/Mac/Facebook.Yoga.Mac.Tests/Facebook.Yoga.Mac.Tests.csproj deleted file mode 100644 index 8594c976a8..0000000000 --- a/csharp/Mac/Facebook.Yoga.Mac.Tests/Facebook.Yoga.Mac.Tests.csproj +++ /dev/null @@ -1,78 +0,0 @@ - - - - Debug - AnyCPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77} - {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - Facebook.Yoga.Mac.Tests - Facebook.Yoga.Mac.Tests - v4.5 - Resources - true - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - Mac Developer - false - false - false - true - true - true - HttpClientHandler - Default - None - x86_64 - - - pdbonly - true - bin\Release - - - prompt - 4 - false - true - false - true - true - true - None - HttpClientHandler - Default - - - - - - - ..\..\packages\MonoDevelop.Addins.GuiUnit.0.1.1\lib\net45\GuiUnit.exe - - - - - - - - - - - - - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71} - Facebook.Yoga.Mac - - - - - \ No newline at end of file diff --git a/csharp/Mac/Facebook.Yoga.Mac.Tests/Info.plist b/csharp/Mac/Facebook.Yoga.Mac.Tests/Info.plist deleted file mode 100644 index 2671eb567d..0000000000 --- a/csharp/Mac/Facebook.Yoga.Mac.Tests/Info.plist +++ /dev/null @@ -1,30 +0,0 @@ - - - - - CFBundleName - Facebook.Yoga.Mac.Tests - CFBundleIdentifier - com.facebook.facebook-yoga-mac-tests - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSMinimumSystemVersion - 10.11 - CFBundleDevelopmentRegion - en - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleSignature - ???? - NSHumanReadableCopyright - ${AuthorCopyright} - NSPrincipalClass - NSApplication - NSMainStoryboardFile - Main - - diff --git a/csharp/Mac/Facebook.Yoga.Mac.Tests/Main.cs b/csharp/Mac/Facebook.Yoga.Mac.Tests/Main.cs deleted file mode 100644 index dc252cea78..0000000000 --- a/csharp/Mac/Facebook.Yoga.Mac.Tests/Main.cs +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Collections.Generic; -using AppKit; -using Foundation; -using GuiUnit; -using NUnit.Framework; - -namespace Facebook.Yoga.Mac.Tests -{ - static class MainClass - { - static void Main(string[] args) - { - NSApplication.Init(); - RunTests(); - } - - static void RunTests() - { - TestRunner.MainLoop = new NSRunLoopIntegration(); - List args = new List() { typeof(MainClass).Assembly.Location, "-labels", "-noheader", "-result=TEST-Mac.xml" }; - - - TestRunner.Main(args.ToArray()); - - } - - [System.Runtime.InteropServices.DllImport("/usr/lib/libSystem.dylib")] - static extern void _exit(int exit_code); - - class NSRunLoopIntegration : NSObject, IMainLoopIntegration - { - public void InitializeToolkit() - { - } - - public void RunMainLoop() - { - NSApplication.SharedApplication.Run(); - } - - public void InvokeOnMainLoop(InvokerHelper helper) - { - NSApplication.SharedApplication.InvokeOnMainThread(helper.Invoke); - } - - public void Shutdown() - { - _exit(TestRunner.ExitCode); - } - } - } -} diff --git a/csharp/Mac/Facebook.Yoga.Mac.Tests/packages.config b/csharp/Mac/Facebook.Yoga.Mac.Tests/packages.config deleted file mode 100644 index e9e997c32b..0000000000 --- a/csharp/Mac/Facebook.Yoga.Mac.Tests/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/csharp/Mac/Facebook.Yoga.Mac.csproj b/csharp/Mac/Facebook.Yoga.Mac.csproj deleted file mode 100644 index 3c129929f3..0000000000 --- a/csharp/Mac/Facebook.Yoga.Mac.csproj +++ /dev/null @@ -1,51 +0,0 @@ - - - - Debug - AnyCPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71} - {810C163F-4746-4721-8B8E-88A3673A62EA};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - Facebook.Yoga.Mac - Facebook.Yoga - Resources - - - true - full - false - bin\Debug - __UNIFIED__;DEBUG;MONOMAC - prompt - 4 - false - - - true - bin\Release - __UNIFIED__;MONOMAC - prompt - 4 - false - - - - - - - - - - - - - - - Dynamic - False - - - - - - diff --git a/csharp/Mac/Facebook.Yoga.Mac.sln b/csharp/Mac/Facebook.Yoga.Mac.sln deleted file mode 100644 index b44f1bbf81..0000000000 --- a/csharp/Mac/Facebook.Yoga.Mac.sln +++ /dev/null @@ -1,39 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac", "Facebook.Yoga.Mac.csproj", "{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac.Sample", "Facebook.Yoga.Mac.Sample\Facebook.Yoga.Mac.Sample.csproj", "{64E0AB97-A904-4607-A535-EEA5A966C09E}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared.Tests", "..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.shproj", "{4EDC82D9-A201-4831-8FE0-98F468F8E4AE}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{9352A9B6-F93B-45DD-8BCE-4696A62B3789}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac.Tests", "Facebook.Yoga.Mac.Tests\Facebook.Yoga.Mac.Tests.csproj", "{9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|Any CPU.Build.0 = Debug|Any CPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|Any CPU.ActiveCfg = Release|Any CPU - {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|Any CPU.Build.0 = Release|Any CPU - {64E0AB97-A904-4607-A535-EEA5A966C09E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {64E0AB97-A904-4607-A535-EEA5A966C09E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {64E0AB97-A904-4607-A535-EEA5A966C09E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {64E0AB97-A904-4607-A535-EEA5A966C09E}.Release|Any CPU.Build.0 = Release|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {91C42D32-291D-4B72-90B4-551663D60B8B} = {9352A9B6-F93B-45DD-8BCE-4696A62B3789} - {4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {9352A9B6-F93B-45DD-8BCE-4696A62B3789} - EndGlobalSection -EndGlobal diff --git a/csharp/Mac/run-tests.sh b/csharp/Mac/run-tests.sh deleted file mode 100755 index 7a01e6bfb6..0000000000 --- a/csharp/Mac/run-tests.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -./csharp/Mac/Facebook.Yoga.Mac.Tests/bin/Release/Facebook.Yoga.Mac.Tests.app/Contents/MacOS/Facebook.Yoga.Mac.Tests diff --git a/csharp/Unity/.gitignore b/csharp/Unity/.gitignore deleted file mode 100644 index a26b100a21..0000000000 --- a/csharp/Unity/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -Yoga -yoga.dll -yoga.unitypackage diff --git a/csharp/Unity/pack.sh b/csharp/Unity/pack.sh deleted file mode 100755 index 9b926d4fa7..0000000000 --- a/csharp/Unity/pack.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -set -e - -cd "$( dirname "$0" )" - -if [ \! -f yoga.dll ]; then - echo "Launch win.bat on Windows and copy yoga.dll to here" - exit 1 -fi - -function build { - buck build $1 - echo "$root/`buck targets --show-output $1|tail -1|awk '{print $2}'`" -} - -function copy { - mkdir -p $3 - cp $1 $3/$2 -} - -rm -rf Yoga yoga.unitypackage - -root=`buck root|tail -f` -mac=$(build '//csharp:yoganet#default,shared') -armv7=$(build '//csharp:yoganet#android-armv7,shared') -ios=$(build '//csharp:yoganet-ios') -win=yoga.dll - -Unity -quit -batchMode -createProject Yoga - -copy $win ${win##*/} Yoga/Assets/Facebook.Yoga/Plugins/x86_64 -copy $mac yoga Yoga/Assets/Facebook.Yoga/Plugins/x86_64/yoga.bundle/Contents/MacOS -armv7path=Assets/Plugins/Android/libs/armeabi-v7a -copy $armv7 ${armv7##*/} Yoga/$armv7path -iospath=Assets/Plugins/iOS -copy $ios ${ios##*/} Yoga/$iospath -libs="$armv7path/${armv7##*/} $iospath/${ios##*/}" - -scripts=Yoga/Assets/Facebook.Yoga/Scripts/Facebook.Yoga -mkdir -p $scripts -(cd ../Facebook.Yoga; tar cf - *.cs)|tar -C $scripts -xf - - -tests=Yoga/Assets/Facebook.Yoga/Editor/Facebook.Yoga.Tests -mkdir -p $tests -(cd ../tests/Facebook.Yoga; tar cf - *.cs)|tar -C $tests -xf - - -function onerror { - local xml=Yoga/EditorTestResults.xml - if [ -f $xml ]; then cat $xml|grep 'success="False"'; fi -} -trap onerror EXIT -Unity -quit -batchMode -projectPath `pwd`/Yoga -runEditorTests - -pkg="`pwd`/yoga.unitypackage" -Unity -quit -batchMode -projectPath `pwd`/Yoga -exportPackage Assets/Facebook.Yoga $libs $pkg - -echo "Success: $pkg" diff --git a/csharp/Unity/win.bat b/csharp/Unity/win.bat deleted file mode 100755 index b142ee50b9..0000000000 --- a/csharp/Unity/win.bat +++ /dev/null @@ -1,7 +0,0 @@ -@REM Copyright (c) Meta Platforms, Inc. and affiliates. -@REM -@REM This source code is licensed under the MIT license found in the -@REM LICENSE file in the root directory of this source tree. - -"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" ..\Yoga\Yoga.vcxproj /p:configuration=Release /property:Platform=x64 -xcopy "..\Yoga\bin\x64\Release\yoga.dll" %~dp0 /s /d /y diff --git a/csharp/Windows/Build/Facebook.Yoga.NativeInterop.Universal.targets b/csharp/Windows/Build/Facebook.Yoga.NativeInterop.Universal.targets deleted file mode 100644 index 8e1a49ffb4..0000000000 --- a/csharp/Windows/Build/Facebook.Yoga.NativeInterop.Universal.targets +++ /dev/null @@ -1,131 +0,0 @@ - - - - $(SolutionDir)..\Yoga\bin\Universal\ - $(NativeRootPath)x86\ - $(NativeRootPath)x64\ - $(NativeRootPath)ARM\ - Yoga - AMD64 - ARM - - - - - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - \ No newline at end of file diff --git a/csharp/Windows/Build/Facebook.Yoga.NativeInterop.targets b/csharp/Windows/Build/Facebook.Yoga.NativeInterop.targets deleted file mode 100644 index 9681d32482..0000000000 --- a/csharp/Windows/Build/Facebook.Yoga.NativeInterop.targets +++ /dev/null @@ -1,131 +0,0 @@ - - - - $(SolutionDir)..\Yoga\bin\ - $(NativeRootPath)x86\ - $(NativeRootPath)x64\ - $(NativeRootPath)ARM\ - Yoga - AMD64 - ARM - - - - - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - - $(NativeDLLMoniker).dll - PreserveNewest - False - - - $(NativeDLLMoniker).pdb - PreserveNewest - False - - - - - \ No newline at end of file diff --git a/csharp/Windows/Facebook.Yoga.Desktop.Tests/Facebook.Yoga.Desktop.Tests.csproj b/csharp/Windows/Facebook.Yoga.Desktop.Tests/Facebook.Yoga.Desktop.Tests.csproj deleted file mode 100644 index e553e819fd..0000000000 --- a/csharp/Windows/Facebook.Yoga.Desktop.Tests/Facebook.Yoga.Desktop.Tests.csproj +++ /dev/null @@ -1,103 +0,0 @@ - - - - - Debug - AnyCPU - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3} - Library - Properties - Facebook.Yoga - Facebook.Yoga.Desktop.Tests - v4.5.1 - 512 - - - - true - bin\x64\Debug\ - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - true - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - - - true - bin\x86\Debug\ - DEBUG;TRACE - full - x86 - prompt - MinimumRecommendedRules.ruleset - - - bin\x86\Release\ - TRACE - true - pdbonly - x86 - prompt - MinimumRecommendedRules.ruleset - - - true - bin\Debug\ - DEBUG;TRACE - true - full - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - - bin\Release\ - TRACE - true - pdbonly - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - - - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - True - - - - - - - - - - - - - {3aace384-fdec-4d91-a3b2-eeb21b46c9ad} - Facebook.Yoga - - - - - - - - - - This project references a native interop target that is missing. The missing build target is {0}. - - - - \ No newline at end of file diff --git a/csharp/Windows/Facebook.Yoga.Desktop.Tests/Properties/AssemblyInfo.cs b/csharp/Windows/Facebook.Yoga.Desktop.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index f1fe7657df..0000000000 --- a/csharp/Windows/Facebook.Yoga.Desktop.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System.Reflection; -using System.Resources; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("Facebook.Yoga.Desktop.Tests")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Facebook, Inc.")] -[assembly: AssemblyProduct("Facebook.Yoga")] -[assembly: AssemblyCopyright("Copyright (c) 2014-present, Facebook, Inc.")] - -[assembly: ComVisible(false)] - -[assembly: Guid("ac23f444-5545-4196-8b9f-5c1f6b3e7fb3")] - -[assembly: NeutralResourcesLanguage("en")] - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - diff --git a/csharp/Windows/Facebook.Yoga.Desktop.Tests/packages.config b/csharp/Windows/Facebook.Yoga.Desktop.Tests/packages.config deleted file mode 100644 index b25e5bda35..0000000000 --- a/csharp/Windows/Facebook.Yoga.Desktop.Tests/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/csharp/Windows/Facebook.Yoga.Desktop.sln b/csharp/Windows/Facebook.Yoga.Desktop.sln deleted file mode 100644 index 5738d06217..0000000000 --- a/csharp/Windows/Facebook.Yoga.Desktop.sln +++ /dev/null @@ -1,102 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{5289E508-8386-45A1-A12B-258A5899CD45}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Native", "Native", "{51A8E803-C084-431F-9130-F277481C2BB2}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NETStandard", "NETStandard", "{DCF7899B-A487-49C0-BCDE-DC088B6750C2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yoga", "..\Yoga\Yoga.vcxproj", "{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{39A2FFDA-C093-4FA6-8143-45B5019E7DAC}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga", "Facebook.Yoga\Facebook.Yoga.csproj", "{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}" - ProjectSection(ProjectDependencies) = postProject - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5} = {0446C86B-F47B-4C46-B673-C7AE0CFF35D5} - EndProjectSection -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared.Tests", "..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.shproj", "{4EDC82D9-A201-4831-8FE0-98F468F8E4AE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Desktop.Tests", "Facebook.Yoga.Desktop.Tests\Facebook.Yoga.Desktop.Tests.csproj", "{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}" -EndProject -Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - ..\Facebook.Yoga\Facebook.Yoga.Shared.projitems*{3aace384-fdec-4d91-a3b2-eeb21b46c9ad}*SharedItemsImports = 4 - ..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems*{4edc82d9-a201-4831-8fe0-98f468f8e4ae}*SharedItemsImports = 13 - ..\Facebook.Yoga\Facebook.Yoga.Shared.projitems*{91c42d32-291d-4b72-90b4-551663d60b8b}*SharedItemsImports = 13 - ..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems*{ac23f444-5545-4196-8b9f-5c1f6b3e7fb3}*SharedItemsImports = 4 - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|ARM.ActiveCfg = Debug|ARM - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|ARM.Build.0 = Debug|ARM - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|x64.ActiveCfg = Debug|x64 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|x64.Build.0 = Debug|x64 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|x86.ActiveCfg = Debug|Win32 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|x86.Build.0 = Debug|Win32 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|Any CPU.ActiveCfg = Release|Win32 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|ARM.ActiveCfg = Release|ARM - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|ARM.Build.0 = Release|ARM - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|x64.ActiveCfg = Release|x64 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|x64.Build.0 = Release|x64 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|x86.ActiveCfg = Release|Win32 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|x86.Build.0 = Release|Win32 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|ARM.ActiveCfg = Debug|ARM - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|ARM.Build.0 = Debug|ARM - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x64.ActiveCfg = Debug|x64 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x64.Build.0 = Debug|x64 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x86.ActiveCfg = Debug|x86 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x86.Build.0 = Debug|x86 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|Any CPU.Build.0 = Release|Any CPU - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|ARM.ActiveCfg = Release|ARM - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|ARM.Build.0 = Release|ARM - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x64.ActiveCfg = Release|x64 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x64.Build.0 = Release|x64 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x86.ActiveCfg = Release|x86 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x86.Build.0 = Release|x86 - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|ARM.ActiveCfg = Debug|Any CPU - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|ARM.Build.0 = Debug|Any CPU - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|x64.ActiveCfg = Debug|x64 - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|x64.Build.0 = Debug|x64 - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|x86.ActiveCfg = Debug|x86 - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|x86.Build.0 = Debug|x86 - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|Any CPU.Build.0 = Release|Any CPU - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|ARM.ActiveCfg = Release|Any CPU - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|ARM.Build.0 = Release|Any CPU - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|x64.ActiveCfg = Release|x64 - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|x64.Build.0 = Release|x64 - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|x86.ActiveCfg = Release|x86 - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5} = {51A8E803-C084-431F-9130-F277481C2BB2} - {91C42D32-291D-4B72-90B4-551663D60B8B} = {39A2FFDA-C093-4FA6-8143-45B5019E7DAC} - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD} = {DCF7899B-A487-49C0-BCDE-DC088B6750C2} - {4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {39A2FFDA-C093-4FA6-8143-45B5019E7DAC} - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3} = {5289E508-8386-45A1-A12B-258A5899CD45} - EndGlobalSection -EndGlobal diff --git a/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/LockScreenLogo.scale-200.png b/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/LockScreenLogo.scale-200.png deleted file mode 100644 index 428cabb6d4..0000000000 Binary files a/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/LockScreenLogo.scale-200.png and /dev/null differ diff --git a/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/SplashScreen.scale-200.png b/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/SplashScreen.scale-200.png deleted file mode 100644 index d1937479a7..0000000000 Binary files a/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/SplashScreen.scale-200.png and /dev/null differ diff --git a/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/Square150x150Logo.scale-200.png b/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/Square150x150Logo.scale-200.png deleted file mode 100644 index eb507ab9ce..0000000000 Binary files a/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/Square150x150Logo.scale-200.png and /dev/null differ diff --git a/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/Square44x44Logo.scale-200.png b/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/Square44x44Logo.scale-200.png deleted file mode 100644 index 2121ca588d..0000000000 Binary files a/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/Square44x44Logo.scale-200.png and /dev/null differ diff --git a/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/Square44x44Logo.targetsize-24_altform-unplated.png deleted file mode 100644 index 69053b7281..0000000000 Binary files a/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/Square44x44Logo.targetsize-24_altform-unplated.png and /dev/null differ diff --git a/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/StoreLogo.png b/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/StoreLogo.png deleted file mode 100644 index 8f628550d6..0000000000 Binary files a/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/StoreLogo.png and /dev/null differ diff --git a/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/Wide310x150Logo.scale-200.png b/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/Wide310x150Logo.scale-200.png deleted file mode 100644 index 6429d98629..0000000000 Binary files a/csharp/Windows/Facebook.Yoga.Universal.Tests/Assets/Wide310x150Logo.scale-200.png and /dev/null differ diff --git a/csharp/Windows/Facebook.Yoga.Universal.Tests/Facebook.Yoga.Universal.Tests.csproj b/csharp/Windows/Facebook.Yoga.Universal.Tests/Facebook.Yoga.Universal.Tests.csproj deleted file mode 100644 index 921cfffb2f..0000000000 --- a/csharp/Windows/Facebook.Yoga.Universal.Tests/Facebook.Yoga.Universal.Tests.csproj +++ /dev/null @@ -1,146 +0,0 @@ - - - - - Debug - x86 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73} - AppContainerExe - Properties - Facebook.Yoga.Universal.Tests - Facebook.Yoga.Universal.Tests - en-US - UAP - 10.0.10586.0 - 10.0.10240.0 - 14 - 512 - {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Facebook.Yoga.Universal.Tests_TemporaryKey.pfx - 14.0 - - - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x86 - false - prompt - true - - - bin\x86\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x86 - false - prompt - true - true - - - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - ARM - false - prompt - true - - - bin\ARM\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - ARM - false - prompt - true - true - - - true - bin\x64\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x64 - false - prompt - true - - - bin\x64\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x64 - false - prompt - true - true - - - - - - - - - - - UnitTestApp.xaml - - - - - - MSBuild:Compile - Designer - - - - - Designer - - - - - - - - - - - - - - - - {3aace384-fdec-4d91-a3b2-eeb21b46c9ad} - Facebook.Yoga - - - - - - - 14.0 - - - - - - This project references a native interop target that is missing. The missing build target is {0}. - - - - \ No newline at end of file diff --git a/csharp/Windows/Facebook.Yoga.Universal.Tests/Package.appxmanifest b/csharp/Windows/Facebook.Yoga.Universal.Tests/Package.appxmanifest deleted file mode 100644 index d4ec072f82..0000000000 --- a/csharp/Windows/Facebook.Yoga.Universal.Tests/Package.appxmanifest +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - Facebook.Yoga.Universal.Tests - anforste - Assets\StoreLogo.png - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/csharp/Windows/Facebook.Yoga.Universal.Tests/Properties/AssemblyInfo.cs b/csharp/Windows/Facebook.Yoga.Universal.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index 040a813885..0000000000 --- a/csharp/Windows/Facebook.Yoga.Universal.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Facebook.Yoga.Universal.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("BlueJeans")] -[assembly: AssemblyProduct("Facebook.Yoga.Universal.Tests")] -[assembly: AssemblyCopyright("Copyright © BlueJeans 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: AssemblyMetadata("TargetPlatform","UAP")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ComVisible(false)] \ No newline at end of file diff --git a/csharp/Windows/Facebook.Yoga.Universal.Tests/Properties/UnitTestApp.rd.xml b/csharp/Windows/Facebook.Yoga.Universal.Tests/Properties/UnitTestApp.rd.xml deleted file mode 100644 index 9263e4e5b6..0000000000 --- a/csharp/Windows/Facebook.Yoga.Universal.Tests/Properties/UnitTestApp.rd.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - diff --git a/csharp/Windows/Facebook.Yoga.Universal.Tests/UnitTestApp.xaml b/csharp/Windows/Facebook.Yoga.Universal.Tests/UnitTestApp.xaml deleted file mode 100644 index d8e15f8279..0000000000 --- a/csharp/Windows/Facebook.Yoga.Universal.Tests/UnitTestApp.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - diff --git a/csharp/Windows/Facebook.Yoga.Universal.Tests/UnitTestApp.xaml.cs b/csharp/Windows/Facebook.Yoga.Universal.Tests/UnitTestApp.xaml.cs deleted file mode 100644 index 35c098ca36..0000000000 --- a/csharp/Windows/Facebook.Yoga.Universal.Tests/UnitTestApp.xaml.cs +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.ApplicationModel; -using Windows.ApplicationModel.Activation; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; - -namespace Facebook.Yoga.Universal.Tests -{ - /// - /// Provides application-specific behavior to supplement the default Application class. - /// - sealed partial class App : Application - { - /// - /// Initializes the singleton application object. This is the first line of authored code - /// executed, and as such is the logical equivalent of main() or WinMain(). - /// - public App() - { - this.InitializeComponent(); - this.Suspending += OnSuspending; - } - - /// - /// Invoked when the application is launched normally by the end user. Other entry points - /// will be used such as when the application is launched to open a specific file. - /// - /// Details about the launch request and process. - protected override void OnLaunched(LaunchActivatedEventArgs e) - { - -#if DEBUG - if (System.Diagnostics.Debugger.IsAttached) - { - this.DebugSettings.EnableFrameRateCounter = true; - } -#endif - - Frame rootFrame = Window.Current.Content as Frame; - - // Do not repeat app initialization when the Window already has content, - // just ensure that the window is active - if (rootFrame == null) - { - // Create a Frame to act as the navigation context and navigate to the first page - rootFrame = new Frame(); - - rootFrame.NavigationFailed += OnNavigationFailed; - - if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) - { - //TODO: Load state from previously suspended application - } - - // Place the frame in the current Window - Window.Current.Content = rootFrame; - } - - Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.CreateDefaultUI(); - - // Ensure the current window is active - Window.Current.Activate(); - - Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.Run(e.Arguments); - } - - /// - /// Invoked when Navigation to a certain page fails - /// - /// The Frame which failed navigation - /// Details about the navigation failure - void OnNavigationFailed(object sender, NavigationFailedEventArgs e) - { - throw new Exception("Failed to load Page " + e.SourcePageType.FullName); - } - - /// - /// Invoked when application execution is being suspended. Application state is saved - /// without knowing whether the application will be terminated or resumed with the contents - /// of memory still intact. - /// - /// The source of the suspend request. - /// Details about the suspend request. - private void OnSuspending(object sender, SuspendingEventArgs e) - { - var deferral = e.SuspendingOperation.GetDeferral(); - //TODO: Save application state and stop any background activity - deferral.Complete(); - } - } -} diff --git a/csharp/Windows/Facebook.Yoga.Universal.Tests/YogaNodeTest.cs b/csharp/Windows/Facebook.Yoga.Universal.Tests/YogaNodeTest.cs deleted file mode 100644 index e0aeb5b4ec..0000000000 --- a/csharp/Windows/Facebook.Yoga.Universal.Tests/YogaNodeTest.cs +++ /dev/null @@ -1,429 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; -using Facebook.Yoga; - -namespace Facebook.Yoga.Universal.Tests -{ - [TestClass] - public class YogaNodeTest - { - [TestMethod] - public void TestAddChildGetParent() - { - YogaNode parent = new YogaNode(); - YogaNode child = new YogaNode(); - - Assert.IsNull(child.Parent); - Assert.AreEqual(0, parent.Count); - - parent.Insert(0, child); - - Assert.AreEqual(1, parent.Count); - Assert.AreEqual(child, parent[0]); - Assert.AreEqual(parent, child.Parent); - - parent.RemoveAt(0); - - Assert.IsNull(child.Parent); - Assert.AreEqual(0, parent.Count); - } - - [TestMethod] - public void TestChildren() - { - YogaNode parent = new YogaNode(); - foreach (YogaNode node in parent) - { - Assert.Fail(node.ToString()); - } - - YogaNode child0 = new YogaNode(); - Assert.AreEqual(-1, parent.IndexOf(child0)); - parent.Insert(0, child0); - foreach (YogaNode node in parent) - { - Assert.AreEqual(0, parent.IndexOf(node)); - } - - YogaNode child1 = new YogaNode(); - parent.Insert(1, child1); - int index = 0; - foreach (YogaNode node in parent) - { - Assert.AreEqual(index++, parent.IndexOf(node)); - } - - parent.RemoveAt(0); - Assert.AreEqual(-1, parent.IndexOf(child0)); - Assert.AreEqual(0, parent.IndexOf(child1)); - - parent.Clear(); - Assert.AreEqual(0, parent.Count); - - parent.Clear(); - Assert.AreEqual(0, parent.Count); - } - - [TestMethod] - public void TestRemoveAtFromEmpty() - { - YogaNode parent = new YogaNode(); - - try - { - parent.RemoveAt(0); - } - catch (System.NullReferenceException) - { - return; - } - - Assert.Fail("Excepted exception of type 'System.NullReferenceException'."); - } - - [TestMethod] - public void TestRemoveAtOutOfRange() - { - YogaNode parent = new YogaNode(); - YogaNode child = new YogaNode(); - parent.Insert(0, child); - - try - { - parent.RemoveAt(1); - } - catch (System.ArgumentOutOfRangeException) - { - return; - } - - Assert.Fail("Excepted exception of type 'System.ArgumentOutOfRangeException'."); - } - - [TestMethod] - public void TestCannotAddChildToMultipleParents() - { - YogaNode parent1 = new YogaNode(); - YogaNode parent2 = new YogaNode(); - YogaNode child = new YogaNode(); - - parent1.Insert(0, child); - - try - { - parent2.Insert(0, child); - } - catch (System.InvalidOperationException) - { - return; - } - - Assert.Fail("Excepted exception of type 'System.InvalidOperationException'."); - } - - [TestMethod] - public void TestReset() - { - int instanceCount = YogaNode.GetInstanceCount(); - YogaNode node = new YogaNode(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - node.Reset(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - } - - [TestMethod] - public void TestResetParent() - { - YogaNode parent = new YogaNode(); - YogaNode child = new YogaNode(); - parent.Insert(0, child); - - try - { - parent.Reset(); - } - catch (System.InvalidOperationException) - { - return; - } - - Assert.Fail("Excepted exception of type 'System.InvalidOperationException'."); - } - - [TestMethod] - public void TestResetChild() - { - YogaNode parent = new YogaNode(); - YogaNode child = new YogaNode(); - parent.Insert(0, child); - - try - { - child.Reset(); - } - catch (System.InvalidOperationException) - { - return; - } - - Assert.Fail("Excepted exception of type 'System.InvalidOperationException'."); - } - - [TestMethod] - public void TestClear() - { - 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, YogaNode.GetInstanceCount()); - } - - [TestMethod] - public void TestMeasureFunc() - { - YogaNode node = new YogaNode(); - node.SetMeasureFunction((_, width, widthMode, height, heightMode) => { - return MeasureOutput.Make(100, 150); - }); - node.CalculateLayout(); - Assert.AreEqual(100, node.LayoutWidth); - Assert.AreEqual(150, node.LayoutHeight); - } - - [TestMethod] - public void TestMeasureFuncWithFloat() - { - YogaNode node = new YogaNode(); - node.SetMeasureFunction((_, width, widthMode, height, heightMode) => { - return MeasureOutput.Make(123.4f, 81.7f); - }); - node.CalculateLayout(); - Assert.AreEqual(124, node.LayoutWidth); - Assert.AreEqual(82, node.LayoutHeight); - } - - [TestMethod] - public void TestChildWithMeasureFunc() - { - YogaNode node = new YogaNode(); - - node.SetMeasureFunction((_, width, widthMode, height, heightMode) => { - return MeasureOutput.Make(100, 150); - }); - YogaNode child = new YogaNode(); - - try - { - node.Insert(0, child); - } - catch (System.InvalidOperationException) - { - return; - } - - Assert.Fail("Excepted exception of type 'System.InvalidOperationException'."); - } - - [TestMethod] - public void TestMeasureFuncWithChild() - { - YogaNode node = new YogaNode(); - YogaNode child = new YogaNode(); - node.Insert(0, child); - - try - { - node.SetMeasureFunction((_, width, widthMode, height, heightMode) => { - return MeasureOutput.Make(100, 150); - }); - } - catch (System.InvalidOperationException) - { - return; - } - - Assert.Fail("Excepted exception of type 'System.InvalidOperationException'."); - } - - [TestMethod] - public void TestPrint() - { - YogaNode parent = new YogaNode(); - parent.Width = 100; - parent.Height = 120; - YogaNode child0 = new YogaNode(); - child0.Width = 30; - child0.Height = 40; - YogaNode child1 = new YogaNode(); - child1.Width = 35; - child1.Height = 45; - parent.Insert(0, child0); - parent.Insert(0, child1); - parent.CalculateLayout(); - Assert.AreEqual(parent.Print(), - "
\n" + - "
\n" + - "
\n" + - "
" - ); - } - - [TestMethod] - public void TestCopyStyle() - { - YogaNode node0 = new YogaNode(); - Assert.IsTrue(YogaConstants.IsUndefined(node0.MaxHeight)); - - YogaNode node1 = new YogaNode(); - node1.MaxHeight = 100; - - node0.CopyStyle(node1); - Assert.AreEqual(100, node0.MaxHeight); - } - -#if !UNITY_EDITOR - private void ForceGC() - { - GC.Collect(GC.MaxGeneration); - GC.WaitForPendingFinalizers(); - } - - [TestMethod] - public void TestDestructor() - { - ForceGC(); - int instanceCount = YogaNode.GetInstanceCount(); - TestDestructorForGC(instanceCount); - ForceGC(); - Assert.AreEqual(instanceCount, YogaNode.GetInstanceCount()); - } - - private void TestDestructorForGC(int instanceCount) - { - YogaNode node = new YogaNode(); - Assert.IsNotNull(node); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - node = null; - } - - [TestMethod] - public void TestDestructorWithChildren() - { - ForceGC(); - int instanceCount = YogaNode.GetInstanceCount(); - TestDestructorWithChildrenForGC1(instanceCount); - ForceGC(); - Assert.AreEqual(instanceCount, YogaNode.GetInstanceCount()); - } - - private void TestDestructorWithChildrenForGC1(int instanceCount) - { - YogaNode node = new YogaNode(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - - TestDestructorWithChildrenForGC2(node, instanceCount + 1); - ForceGC(); - Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount()); - - TestDestructorWithChildrenForGC2(node, instanceCount + 2); - ForceGC(); - Assert.AreEqual(instanceCount + 3, YogaNode.GetInstanceCount()); - - node = null; - } - - private void TestDestructorWithChildrenForGC2(YogaNode parent, int instanceCount) - { - YogaNode child = new YogaNode(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - - parent.Insert(0, child); - child = null; - } - - [TestMethod] - public void TestParentDestructor() - { - ForceGC(); - 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, YogaNode.GetInstanceCount()); - } - - private void TestParentDestructorForGC(YogaNode child, int instanceCount) - { - YogaNode parent = new YogaNode(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - parent.Insert(0, child); - } - - [TestMethod] - public void TestClearWithChildDestructor() - { - ForceGC(); - int instanceCount = YogaNode.GetInstanceCount(); - YogaNode node = new YogaNode(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - TestClearWithChildDestructorForGC(node, instanceCount + 1); - ForceGC(); - Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount()); - node.Clear(); - Assert.AreEqual(0, node.Count); - ForceGC(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - } - - private void TestClearWithChildDestructorForGC(YogaNode parent, int instanceCount) - { - YogaNode child = new YogaNode(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - parent.Insert(0, child); - } - - [TestMethod] - public void TestMeasureFuncWithDestructor() - { - ForceGC(); - int instanceCount = YogaNode.GetInstanceCount(); - YogaNode parent = new YogaNode(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - TestMeasureFuncWithDestructorForGC(parent); - ForceGC(); - Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount()); - parent.CalculateLayout(); - Assert.AreEqual(120, (int)parent.LayoutWidth); - Assert.AreEqual(130, (int)parent.LayoutHeight); - } - - private void TestMeasureFuncWithDestructorForGC(YogaNode parent) - { - YogaNode child = new YogaNode(); - parent.Insert(0, child); - child.SetMeasureFunction((_, width, widthMode, height, heightMode) => { - return MeasureOutput.Make(120, 130); - }); - } -#endif - } -} diff --git a/csharp/Windows/Facebook.Yoga.Universal.Tests/project.json b/csharp/Windows/Facebook.Yoga.Universal.Tests/project.json deleted file mode 100644 index 32d927479d..0000000000 --- a/csharp/Windows/Facebook.Yoga.Universal.Tests/project.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "dependencies": { - "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2" - }, - "frameworks": { - "uap10.0": {} - }, - "runtimes": { - "win10-arm": {}, - "win10-arm-aot": {}, - "win10-x86": {}, - "win10-x86-aot": {}, - "win10-x64": {}, - "win10-x64-aot": {} - } -} \ No newline at end of file diff --git a/csharp/Windows/Facebook.Yoga.Universal.sln b/csharp/Windows/Facebook.Yoga.Universal.sln deleted file mode 100644 index f7ce196d4f..0000000000 --- a/csharp/Windows/Facebook.Yoga.Universal.sln +++ /dev/null @@ -1,104 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{5289E508-8386-45A1-A12B-258A5899CD45}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Native", "Native", "{51A8E803-C084-431F-9130-F277481C2BB2}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Universal", "Universal", "{1048DB7D-9B95-48CA-B43E-D9C35AB1DCD4}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yoga.uwp", "..\Yoga\Yoga.Universal.vcxproj", "{2EACF721-73B5-46AE-9775-4A8674D05A9C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{39A2FFDA-C093-4FA6-8143-45B5019E7DAC}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Universal", "Facebook.Yoga.Universal\Facebook.Yoga.Universal.csproj", "{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}" - ProjectSection(ProjectDependencies) = postProject - {2EACF721-73B5-46AE-9775-4A8674D05A9C} = {2EACF721-73B5-46AE-9775-4A8674D05A9C} - EndProjectSection -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared.Tests", "..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.shproj", "{4EDC82D9-A201-4831-8FE0-98F468F8E4AE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Universal.Tests", "Facebook.Yoga.Universal.Tests\Facebook.Yoga.Universal.Tests.csproj", "{0C76D2FE-6767-44FE-B03D-21B2076BAA73}" -EndProject -Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - ..\Facebook.Yoga\Facebook.Yoga.Shared.projitems*{d6477ad6-9edd-4eba-8c60-cd31f77c52c6}*SharedItemsImports = 4 - ..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems*{4edc82d9-a201-4831-8fe0-98f468f8e4ae}*SharedItemsImports = 13 - ..\Facebook.Yoga\Facebook.Yoga.Shared.projitems*{91c42d32-291d-4b72-90b4-551663d60b8b}*SharedItemsImports = 13 - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Debug|ARM.ActiveCfg = Debug|ARM - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Debug|ARM.Build.0 = Debug|ARM - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Debug|x64.ActiveCfg = Debug|x64 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Debug|x64.Build.0 = Debug|x64 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Debug|x86.ActiveCfg = Debug|Win32 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Debug|x86.Build.0 = Debug|Win32 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|Any CPU.ActiveCfg = Release|Win32 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|ARM.ActiveCfg = Release|ARM - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|ARM.Build.0 = Release|ARM - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|x64.ActiveCfg = Release|x64 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|x64.Build.0 = Release|x64 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|x86.ActiveCfg = Release|Win32 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|x86.Build.0 = Release|Win32 - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|ARM.ActiveCfg = Debug|ARM - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|ARM.Build.0 = Debug|ARM - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|x64.ActiveCfg = Debug|x64 - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|x64.Build.0 = Debug|x64 - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|x86.ActiveCfg = Debug|x86 - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|x86.Build.0 = Debug|x86 - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|Any CPU.Build.0 = Release|Any CPU - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|ARM.ActiveCfg = Release|ARM - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|ARM.Build.0 = Release|ARM - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|x64.ActiveCfg = Release|x64 - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|x64.Build.0 = Release|x64 - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|x86.ActiveCfg = Release|x86 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|Any CPU.ActiveCfg = Debug|x86 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|ARM.ActiveCfg = Debug|ARM - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|ARM.Build.0 = Debug|ARM - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|ARM.Deploy.0 = Debug|ARM - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|x64.ActiveCfg = Debug|x64 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|x64.Build.0 = Debug|x64 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|x64.Deploy.0 = Debug|x64 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|x86.ActiveCfg = Debug|x86 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|x86.Build.0 = Debug|x86 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|x86.Deploy.0 = Debug|x86 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Release|Any CPU.ActiveCfg = Release|x86 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Release|ARM.ActiveCfg = Release|ARM - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Release|ARM.Build.0 = Release|ARM - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Release|ARM.Deploy.0 = Release|ARM - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Release|x64.ActiveCfg = Release|x64 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Release|x64.Build.0 = Release|x64 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Release|x64.Deploy.0 = Release|x64 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Release|x86.ActiveCfg = Release|x86 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Release|x86.Build.0 = Release|x86 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Release|x86.Deploy.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {2EACF721-73B5-46AE-9775-4A8674D05A9C} = {51A8E803-C084-431F-9130-F277481C2BB2} - {91C42D32-291D-4B72-90B4-551663D60B8B} = {39A2FFDA-C093-4FA6-8143-45B5019E7DAC} - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6} = {1048DB7D-9B95-48CA-B43E-D9C35AB1DCD4} - {4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {39A2FFDA-C093-4FA6-8143-45B5019E7DAC} - {0C76D2FE-6767-44FE-B03D-21B2076BAA73} = {5289E508-8386-45A1-A12B-258A5899CD45} - EndGlobalSection -EndGlobal diff --git a/csharp/Windows/Facebook.Yoga.Universal/Facebook.Yoga.Universal.csproj b/csharp/Windows/Facebook.Yoga.Universal/Facebook.Yoga.Universal.csproj deleted file mode 100644 index 759b33362a..0000000000 --- a/csharp/Windows/Facebook.Yoga.Universal/Facebook.Yoga.Universal.csproj +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Debug - AnyCPU - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6} - Library - Properties - Facebook.Yoga - Facebook.Yoga - en-US - UAP - 10.0.14393.0 - 10.0.10240.0 - 14 - 512 - {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - prompt - 4 - - - x86 - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x86 - false - prompt - - - x86 - bin\x86\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x86 - false - prompt - - - ARM - true - bin\ARM\Debug\ - TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;WINDOWS_UWP_ARM - ;2008 - full - AnyCPU - false - prompt - - - ARM - bin\ARM\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP;WINDOWS_UWP_ARM - true - ;2008 - pdbonly - AnyCPU - false - prompt - - - x64 - true - bin\x64\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x64 - false - prompt - - - x64 - bin\x64\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x64 - false - prompt - - - - - - - - - - - 14.0 - - - - \ No newline at end of file diff --git a/csharp/Windows/Facebook.Yoga.Universal/project.json b/csharp/Windows/Facebook.Yoga.Universal/project.json deleted file mode 100644 index 4aaae4c65a..0000000000 --- a/csharp/Windows/Facebook.Yoga.Universal/project.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "dependencies": { - "Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0" - }, - "frameworks": { - "uap10.0": {} - }, - "runtimes": { - "win10-arm": {}, - "win10-arm-aot": {}, - "win10-x86": {}, - "win10-x86-aot": {}, - "win10-x64": {}, - "win10-x64-aot": {} - } -} \ No newline at end of file diff --git a/csharp/Windows/Facebook.Yoga.sln b/csharp/Windows/Facebook.Yoga.sln deleted file mode 100644 index 77eb29c934..0000000000 --- a/csharp/Windows/Facebook.Yoga.sln +++ /dev/null @@ -1,156 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{5289E508-8386-45A1-A12B-258A5899CD45}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Native", "Native", "{51A8E803-C084-431F-9130-F277481C2BB2}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NETStandard", "NETStandard", "{DCF7899B-A487-49C0-BCDE-DC088B6750C2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yoga", "..\Yoga\Yoga.vcxproj", "{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yoga.uwp", "..\Yoga\Yoga.Universal.vcxproj", "{2EACF721-73B5-46AE-9775-4A8674D05A9C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{39A2FFDA-C093-4FA6-8143-45B5019E7DAC}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga", "Facebook.Yoga\Facebook.Yoga.csproj", "{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}" - ProjectSection(ProjectDependencies) = postProject - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5} = {0446C86B-F47B-4C46-B673-C7AE0CFF35D5} - {2EACF721-73B5-46AE-9775-4A8674D05A9C} = {2EACF721-73B5-46AE-9775-4A8674D05A9C} - EndProjectSection -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared.Tests", "..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.shproj", "{4EDC82D9-A201-4831-8FE0-98F468F8E4AE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Desktop.Tests", "Facebook.Yoga.Desktop.Tests\Facebook.Yoga.Desktop.Tests.csproj", "{AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Universal.Tests", "Facebook.Yoga.Universal.Tests\Facebook.Yoga.Universal.Tests.csproj", "{0C76D2FE-6767-44FE-B03D-21B2076BAA73}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Universal", "Universal", "{6669329B-017F-45B3-8611-53AFD065E45C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Universal", "Facebook.Yoga.Universal\Facebook.Yoga.Universal.csproj", "{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}" -EndProject -Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - ..\Facebook.Yoga\Facebook.Yoga.Shared.projitems*{3aace384-fdec-4d91-a3b2-eeb21b46c9ad}*SharedItemsImports = 4 - ..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems*{4edc82d9-a201-4831-8fe0-98f468f8e4ae}*SharedItemsImports = 13 - ..\Facebook.Yoga\Facebook.Yoga.Shared.projitems*{91c42d32-291d-4b72-90b4-551663d60b8b}*SharedItemsImports = 13 - ..\Facebook.Yoga\Facebook.Yoga.Shared.projitems*{d6477ad6-9edd-4eba-8c60-cd31f77c52c6}*SharedItemsImports = 4 - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|ARM.ActiveCfg = Debug|ARM - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|ARM.Build.0 = Debug|ARM - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|x64.ActiveCfg = Debug|x64 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|x64.Build.0 = Debug|x64 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|x86.ActiveCfg = Debug|Win32 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Debug|x86.Build.0 = Debug|Win32 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|Any CPU.ActiveCfg = Release|Win32 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|Any CPU.Build.0 = Release|Win32 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|ARM.ActiveCfg = Release|ARM - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|ARM.Build.0 = Release|ARM - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|x64.ActiveCfg = Release|x64 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|x64.Build.0 = Release|x64 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|x86.ActiveCfg = Release|Win32 - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5}.Release|x86.Build.0 = Release|Win32 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Debug|ARM.ActiveCfg = Debug|ARM - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Debug|ARM.Build.0 = Debug|ARM - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Debug|x64.ActiveCfg = Debug|x64 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Debug|x64.Build.0 = Debug|x64 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Debug|x86.ActiveCfg = Debug|Win32 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Debug|x86.Build.0 = Debug|Win32 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|Any CPU.ActiveCfg = Release|Win32 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|Any CPU.Build.0 = Release|Win32 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|ARM.ActiveCfg = Release|ARM - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|ARM.Build.0 = Release|ARM - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|x64.ActiveCfg = Release|x64 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|x64.Build.0 = Release|x64 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|x86.ActiveCfg = Release|Win32 - {2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|x86.Build.0 = Release|Win32 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|ARM.ActiveCfg = Debug|ARM - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|ARM.Build.0 = Debug|ARM - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x64.ActiveCfg = Debug|x64 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x64.Build.0 = Debug|x64 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x86.ActiveCfg = Debug|x86 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x86.Build.0 = Debug|x86 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|Any CPU.Build.0 = Release|Any CPU - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|ARM.ActiveCfg = Release|ARM - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|ARM.Build.0 = Release|ARM - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x64.ActiveCfg = Release|x64 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x64.Build.0 = Release|x64 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x86.ActiveCfg = Release|x86 - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x86.Build.0 = Release|x86 - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|ARM.ActiveCfg = Debug|Any CPU - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|ARM.Build.0 = Debug|Any CPU - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|x64.ActiveCfg = Debug|x64 - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|x64.Build.0 = Debug|x64 - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|x86.ActiveCfg = Debug|x86 - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Debug|x86.Build.0 = Debug|x86 - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|ARM.ActiveCfg = Release|Any CPU - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|x64.ActiveCfg = Release|x64 - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3}.Release|x86.ActiveCfg = Release|x86 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|Any CPU.ActiveCfg = Debug|x86 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|ARM.ActiveCfg = Debug|ARM - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|ARM.Build.0 = Debug|ARM - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|ARM.Deploy.0 = Debug|ARM - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|x64.ActiveCfg = Debug|x64 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|x64.Build.0 = Debug|x64 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|x64.Deploy.0 = Debug|x64 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|x86.ActiveCfg = Debug|x86 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|x86.Build.0 = Debug|x86 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|x86.Deploy.0 = Debug|x86 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Release|Any CPU.ActiveCfg = Release|x86 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Release|ARM.ActiveCfg = Release|ARM - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Release|x64.ActiveCfg = Release|x64 - {0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Release|x86.ActiveCfg = Release|x86 - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|ARM.ActiveCfg = Debug|ARM - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|ARM.Build.0 = Debug|ARM - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|x64.ActiveCfg = Debug|x64 - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|x64.Build.0 = Debug|x64 - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|x86.ActiveCfg = Debug|x86 - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|x86.Build.0 = Debug|x86 - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|Any CPU.Build.0 = Release|Any CPU - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|ARM.ActiveCfg = Release|ARM - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|ARM.Build.0 = Release|ARM - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|x64.ActiveCfg = Release|x64 - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|x64.Build.0 = Release|x64 - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|x86.ActiveCfg = Release|x86 - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5} = {51A8E803-C084-431F-9130-F277481C2BB2} - {2EACF721-73B5-46AE-9775-4A8674D05A9C} = {51A8E803-C084-431F-9130-F277481C2BB2} - {91C42D32-291D-4B72-90B4-551663D60B8B} = {39A2FFDA-C093-4FA6-8143-45B5019E7DAC} - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD} = {DCF7899B-A487-49C0-BCDE-DC088B6750C2} - {4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {39A2FFDA-C093-4FA6-8143-45B5019E7DAC} - {AC23F444-5545-4196-8B9F-5C1F6B3E7FB3} = {5289E508-8386-45A1-A12B-258A5899CD45} - {0C76D2FE-6767-44FE-B03D-21B2076BAA73} = {5289E508-8386-45A1-A12B-258A5899CD45} - {D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6} = {6669329B-017F-45B3-8611-53AFD065E45C} - EndGlobalSection -EndGlobal diff --git a/csharp/Windows/Facebook.Yoga/Facebook.Yoga.csproj b/csharp/Windows/Facebook.Yoga/Facebook.Yoga.csproj deleted file mode 100644 index 79ab3e5a09..0000000000 --- a/csharp/Windows/Facebook.Yoga/Facebook.Yoga.csproj +++ /dev/null @@ -1,115 +0,0 @@ - - - - - 14.0 - Debug - AnyCPU - {3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD} - Library - Properties - Facebook.Yoga - Facebook.Yoga - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - v5.0 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - bin\ARM\Debug\ - DEBUG;TRACE - true - full - ARM - prompt - MinimumRecommendedRules.ruleset - - - bin\ARM\Release\ - TRACE - true - true - pdbonly - ARM - prompt - MinimumRecommendedRules.ruleset - - - true - bin\x64\Debug\ - DEBUG;TRACE - true - full - x64 - prompt - MinimumRecommendedRules.ruleset - - - bin\x64\Release\ - TRACE - true - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - - - true - bin\x86\Debug\ - DEBUG;TRACE - true - full - x86 - prompt - MinimumRecommendedRules.ruleset - - - bin\x86\Release\ - TRACE - true - true - pdbonly - x86 - prompt - MinimumRecommendedRules.ruleset - - - - - - - - - - - - - - \ No newline at end of file diff --git a/csharp/Windows/Facebook.Yoga/Properties/AssemblyInfo.cs b/csharp/Windows/Facebook.Yoga/Properties/AssemblyInfo.cs deleted file mode 100644 index 877e31d04d..0000000000 --- a/csharp/Windows/Facebook.Yoga/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System.Reflection; -using System.Resources; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("Facebook.Yoga")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Facebook, Inc.")] -[assembly: AssemblyProduct("Facebook.Yoga")] -[assembly: AssemblyDescription("A subset of CSS's flexbox layout algorithm and box model.")] -[assembly: AssemblyCopyright("Copyright (c) 2014-present, Facebook, Inc.")] - -[assembly: ComVisible(false)] - -[assembly: Guid("75bb7605-e54b-4ede-8f5a-ff1f24464236")] - -[assembly: NeutralResourcesLanguage("en")] - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - diff --git a/csharp/Windows/Facebook.Yoga/project.json b/csharp/Windows/Facebook.Yoga/project.json deleted file mode 100644 index 83b11a8324..0000000000 --- a/csharp/Windows/Facebook.Yoga/project.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "dependencies": { - "Microsoft.NETCore.Portable.Compatibility": "1.0.1", - "NETStandard.Library": "1.6.1" - }, - "frameworks": { - "netstandard1.1": {} - }, - "language": "en", - "supports": {}, - "version": "3.0.0-*" -} \ No newline at end of file diff --git a/csharp/Yoga/YGInterop.cpp b/csharp/Yoga/YGInterop.cpp deleted file mode 100644 index d71a4b3f1e..0000000000 --- a/csharp/Yoga/YGInterop.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "YGInterop.h" - -static YGInteropLogger gManagedLogger; - -static int unmanagedLogger( - const YGConfigRef config, - const YGNodeRef node, - YGLogLevel level, - const char* format, - va_list args) { - int result = 0; - if (gManagedLogger) { - char message[8192]; - result = vsnprintf(message, sizeof(message), format, args); - (*gManagedLogger)(config, node, level, message); - } - return result; -} - -YOGA_EXPORT void YGInteropSetLogger(YGInteropLogger managedLogger) { - gManagedLogger = managedLogger; - YGConfigSetLogger(YGConfigGetDefault(), &unmanagedLogger); -} diff --git a/csharp/Yoga/YGInterop.h b/csharp/Yoga/YGInterop.h deleted file mode 100644 index aa3a3c1137..0000000000 --- a/csharp/Yoga/YGInterop.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -YG_EXTERN_C_BEGIN - -typedef int (*YGInteropLogger)( - const void* unmanagedConfigPtr, - const void* unmanagedNodePtr, - YGLogLevel level, - const char* message); - -WIN_EXPORT YGConfigRef YGConfigGetDefault(); - -WIN_EXPORT void YGInteropSetLogger(YGInteropLogger managedLogger); - -YG_EXTERN_C_END diff --git a/csharp/Yoga/Yoga.Universal.vcxproj b/csharp/Yoga/Yoga.Universal.vcxproj deleted file mode 100644 index 1c956466ec..0000000000 --- a/csharp/Yoga/Yoga.Universal.vcxproj +++ /dev/null @@ -1,299 +0,0 @@ - - - - - Debug - ARM - - - Debug - Win32 - - - Release - ARM - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {2EACF721-73B5-46AE-9775-4A8674D05A9C} - Win32Proj - yoga.uwp - Yoga - true - Windows Store - 10.0.14393.0 - 10.0.14393.0 - 10.0 - - - - DynamicLibrary - true - v141 - Unicode - - - DynamicLibrary - true - v141 - Unicode - - - DynamicLibrary - false - v141 - true - Unicode - - - DynamicLibrary - false - v141 - true - Unicode - - - DynamicLibrary - true - v141 - Unicode - - - DynamicLibrary - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - true - bin\Universal\$(PlatformTarget)\$(Configuration)\ - obj\Universal\$(PlatformTarget)\$(Configuration)\ - yoga - - - true - bin\Universal\$(PlatformTarget)\$(Configuration)\ - obj\$(PlatformTarget)\$(Configuration)\ - yoga - - - true - bin\Universal\$(PlatformTarget)\$(Configuration)\ - obj\Universal\$(PlatformTarget)\$(Configuration)\ - yoga - - - false - bin\Universal\$(PlatformTarget)\$(Configuration)\ - obj\$(PlatformTarget)\$(Configuration)\ - yoga - - - false - bin\Universal\$(PlatformTarget)\$(Configuration)\ - obj\$(PlatformTarget)\$(Configuration)\ - yoga - - - false - bin\Universal\$(PlatformTarget)\$(Configuration)\ - obj\$(PlatformTarget)\$(Configuration)\ - yoga - - - - - - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions) - true - $(ProjectDir)..\..\;%(AdditionalIncludeDirectories) - false - - - Windows - true - - - - - - - Level3 - Disabled - WINARMDLL;WIN32;_DEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions) - true - $(ProjectDir)..\..\;%(AdditionalIncludeDirectories) - false - - - Windows - true - - - - - NotUsing - Level3 - Disabled - _DEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions) - true - $(ProjectDir)..\..\;%(AdditionalIncludeDirectories) - false - - - Windows - true - - - - - Level3 - NotUsing - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions) - true - $(ProjectDir)..\..\;%(AdditionalIncludeDirectories) - false - - - Windows - true - true - true - - - - - Level3 - NotUsing - MaxSpeed - true - true - WINARMDLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions) - true - $(ProjectDir)..\..\;%(AdditionalIncludeDirectories) - false - - - Windows - true - true - true - - - - - Level3 - NotUsing - MaxSpeed - true - true - NDEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions) - true - $(ProjectDir)..\..\;%(AdditionalIncludeDirectories) - false - - - Windows - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - false - - - - - false - - - false - false - - - - - false - - - - - - - - - - - - diff --git a/csharp/Yoga/Yoga.Universal.vcxproj.filters b/csharp/Yoga/Yoga.Universal.vcxproj.filters deleted file mode 100644 index 697d52c169..0000000000 --- a/csharp/Yoga/Yoga.Universal.vcxproj.filters +++ /dev/null @@ -1,104 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - diff --git a/csharp/Yoga/Yoga.rc b/csharp/Yoga/Yoga.rc deleted file mode 100644 index e684194ea7..0000000000 Binary files a/csharp/Yoga/Yoga.rc and /dev/null differ diff --git a/csharp/Yoga/Yoga.vcxproj b/csharp/Yoga/Yoga.vcxproj deleted file mode 100755 index 974919de7c..0000000000 --- a/csharp/Yoga/Yoga.vcxproj +++ /dev/null @@ -1,289 +0,0 @@ - - - - - Debug - ARM - - - Debug - Win32 - - - Release - ARM - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {0446C86B-F47B-4C46-B673-C7AE0CFF35D5} - Win32Proj - yoga - Yoga - 8.1 - true - - - - StaticLibrary - true - v141 - Unicode - - - DynamicLibrary - true - v141 - Unicode - - - StaticLibrary - false - v141 - true - Unicode - - - DynamicLibrary - false - v141 - true - Unicode - - - StaticLibrary - true - v141 - Unicode - - - StaticLibrary - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - true - bin\$(PlatformTarget)\$(Configuration)\ - obj\$(PlatformTarget)\$(Configuration)\ - - - true - bin\$(PlatformTarget)\$(Configuration)\ - obj\$(PlatformTarget)\$(Configuration)\ - - - true - bin\$(PlatformTarget)\$(Configuration)\ - obj\$(PlatformTarget)\$(Configuration)\ - - - false - bin\$(PlatformTarget)\$(Configuration)\ - obj\$(PlatformTarget)\$(Configuration)\ - - - false - bin\$(PlatformTarget)\$(Configuration)\ - obj\$(PlatformTarget)\$(Configuration)\ - - - false - bin\$(PlatformTarget)\$(Configuration)\ - obj\$(PlatformTarget)\$(Configuration)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions) - true - $(ProjectDir)..\..\;%(AdditionalIncludeDirectories) - - - Windows - true - - - - - - - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions) - true - $(ProjectDir)..\..\;%(AdditionalIncludeDirectories) - - - Windows - true - - - - - NotUsing - Level3 - Disabled - _DEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions) - true - $(ProjectDir)..\..\;%(AdditionalIncludeDirectories) - - - Windows - true - - - - - Level3 - NotUsing - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions) - true - $(ProjectDir)..\..\;%(AdditionalIncludeDirectories) - - - Windows - true - true - true - - - - - Level3 - NotUsing - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions) - true - $(ProjectDir)..\..\;%(AdditionalIncludeDirectories) - - - Windows - true - true - true - - - - - Level3 - NotUsing - MaxSpeed - true - true - NDEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions) - true - $(ProjectDir)..\..\;%(AdditionalIncludeDirectories) - - - Windows - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - false - - - - - false - - - false - false - - - - - false - - - - - - - - - - - - \ No newline at end of file diff --git a/csharp/Yoga/Yoga.vcxproj.filters b/csharp/Yoga/Yoga.vcxproj.filters deleted file mode 100755 index c03f853a56..0000000000 --- a/csharp/Yoga/Yoga.vcxproj.filters +++ /dev/null @@ -1,119 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/csharp/Yoga/dllmain.cpp b/csharp/Yoga/dllmain.cpp deleted file mode 100644 index c8b660f5e0..0000000000 --- a/csharp/Yoga/dllmain.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// dllmain.cpp : Defines the entry point for the DLL application. -#include "stdafx.h" - -BOOL APIENTRY -DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { - switch (ul_reason_for_call) { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} diff --git a/csharp/Yoga/resource.h b/csharp/Yoga/resource.h deleted file mode 100644 index dd683b8427..0000000000 --- a/csharp/Yoga/resource.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by Yoga.rc - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/csharp/Yoga/stdafx.cpp b/csharp/Yoga/stdafx.cpp deleted file mode 100644 index 062de5005e..0000000000 --- a/csharp/Yoga/stdafx.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// stdafx.cpp : source file that includes just the standard includes -// Yoga.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/csharp/Yoga/stdafx.h b/csharp/Yoga/stdafx.h deleted file mode 100644 index bf5e44b069..0000000000 --- a/csharp/Yoga/stdafx.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#include "targetver.h" - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include - -// TODO: reference additional headers your program requires here diff --git a/csharp/Yoga/targetver.h b/csharp/Yoga/targetver.h deleted file mode 100644 index b1d43f4d33..0000000000 --- a/csharp/Yoga/targetver.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, -// include WinSDKVer.h and set the _WIN32_WINNT macro to the platform you wish -// to support before including SDKDDKVer.h. - -#include diff --git a/csharp/build-native.sh b/csharp/build-native.sh deleted file mode 100755 index 61a146983d..0000000000 --- a/csharp/build-native.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -cd `dirname "$0"` -echo $ANDROID_SDK -BUCK_RELEASE=2018.02.16.01 -echo "buck $BUCK_RELEASE" -BUCK=lib/buck-$BUCK_RELEASE/bin/buck -if $BUCK --version >/dev/null 2>&1; then true; else - echo "Building Buck!" - BUCK_PATH=buck-$BUCK_RELEASE - mkdir -p lib - cd lib - rm -f $BUCK_PATH.tar.gz - curl -O -J -L https://github.com/facebook/buck/archive/v$BUCK_RELEASE.tar.gz - tar xzf $BUCK_PATH.tar.gz - cd $BUCK_PATH - ant - cd ../.. -fi - -$BUCK build \ - //csharp:yoganet-ios \ - //csharp:yoganet-macosx \ - //csharp:yoganet#android-armv7,shared \ - //csharp:yoganet#android-x86,shared diff --git a/csharp/iOS/.gitignore b/csharp/iOS/.gitignore deleted file mode 100644 index a5b96ed6b6..0000000000 --- a/csharp/iOS/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -libyoga.a -*.userprefs diff --git a/csharp/iOS/Facebook.Yoga.iOS.Tests/Entitlements.plist b/csharp/iOS/Facebook.Yoga.iOS.Tests/Entitlements.plist deleted file mode 100644 index 9ae599370b..0000000000 --- a/csharp/iOS/Facebook.Yoga.iOS.Tests/Entitlements.plist +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/csharp/iOS/Facebook.Yoga.iOS.Tests/Facebook.Yoga.iOS.Tests.csproj b/csharp/iOS/Facebook.Yoga.iOS.Tests/Facebook.Yoga.iOS.Tests.csproj deleted file mode 100644 index 697a7be8dc..0000000000 --- a/csharp/iOS/Facebook.Yoga.iOS.Tests/Facebook.Yoga.iOS.Tests.csproj +++ /dev/null @@ -1,114 +0,0 @@ - - - - Debug - iPhoneSimulator - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - Facebook.Yoga.iOS.Tests - Facebook.Yoga.iOS.Tests - Resources - - - true - full - false - bin\iPhoneSimulator\Debug - DEBUG; - prompt - 4 - iPhone Developer - true - true - true - true - true - 28871 - None - x86_64 - HttpClientHandler - Default - false - - - pdbonly - true - bin\iPhone\Release - - prompt - 4 - iPhone Developer - true - true - true - Entitlements.plist - SdkOnly - ARMv7, ARM64 - HttpClientHandler - Default - - - pdbonly - true - bin\iPhoneSimulator\Release - - prompt - 4 - iPhone Developer - true - true - None - x86_64 - HttpClientHandler - Default - - - true - full - false - bin\iPhone\Debug - DEBUG; - prompt - 4 - iPhone Developer - true - true - true - true - true - true - true - Entitlements.plist - SdkOnly - ARMv7, ARM64 - HttpClientHandler - Default - - - - - - - - - - - - - - - - - - - - - - {128FB32A-C4A1-4363-BF06-0A36E700B7FA} - Facebook.Yoga.iOS - - - - - \ No newline at end of file diff --git a/csharp/iOS/Facebook.Yoga.iOS.Tests/Info.plist b/csharp/iOS/Facebook.Yoga.iOS.Tests/Info.plist deleted file mode 100644 index 18ec83675f..0000000000 --- a/csharp/iOS/Facebook.Yoga.iOS.Tests/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleName - Facebook.Yoga.iOS.Tests - CFBundleIdentifier - com.xamarin.facebook-yoga-ios-tests - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1.0 - LSRequiresIPhoneOS - - MinimumOSVersion - 9.0 - UIDeviceFamily - - 1 - 2 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UILaunchStoryboardName - LaunchScreen - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - - diff --git a/csharp/iOS/Facebook.Yoga.iOS.Tests/LaunchScreen.storyboard b/csharp/iOS/Facebook.Yoga.iOS.Tests/LaunchScreen.storyboard deleted file mode 100644 index 5d2e905aa8..0000000000 --- a/csharp/iOS/Facebook.Yoga.iOS.Tests/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/csharp/iOS/Facebook.Yoga.iOS.Tests/Main.cs b/csharp/iOS/Facebook.Yoga.iOS.Tests/Main.cs deleted file mode 100644 index f46d9d7081..0000000000 --- a/csharp/iOS/Facebook.Yoga.iOS.Tests/Main.cs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Linq; -using System.Collections.Generic; - -using Foundation; -using UIKit; - -namespace Facebook.Yoga.iOS.Tests -{ - public class Application - { - // This is the main entry point of the application. - static void Main(string[] args) - { - // if you want to use a different Application Delegate class from "UnitTestAppDelegate" - // you can specify it here. - UIApplication.Main(args, null, "UnitTestAppDelegate"); - } - } -} diff --git a/csharp/iOS/Facebook.Yoga.iOS.Tests/UnitTestAppDelegate.cs b/csharp/iOS/Facebook.Yoga.iOS.Tests/UnitTestAppDelegate.cs deleted file mode 100644 index 50df8d1115..0000000000 --- a/csharp/iOS/Facebook.Yoga.iOS.Tests/UnitTestAppDelegate.cs +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Linq; -using System.Collections.Generic; - -using Foundation; -using UIKit; -using MonoTouch.NUnit.UI; - -namespace Facebook.Yoga.iOS.Tests -{ - // The UIApplicationDelegate for the application. This class is responsible for launching the - // User Interface of the application, as well as listening (and optionally responding) to - // application events from iOS. - [Register("UnitTestAppDelegate")] - public partial class UnitTestAppDelegate : UIApplicationDelegate - { - // class-level declarations - UIWindow window; - TouchRunner runner; - - // - // This method is invoked when the application has loaded and is ready to run. In this - // method you should instantiate the window, load the UI into it and then make the window - // visible. - // - // You have 17 seconds to return from this method, or iOS will terminate your application. - // - public override bool FinishedLaunching(UIApplication app, NSDictionary options) - { - // create a new window instance based on the screen size - window = new UIWindow(UIScreen.MainScreen.Bounds); - runner = new TouchRunner(window); - - // register every tests included in the main application/assembly - runner.Add(System.Reflection.Assembly.GetExecutingAssembly()); - - window.RootViewController = new UINavigationController(runner.GetViewController()); - - // make the window visible - window.MakeKeyAndVisible(); - - return true; - } - } -} diff --git a/csharp/iOS/Facebook.Yoga.iOS.sln b/csharp/iOS/Facebook.Yoga.iOS.sln deleted file mode 100644 index a58ae0b4f5..0000000000 --- a/csharp/iOS/Facebook.Yoga.iOS.sln +++ /dev/null @@ -1,81 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS", "Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj", "{128FB32A-C4A1-4363-BF06-0A36E700B7FA}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{89A39C6B-6A7B-4458-872B-A0456550CAA6}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS.Tests", "Facebook.Yoga.iOS.Tests\Facebook.Yoga.iOS.Tests.csproj", "{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared.Tests", "..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.shproj", "{4EDC82D9-A201-4831-8FE0-98F468F8E4AE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Release|iPhone = Release|iPhone - Release|iPhoneSimulator = Release|iPhoneSimulator - Debug|iPhone = Debug|iPhone - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.Build.0 = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.ActiveCfg = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.Build.0 = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.Build.0 = Debug|Any CPU - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|Any CPU.ActiveCfg = Release|iPhone - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|Any CPU.Build.0 = Release|iPhone - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhone.ActiveCfg = Release|iPhone - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhone.Build.0 = Release|iPhone - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhone.ActiveCfg = Debug|iPhone - {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhone.Build.0 = Debug|iPhone - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {91C42D32-291D-4B72-90B4-551663D60B8B} = {89A39C6B-6A7B-4458-872B-A0456550CAA6} - {4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {89A39C6B-6A7B-4458-872B-A0456550CAA6} - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - Policies = $0 - $0.TextStylePolicy = $1 - $1.inheritsSet = VisualStudio - $1.inheritsScope = text/plain - $1.scope = text/x-csharp - $0.CSharpFormattingPolicy = $2 - $2.IndentSwitchSection = True - $2.NewLinesForBracesInProperties = True - $2.NewLinesForBracesInAccessors = True - $2.NewLinesForBracesInAnonymousMethods = True - $2.NewLinesForBracesInControlBlocks = True - $2.NewLinesForBracesInAnonymousTypes = True - $2.NewLinesForBracesInObjectCollectionArrayInitializers = True - $2.NewLinesForBracesInLambdaExpressionBody = True - $2.NewLineForElse = True - $2.NewLineForCatch = True - $2.NewLineForFinally = True - $2.NewLineForMembersInObjectInit = True - $2.NewLineForMembersInAnonymousTypes = True - $2.NewLineForClausesInQuery = True - $2.SpacingAfterMethodDeclarationName = False - $2.SpaceAfterMethodCallName = False - $2.SpaceBeforeOpenSquareBracket = False - $2.inheritsSet = Mono - $2.inheritsScope = text/x-csharp - $2.scope = text/x-csharp - EndGlobalSection -EndGlobal diff --git a/csharp/iOS/Facebook.Yoga.iOS/ApiDefinition.cs b/csharp/iOS/Facebook.Yoga.iOS/ApiDefinition.cs deleted file mode 100644 index a832e827ae..0000000000 --- a/csharp/iOS/Facebook.Yoga.iOS/ApiDefinition.cs +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; - -using UIKit; -using Foundation; -using ObjCRuntime; -using CoreGraphics; - -namespace Facebook.Yoga.iOS -{ - //this is needed -} diff --git a/csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets b/csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets deleted file mode 100644 index bce91a45c5..0000000000 --- a/csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets +++ /dev/null @@ -1,10 +0,0 @@ - - - - NativeLibrary;$(CompileDependsOn) - - - - - - diff --git a/csharp/iOS/Facebook.Yoga.iOS/Facebook.Yoga.iOS.csproj b/csharp/iOS/Facebook.Yoga.iOS/Facebook.Yoga.iOS.csproj deleted file mode 100644 index a244314958..0000000000 --- a/csharp/iOS/Facebook.Yoga.iOS/Facebook.Yoga.iOS.csproj +++ /dev/null @@ -1,50 +0,0 @@ - - - - Debug - AnyCPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA} - {8FFB629D-F513-41CE-95D2-7ECE97B6EEEC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - Facebook.Yoga.iOS - Facebook.Yoga - Resources - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - true - - - true - bin\Release - prompt - 4 - true - - - - - - - - - - - - - - - Static - False - - - - - - diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Sample/AppDelegate.cs b/csharp/iOS/Facebook.YogaKit.iOS.Sample/AppDelegate.cs deleted file mode 100644 index 127c109fd7..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Sample/AppDelegate.cs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using Foundation; -using UIKit; - -namespace Facebook.YogaKit.iOS.Sample -{ - [Register("AppDelegate")] - public class AppDelegate : UIApplicationDelegate - { - public override UIWindow Window - { - get; - set; - } - - public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) - { - return true; - } - - - } -} - diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/csharp/iOS/Facebook.YogaKit.iOS.Sample/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 4e646784cb..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Sample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,157 +0,0 @@ -{ - "images": [ - { - "idiom": "iphone", - "size": "29x29", - "scale": "1x" - }, - { - "idiom": "iphone", - "size": "29x29", - "scale": "2x" - }, - { - "idiom": "iphone", - "size": "29x29", - "scale": "3x" - }, - { - "idiom": "iphone", - "size": "40x40", - "scale": "2x" - }, - { - "idiom": "iphone", - "size": "40x40", - "scale": "3x" - }, - { - "idiom": "iphone", - "size": "57x57", - "scale": "1x" - }, - { - "idiom": "iphone", - "size": "57x57", - "scale": "2x" - }, - { - "idiom": "iphone", - "size": "60x60", - "scale": "2x" - }, - { - "idiom": "iphone", - "size": "60x60", - "scale": "3x" - }, - { - "idiom": "ipad", - "size": "29x29", - "scale": "1x" - }, - { - "idiom": "ipad", - "size": "29x29", - "scale": "2x" - }, - { - "idiom": "ipad", - "size": "40x40", - "scale": "1x" - }, - { - "idiom": "ipad", - "size": "40x40", - "scale": "2x" - }, - { - "idiom": "ipad", - "size": "50x50", - "scale": "1x" - }, - { - "idiom": "ipad", - "size": "50x50", - "scale": "2x" - }, - { - "idiom": "ipad", - "size": "72x72", - "scale": "1x" - }, - { - "idiom": "ipad", - "size": "72x72", - "scale": "2x" - }, - { - "idiom": "ipad", - "size": "76x76", - "scale": "1x" - }, - { - "idiom": "ipad", - "size": "76x76", - "scale": "2x" - }, - { - "size": "24x24", - "idiom": "watch", - "scale": "2x", - "role": "notificationCenter", - "subtype": "38mm" - }, - { - "size": "27.5x27.5", - "idiom": "watch", - "scale": "2x", - "role": "notificationCenter", - "subtype": "42mm" - }, - { - "size": "29x29", - "idiom": "watch", - "role": "companionSettings", - "scale": "2x" - }, - { - "size": "29x29", - "idiom": "watch", - "role": "companionSettings", - "scale": "3x" - }, - { - "size": "40x40", - "idiom": "watch", - "scale": "2x", - "role": "appLauncher", - "subtype": "38mm" - }, - { - "size": "44x44", - "idiom": "watch", - "scale": "2x", - "role": "longLook", - "subtype": "42mm" - }, - { - "size": "86x86", - "idiom": "watch", - "scale": "2x", - "role": "quickLook", - "subtype": "38mm" - }, - { - "size": "98x98", - "idiom": "watch", - "scale": "2x", - "role": "quickLook", - "subtype": "42mm" - } - ], - "info": { - "version": 1, - "author": "xcode" - } -} \ No newline at end of file diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Sample/Assets.xcassets/Contents.json b/csharp/iOS/Facebook.YogaKit.iOS.Sample/Assets.xcassets/Contents.json deleted file mode 100644 index 4caf392f92..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Sample/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Sample/Entitlements.plist b/csharp/iOS/Facebook.YogaKit.iOS.Sample/Entitlements.plist deleted file mode 100644 index 9ae599370b..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Sample/Entitlements.plist +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Sample/Facebook.YogaKit.iOS.Sample.csproj b/csharp/iOS/Facebook.YogaKit.iOS.Sample/Facebook.YogaKit.iOS.Sample.csproj deleted file mode 100644 index d94eb93067..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Sample/Facebook.YogaKit.iOS.Sample.csproj +++ /dev/null @@ -1,128 +0,0 @@ - - - - Debug - iPhoneSimulator - {6A094B74-FA9A-4E49-A8E1-F450A04E3E5B} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - Facebook.YogaKit.iOS.Sample - Facebook.YogaKit.iOS.Sample - Resources - - - true - full - false - bin\iPhoneSimulator\Debug - DEBUG;ENABLE_TEST_CLOUD;__IOS__ - prompt - 4 - iPhone Developer - true - true - true - true - true - 56768 - None - x86_64 - HttpClientHandler - Default - false - - - pdbonly - true - bin\iPhone\Release - - prompt - 4 - iPhone Developer - true - true - true - Entitlements.plist - SdkOnly - ARMv7, ARM64 - HttpClientHandler - Default - - - - true - bin\iPhoneSimulator\Release - - prompt - 4 - iPhone Developer - true - true - None - x86_64 - HttpClientHandler - Default - - - true - full - false - bin\iPhone\Debug - DEBUG;ENABLE_TEST_CLOUD; - prompt - 4 - iPhone Developer - true - true - true - true - true - true - true - Entitlements.plist - SdkOnly - ARMv7, ARM64 - HttpClientHandler - Default - - - - - - - - - - - - - - - - - - - - - - - - - - - - ViewController.cs - - - - - {0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0} - Facebook.YogaKit.iOS - - - {128FB32A-C4A1-4363-BF06-0A36E700B7FA} - Facebook.Yoga.iOS - - - - \ No newline at end of file diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Sample/Info.plist b/csharp/iOS/Facebook.YogaKit.iOS.Sample/Info.plist deleted file mode 100644 index 0c6a791ef3..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Sample/Info.plist +++ /dev/null @@ -1,39 +0,0 @@ - - - - - CFBundleName - Facebook.YogaKit.iOS.Sample - CFBundleIdentifier - com.xamarin.facebook-yogakit-ios-sample - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1.0 - LSRequiresIPhoneOS - - MinimumOSVersion - 10.2 - UIDeviceFamily - - 1 - 2 - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - XSAppIconAssets - Assets.xcassets/AppIcon.appiconset - - diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Sample/LaunchScreen.storyboard b/csharp/iOS/Facebook.YogaKit.iOS.Sample/LaunchScreen.storyboard deleted file mode 100644 index 5d2e905aa8..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Sample/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Sample/Main.cs b/csharp/iOS/Facebook.YogaKit.iOS.Sample/Main.cs deleted file mode 100644 index 62d0b8d28b..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Sample/Main.cs +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using UIKit; - -namespace Facebook.YogaKit.iOS.Sample -{ - public class Application - { - static void Main(string[] args) - { - UIApplication.Main(args, null, "AppDelegate"); - } - } -} diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Sample/Main.storyboard b/csharp/iOS/Facebook.YogaKit.iOS.Sample/Main.storyboard deleted file mode 100644 index a43ad72cfb..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Sample/Main.storyboard +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Sample/ViewController.cs b/csharp/iOS/Facebook.YogaKit.iOS.Sample/ViewController.cs deleted file mode 100644 index 941ab4bec9..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Sample/ViewController.cs +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using CoreGraphics; -using Facebook.Yoga; -using UIKit; - -namespace Facebook.YogaKit.iOS.Sample -{ - public partial class ViewController : UIViewController - { - protected ViewController(IntPtr handle) : base(handle) - { - // Note: this .ctor should not contain any initialization logic. - } - - public override void ViewDidLoad() - { - base.ViewDidLoad(); - CreateViewHierarchy(View, View.Bounds.Size.Width, View.Bounds.Size.Height); - } - - static void CreateViewHierarchy(UIView root, nfloat width, nfloat height) - { - root.BackgroundColor = UIColor.Red; - root.Yoga().IsEnabled = true; - - root.Yoga().Width = (float)width; - root.Yoga().Height = (float)height; - root.Yoga().AlignItems = YogaAlign.Center; - root.Yoga().JustifyContent = YogaJustify.Center; - - var child1 = new UIView { BackgroundColor = UIColor.Blue }; - child1.Yoga().IsEnabled = true; - child1.Yoga().Width = 100; - child1.Yoga().Height = 100; - - var child2 = new UIView - { - BackgroundColor = UIColor.Green, - Frame = new CGRect { Size = new CGSize(200, 100) } - }; - - var child3 = new UIView - { - BackgroundColor = UIColor.Yellow, - Frame = new CGRect { Size = new CGSize(100, 100) } - }; - - child2.AddSubview(child3); - root.AddSubview(child1); - root.AddSubview(child2); - root.Yoga().ApplyLayout(); - } - } -} diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Sample/ViewController.designer.cs b/csharp/iOS/Facebook.YogaKit.iOS.Sample/ViewController.designer.cs deleted file mode 100644 index 554d18f553..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Sample/ViewController.designer.cs +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// -// This file has been generated automatically by MonoDevelop to store outlets and -// actions made in the Xcode designer. If it is removed, they will be lost. -// Manual changes to this file may not be handled correctly. -// -using Foundation; - -namespace Facebook.YogaKit.iOS.Sample -{ - [Register("ViewController")] - partial class ViewController - { - void ReleaseDesignerOutlets() - { - } - } -} diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Tests/Entitlements.plist b/csharp/iOS/Facebook.YogaKit.iOS.Tests/Entitlements.plist deleted file mode 100644 index 9ae599370b..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Tests/Entitlements.plist +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Tests/Facebook.YogaKit.iOS.Tests.csproj b/csharp/iOS/Facebook.YogaKit.iOS.Tests/Facebook.YogaKit.iOS.Tests.csproj deleted file mode 100644 index b85e8ce570..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Tests/Facebook.YogaKit.iOS.Tests.csproj +++ /dev/null @@ -1,111 +0,0 @@ - - - - Debug - iPhoneSimulator - {238DB3A2-1182-4775-92BC-F62C885725D8} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - Facebook.YogaKit.iOS.Tests - Facebook.YogaKit.iOS.Tests - Resources - - - true - full - false - bin\iPhoneSimulator\Debug - DEBUG; - prompt - 4 - iPhone Developer - true - true - true - 17481 - None - x86_64 - HttpClientHandler - Default - false - - - pdbonly - true - bin\iPhone\Release - - prompt - 4 - iPhone Developer - true - Entitlements.plist - SdkOnly - ARMv7, ARM64 - HttpClientHandler - Default - - - pdbonly - true - bin\iPhoneSimulator\Release - - prompt - 4 - iPhone Developer - None - x86_64 - HttpClientHandler - Default - - - true - full - false - bin\iPhone\Debug - DEBUG; - prompt - 4 - iPhone Developer - true - true - true - true - true - Entitlements.plist - SdkOnly - ARMv7, ARM64 - HttpClientHandler - Default - - - - - - - - - - - - - - - - - - - - - - - {0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0} - Facebook.YogaKit.iOS - - - {128FB32A-C4A1-4363-BF06-0A36E700B7FA} - Facebook.Yoga.iOS - - - - - \ No newline at end of file diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Tests/Info.plist b/csharp/iOS/Facebook.YogaKit.iOS.Tests/Info.plist deleted file mode 100644 index cf104fe2a5..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Tests/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleName - Facebook.YogaKit.iOS.Tests - CFBundleIdentifier - com.xamarin.facebook-yogakit-ios-tests - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1.0 - LSRequiresIPhoneOS - - MinimumOSVersion - 10.2 - UIDeviceFamily - - 1 - 2 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UILaunchStoryboardName - LaunchScreen - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - - diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Tests/LaunchScreen.storyboard b/csharp/iOS/Facebook.YogaKit.iOS.Tests/LaunchScreen.storyboard deleted file mode 100644 index 5d2e905aa8..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Tests/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Tests/Main.cs b/csharp/iOS/Facebook.YogaKit.iOS.Tests/Main.cs deleted file mode 100644 index 92b729de41..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Tests/Main.cs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Linq; -using System.Collections.Generic; - -using Foundation; -using UIKit; - -namespace Facebook.YogaKit.iOS.Tests -{ - public class Application - { - // This is the main entry point of the application. - static void Main(string[] args) - { - // if you want to use a different Application Delegate class from "UnitTestAppDelegate" - // you can specify it here. - UIApplication.Main(args, null, "UnitTestAppDelegate"); - } - } -} diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Tests/UnitTestAppDelegate.cs b/csharp/iOS/Facebook.YogaKit.iOS.Tests/UnitTestAppDelegate.cs deleted file mode 100644 index dfefa64ed9..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Tests/UnitTestAppDelegate.cs +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Linq; -using System.Collections.Generic; - -using Foundation; -using UIKit; -using MonoTouch.NUnit.UI; - -namespace Facebook.YogaKit.iOS.Tests -{ - // The UIApplicationDelegate for the application. This class is responsible for launching the - // User Interface of the application, as well as listening (and optionally responding) to - // application events from iOS. - [Register("UnitTestAppDelegate")] - public partial class UnitTestAppDelegate : UIApplicationDelegate - { - // class-level declarations - UIWindow window; - TouchRunner runner; - - // - // This method is invoked when the application has loaded and is ready to run. In this - // method you should instantiate the window, load the UI into it and then make the window - // visible. - // - // You have 17 seconds to return from this method, or iOS will terminate your application. - // - public override bool FinishedLaunching(UIApplication app, NSDictionary options) - { - // create a new window instance based on the screen size - window = new UIWindow(UIScreen.MainScreen.Bounds); - runner = new TouchRunner(window); - - // register every tests included in the main application/assembly - runner.Add(System.Reflection.Assembly.GetExecutingAssembly()); - - window.RootViewController = new UINavigationController(runner.GetViewController()); - - // make the window visible - window.MakeKeyAndVisible(); - - return true; - } - } -} diff --git a/csharp/iOS/Facebook.YogaKit.iOS.Tests/YogaKitNativeTest.cs b/csharp/iOS/Facebook.YogaKit.iOS.Tests/YogaKitNativeTest.cs deleted file mode 100644 index 4f7bf62646..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.Tests/YogaKitNativeTest.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System.Drawing; -using Facebook.Yoga; -using NUnit.Framework; -using System; -using UIKit; -using CoreGraphics; - -namespace Facebook.YogaKit.iOS.Tests -{ - [TestFixture] - public class YogaKitNativeTest - { - [Test] - public void ScrollViewVertical() - { - var view = new UIScrollView() { - Frame = new CGRect(0, 0, 100, 100), - }; - - view.Yoga().Overflow = YogaOverflow.Scroll; - var subview = new UIView(); - subview.Yoga().Height = 1000; - subview.Yoga().IsEnabled = true; - - view.AddSubview(subview); - view.Yoga().IsEnabled = true; - view.Yoga().ApplyLayout(); - Assert.True(view.ContentSize.Height == 1000); - } - - [Test] - public void NormalViewVertical() - { - var view = new UIView() { - Frame = new CGRect(0,0, 100, 100), - }; - - - var subview = new UIView(); - subview.Yoga().Height = 1000; - subview.Yoga().Width = 2; - subview.Yoga().IsEnabled = true; - - view.AddSubview(subview); - view.Yoga().IsEnabled = true; - view.Yoga().ApplyLayout(); - Assert.True(view.Bounds.Height == 100); - } - - } -} diff --git a/csharp/iOS/Facebook.YogaKit.iOS.sln b/csharp/iOS/Facebook.YogaKit.iOS.sln deleted file mode 100644 index 925ce4ba6c..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS.sln +++ /dev/null @@ -1,84 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{9FB621AA-66DD-46F1-8B10-94F508272A8D}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.YogaKit.Shared", "..\Facebook.YogaKit\Facebook.YogaKit.Shared.shproj", "{A24B3BA6-3143-4FFF-B8B8-1EDF166F5F4A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.YogaKit.iOS", "Facebook.YogaKit.iOS\Facebook.YogaKit.iOS.csproj", "{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.YogaKit.iOS.Sample", "Facebook.YogaKit.iOS.Sample\Facebook.YogaKit.iOS.Sample.csproj", "{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS", "Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj", "{128FB32A-C4A1-4363-BF06-0A36E700B7FA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.YogaKit.iOS.Tests", "Facebook.YogaKit.iOS.Tests\Facebook.YogaKit.iOS.Tests.csproj", "{238DB3A2-1182-4775-92BC-F62C885725D8}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.YogaKit.Shared.Tests", "..\tests\Facebook.YogaKit.Shared.Tests\Facebook.YogaKit.Shared.Tests.shproj", "{63AB08F4-4F7C-42B7-A20F-D84204D0D3CE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Release|iPhone = Release|iPhone - Release|iPhoneSimulator = Release|iPhoneSimulator - Debug|iPhone = Debug|iPhone - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|Any CPU.Build.0 = Release|Any CPU - {0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|iPhone.ActiveCfg = Release|Any CPU - {0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|iPhone.Build.0 = Release|Any CPU - {0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|iPhone.Build.0 = Debug|Any CPU - {6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|Any CPU.ActiveCfg = Release|iPhone - {6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|Any CPU.Build.0 = Release|iPhone - {6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|iPhone.ActiveCfg = Release|iPhone - {6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|iPhone.Build.0 = Release|iPhone - {6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|iPhone.ActiveCfg = Debug|iPhone - {6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|iPhone.Build.0 = Debug|iPhone - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.Build.0 = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.ActiveCfg = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.Build.0 = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.Build.0 = Debug|Any CPU - {238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {238DB3A2-1182-4775-92BC-F62C885725D8}.Release|Any CPU.ActiveCfg = Release|iPhone - {238DB3A2-1182-4775-92BC-F62C885725D8}.Release|Any CPU.Build.0 = Release|iPhone - {238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {238DB3A2-1182-4775-92BC-F62C885725D8}.Release|iPhone.ActiveCfg = Release|iPhone - {238DB3A2-1182-4775-92BC-F62C885725D8}.Release|iPhone.Build.0 = Release|iPhone - {238DB3A2-1182-4775-92BC-F62C885725D8}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {238DB3A2-1182-4775-92BC-F62C885725D8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|iPhone.ActiveCfg = Debug|iPhone - {238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|iPhone.Build.0 = Debug|iPhone - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {A24B3BA6-3143-4FFF-B8B8-1EDF166F5F4A} = {9FB621AA-66DD-46F1-8B10-94F508272A8D} - {91C42D32-291D-4B72-90B4-551663D60B8B} = {9FB621AA-66DD-46F1-8B10-94F508272A8D} - {63AB08F4-4F7C-42B7-A20F-D84204D0D3CE} = {9FB621AA-66DD-46F1-8B10-94F508272A8D} - EndGlobalSection -EndGlobal diff --git a/csharp/iOS/Facebook.YogaKit.iOS/Facebook.YogaKit.iOS.csproj b/csharp/iOS/Facebook.YogaKit.iOS/Facebook.YogaKit.iOS.csproj deleted file mode 100644 index 4ecb3283d3..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS/Facebook.YogaKit.iOS.csproj +++ /dev/null @@ -1,69 +0,0 @@ - - - - Debug - AnyCPU - {0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - Facebook.YogaKit.iOS - Facebook.YogaKit.iOS - Resources - - - true - full - false - bin\Debug - DEBUG;__IOS__ - prompt - 4 - iPhone Developer - true - true - true - true - true - 53781 - false - SdkOnly - HttpClientHandler - Default - - - pdbonly - true - bin\Release - - prompt - 4 - iPhone Developer - true - true - SdkOnly - HttpClientHandler - Default - - - - - - - - - - - - - - - - - - {128FB32A-C4A1-4363-BF06-0A36E700B7FA} - Facebook.Yoga.iOS - - - - - \ No newline at end of file diff --git a/csharp/iOS/Facebook.YogaKit.iOS/Properties/AssemblyInfo.cs b/csharp/iOS/Facebook.YogaKit.iOS/Properties/AssemblyInfo.cs deleted file mode 100644 index 6cada59aa7..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following attributes. -// Change them to the values specific to your project. - -[assembly: AssemblyTitle("Facebook.YogaKit.iOS")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("rmarinho")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". -// The form "{Major}.{Minor}.*" will automatically update the build and revision, -// and "{Major}.{Minor}.{Build}.*" will update just the revision. - -[assembly: AssemblyVersion("1.0.*")] - -// The following attributes are used to specify the signing key for the assembly, -// if desired. See the Mono documentation for more information about signing. - -//[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] diff --git a/csharp/iOS/Facebook.YogaKit.iOS/YogaKit.cs b/csharp/iOS/Facebook.YogaKit.iOS/YogaKit.cs deleted file mode 100644 index 2e8d694ec5..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS/YogaKit.cs +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using System.Runtime.InteropServices; -using Foundation; -using UIKit; - -namespace Facebook.YogaKit -{ - public static partial class YogaKit - { - static NSString YogaNodeKey = new NSString("YogaNode"); - - public static IYogaLayout Yoga(this UIView view) - { - return YogaLayoutNative(view); - } - - static IYogaLayout YogaLayoutNative(UIView view) - { - var yoga = ObjCRuntime.Runtime.GetNSObject(objc_getAssociatedObject(view.Handle, YogaNodeKey.Handle)) as YogaLayout; - if (yoga == null) - { - yoga = new YogaLayout(view); - objc_setAssociatedObject(view.Handle, YogaNodeKey.Handle, yoga.Handle, AssociationPolicy.RETAIN_NONATOMIC); - } - return yoga; - } - - [DllImport("/usr/lib/libobjc.dylib")] - static extern void objc_setAssociatedObject(IntPtr @object, IntPtr key, IntPtr value, AssociationPolicy policy); - - [DllImport("/usr/lib/libobjc.dylib")] - static extern IntPtr objc_getAssociatedObject(IntPtr @object, IntPtr key); - - enum AssociationPolicy - { - ASSIGN = 0, - RETAIN_NONATOMIC = 1, - COPY_NONATOMIC = 3, - RETAIN = 01401, - COPY = 01403, - } - } -} diff --git a/csharp/iOS/Facebook.YogaKit.iOS/YogaLayout.cs b/csharp/iOS/Facebook.YogaKit.iOS/YogaLayout.cs deleted file mode 100644 index 4362b540fa..0000000000 --- a/csharp/iOS/Facebook.YogaKit.iOS/YogaLayout.cs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System.Collections.Generic; -using CoreGraphics; -using Facebook.Yoga; -using Foundation; -using UIKit; - -namespace Facebook.YogaKit -{ - public partial class YogaLayout : NSObject - { - static IEnumerable GetChildren(UIView view) => view.Subviews; - - static void MeasureNativeView(UIView view, float constrainedWidth, float constrainedHeight, out float sizeThatFitsWidth, out float sizeThatFitsHeight) - { - var sizeThatFits = view.SizeThatFits(new CGSize(constrainedWidth, constrainedHeight)); - sizeThatFitsWidth = (float)sizeThatFits.Width; - sizeThatFitsHeight = (float)sizeThatFits.Height; - } - - static void GetWidthHeightOfNativeView(UIView view, out float width, out float height) - { - width = (float)view.Bounds.Width; - height = (float)view.Bounds.Height; - } - - static float NativePixelScale => (float)UIScreen.MainScreen.Scale; - - - static void ApplyLayoutToNativeView(UIView view, YogaNode node) - { - var topLeft = new CGPoint(node.LayoutX, node.LayoutY); - var bottomRight = new CGPoint(topLeft.X + node.LayoutWidth, topLeft.Y + node.LayoutHeight); - if (view is UIScrollView scrollView) - { - scrollView.ContentSize = new CGSize(RoundPointValue((float)bottomRight.X) - RoundPointValue((float)topLeft.X), RoundPointValue((float)bottomRight.Y) - RoundPointValue((float)topLeft.Y)); - } - else - { - view.Frame = new CGRect(RoundPointValue((float)topLeft.X), RoundPointValue((float)topLeft.Y), RoundPointValue((float)bottomRight.X) - RoundPointValue((float)topLeft.X), RoundPointValue((float)bottomRight.Y) - RoundPointValue((float)topLeft.Y)); - } - } - - bool _disposed; - protected override void Dispose(bool disposing) - { - if (disposing && !_disposed) - { - _disposed = true; - if (YogaKit.Bridges.ContainsKey(_node)) - { - YogaKit.Bridges.Remove(_node); - } - _node = null; - _viewRef = null; - } - base.Dispose(disposing); - } - } -} diff --git a/csharp/nuget/Facebook.Yoga.Native.Universal.targets b/csharp/nuget/Facebook.Yoga.Native.Universal.targets deleted file mode 100644 index 4da4410128..0000000000 --- a/csharp/nuget/Facebook.Yoga.Native.Universal.targets +++ /dev/null @@ -1,36 +0,0 @@ - - - - - x86\%(Filename)%(Extension) - PreserveNewest - False - - - x64\%(Filename)%(Extension) - PreserveNewest - False - - - - - %(Filename)%(Extension) - PreserveNewest - False - - - - - %(Filename)%(Extension) - PreserveNewest - False - - - - - %(Filename)%(Extension) - PreserveNewest - False - - - diff --git a/csharp/nuget/Facebook.Yoga.Native.nuspec b/csharp/nuget/Facebook.Yoga.Native.nuspec deleted file mode 100644 index 8078aeaa5b..0000000000 --- a/csharp/nuget/Facebook.Yoga.Native.nuspec +++ /dev/null @@ -1,50 +0,0 @@ - - - - Facebook.Yoga.Native - 1.0.1-pre - Facebook.Yoga.Native - Facebook - Facebook - https://github.com/facebook/css-layout/blob/master/LICENSE - https://github.com/facebook/css-layout - false - A subset of CSS's flexbox layout algorithm and box model. - Copyright 2016 Facebook - native flexbox flex-box css layout css-layout yoga facebook - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/csharp/nuget/Facebook.Yoga.Native.targets b/csharp/nuget/Facebook.Yoga.Native.targets deleted file mode 100644 index 3a2c768062..0000000000 --- a/csharp/nuget/Facebook.Yoga.Native.targets +++ /dev/null @@ -1,36 +0,0 @@ - - - - - x86\%(Filename)%(Extension) - PreserveNewest - False - - - x64\%(Filename)%(Extension) - PreserveNewest - False - - - - - %(Filename)%(Extension) - PreserveNewest - False - - - - - %(Filename)%(Extension) - PreserveNewest - False - - - - - %(Filename)%(Extension) - PreserveNewest - False - - - diff --git a/csharp/nuget/Facebook.Yoga.OSX.targets b/csharp/nuget/Facebook.Yoga.OSX.targets deleted file mode 100644 index f7db7f17e1..0000000000 --- a/csharp/nuget/Facebook.Yoga.OSX.targets +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - False - Dynamic - - - - \ No newline at end of file diff --git a/csharp/nuget/Facebook.Yoga.Universal.targets b/csharp/nuget/Facebook.Yoga.Universal.targets deleted file mode 100644 index ce4062bb09..0000000000 --- a/csharp/nuget/Facebook.Yoga.Universal.targets +++ /dev/null @@ -1,51 +0,0 @@ - - - - - x86\%(Filename)%(Extension) - PreserveNewest - False - - - x64\%(Filename)%(Extension) - PreserveNewest - False - - - - - %(Filename)%(Extension) - PreserveNewest - False - - - %(Filename)%(Extension) - PreserveNewest - False - - - - - %(Filename)%(Extension) - PreserveNewest - False - - - %(Filename)%(Extension) - PreserveNewest - False - - - - - %(Filename)%(Extension) - PreserveNewest - False - - - %(Filename)%(Extension) - PreserveNewest - False - - - \ No newline at end of file diff --git a/csharp/nuget/Facebook.Yoga.dll.config b/csharp/nuget/Facebook.Yoga.dll.config deleted file mode 100644 index eadca6ebae..0000000000 --- a/csharp/nuget/Facebook.Yoga.dll.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/csharp/nuget/Facebook.Yoga.nuspec b/csharp/nuget/Facebook.Yoga.nuspec deleted file mode 100644 index d3f1b71140..0000000000 --- a/csharp/nuget/Facebook.Yoga.nuspec +++ /dev/null @@ -1,85 +0,0 @@ - - - - Facebook.Yoga - 1.0.1-pre - Facebook.Yoga - Facebook - Facebook - https://github.com/facebook/css-layout/blob/master/LICENSE - https://github.com/facebook/css-layout - false - A subset of CSS's flexbox layout algorithm and box model. - Copyright 2016 Facebook - flexbox flex-box css layout css-layout yoga facebook native - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/csharp/nuget/Facebook.Yoga.targets b/csharp/nuget/Facebook.Yoga.targets deleted file mode 100644 index a3b9f35245..0000000000 --- a/csharp/nuget/Facebook.Yoga.targets +++ /dev/null @@ -1,61 +0,0 @@ - - - - - x86\%(Filename)%(Extension) - PreserveNewest - False - - - x64\%(Filename)%(Extension) - PreserveNewest - False - - - - - %(Filename)%(Extension) - PreserveNewest - False - - - %(Filename)%(Extension) - PreserveNewest - False - - - - - %(Filename)%(Extension) - PreserveNewest - False - - - %(Filename)%(Extension) - PreserveNewest - False - - - - - %(Filename)%(Extension) - PreserveNewest - False - - - %(Filename)%(Extension) - PreserveNewest - False - - - - - libyoga.dylib - Always - - - Facebook.Yoga.dll.config - Always - - - \ No newline at end of file diff --git a/csharp/nuget/_._ b/csharp/nuget/_._ deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/csharp/tests/Facebook.Yoga/Facebook.Yoga.Shared.Tests.projitems b/csharp/tests/Facebook.Yoga/Facebook.Yoga.Shared.Tests.projitems deleted file mode 100644 index 3bbfd97013..0000000000 --- a/csharp/tests/Facebook.Yoga/Facebook.Yoga.Shared.Tests.projitems +++ /dev/null @@ -1,29 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - 4edc82d9-a201-4831-8fe0-98f468f8e4ae - - - Facebook.Yoga.Shared.Tests - - - - - - - - - - - - - - - - - - - - diff --git a/csharp/tests/Facebook.Yoga/Facebook.Yoga.Shared.Tests.shproj b/csharp/tests/Facebook.Yoga/Facebook.Yoga.Shared.Tests.shproj deleted file mode 100644 index 75c61845f5..0000000000 --- a/csharp/tests/Facebook.Yoga/Facebook.Yoga.Shared.Tests.shproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - 4edc82d9-a201-4831-8fe0-98f468f8e4ae - 14.0 - - - - - - - - diff --git a/csharp/tests/Facebook.Yoga/YGAbsolutePositionTest.cs b/csharp/tests/Facebook.Yoga/YGAbsolutePositionTest.cs deleted file mode 100644 index 3470ef53c1..0000000000 --- a/csharp/tests/Facebook.Yoga/YGAbsolutePositionTest.cs +++ /dev/null @@ -1,1231 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGAbsolutePositionTest - { - [Test] - public void Test_absolute_layout_width_height_start_top() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Start = 10; - root_child0.Top = 10; - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_width_height_end_bottom() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.End = 10; - root_child0.Bottom = 10; - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(80f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(80f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_start_top_end_bottom() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Start = 10; - root_child0.Top = 10; - root_child0.End = 10; - root_child0.Bottom = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(80f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(80f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_width_height_start_top_end_bottom() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Start = 10; - root_child0.Top = 10; - root_child0.End = 10; - root_child0.Bottom = 10; - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Overflow = YogaOverflow.Hidden; - root.Width = 50; - root.Height = 50; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Start = 0; - root_child0.Top = 0; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.Width = 100; - root_child0_child0.Height = 100; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(50f, root.LayoutWidth); - Assert.AreEqual(50f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(50f, root.LayoutWidth); - Assert.AreEqual(50f, root.LayoutHeight); - - Assert.AreEqual(-50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_within_border() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.MarginLeft = 10; - root.MarginTop = 10; - root.MarginRight = 10; - root.MarginBottom = 10; - root.PaddingLeft = 10; - root.PaddingTop = 10; - root.PaddingRight = 10; - root.PaddingBottom = 10; - root.BorderLeftWidth = 10; - root.BorderTopWidth = 10; - root.BorderRightWidth = 10; - root.BorderBottomWidth = 10; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Left = 0; - root_child0.Top = 0; - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.PositionType = YogaPositionType.Absolute; - root_child1.Right = 0; - root_child1.Bottom = 0; - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.PositionType = YogaPositionType.Absolute; - root_child2.Left = 0; - root_child2.Top = 0; - root_child2.MarginLeft = 10; - root_child2.MarginTop = 10; - root_child2.MarginRight = 10; - root_child2.MarginBottom = 10; - root_child2.Width = 50; - root_child2.Height = 50; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.PositionType = YogaPositionType.Absolute; - root_child3.Right = 0; - root_child3.Bottom = 0; - root_child3.MarginLeft = 10; - root_child3.MarginTop = 10; - root_child3.MarginRight = 10; - root_child3.MarginBottom = 10; - root_child3.Width = 50; - root_child3.Height = 50; - root.Insert(3, root_child3); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(10f, root.LayoutX); - Assert.AreEqual(10f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(20f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - Assert.AreEqual(30f, root_child3.LayoutX); - Assert.AreEqual(30f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(50f, root_child3.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(10f, root.LayoutX); - Assert.AreEqual(10f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(20f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - Assert.AreEqual(30f, root_child3.LayoutX); - Assert.AreEqual(30f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(50f, root_child3.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_align_items_and_justify_content_center() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.AlignItems = YogaAlign.Center; - root.FlexGrow = 1; - root.Width = 110; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Width = 60; - root_child0.Height = 40; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(25f, root_child0.LayoutX); - Assert.AreEqual(30f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(25f, root_child0.LayoutX); - Assert.AreEqual(30f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_align_items_and_justify_content_flex_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.FlexEnd; - root.AlignItems = YogaAlign.FlexEnd; - root.FlexGrow = 1; - root.Width = 110; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Width = 60; - root_child0.Height = 40; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(60f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(60f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_justify_content_center() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.FlexGrow = 1; - root.Width = 110; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Width = 60; - root_child0.Height = 40; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(30f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(30f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_align_items_center() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Center; - root.FlexGrow = 1; - root.Width = 110; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Width = 60; - root_child0.Height = 40; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(25f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(25f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_align_items_center_on_child_only() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexGrow = 1; - root.Width = 110; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.AlignSelf = YogaAlign.Center; - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Width = 60; - root_child0.Height = 40; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(25f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(25f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_align_items_and_justify_content_center_and_top_position() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.AlignItems = YogaAlign.Center; - root.FlexGrow = 1; - root.Width = 110; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Top = 10; - root_child0.Width = 60; - root_child0.Height = 40; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(25f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(25f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_align_items_and_justify_content_center_and_bottom_position() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.AlignItems = YogaAlign.Center; - root.FlexGrow = 1; - root.Width = 110; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Bottom = 10; - root_child0.Width = 60; - root_child0.Height = 40; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(25f, root_child0.LayoutX); - Assert.AreEqual(50f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(25f, root_child0.LayoutX); - Assert.AreEqual(50f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_align_items_and_justify_content_center_and_left_position() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.AlignItems = YogaAlign.Center; - root.FlexGrow = 1; - root.Width = 110; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Left = 5; - root_child0.Width = 60; - root_child0.Height = 40; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(5f, root_child0.LayoutX); - Assert.AreEqual(30f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(5f, root_child0.LayoutX); - Assert.AreEqual(30f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_align_items_and_justify_content_center_and_right_position() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.AlignItems = YogaAlign.Center; - root.FlexGrow = 1; - root.Width = 110; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Right = 5; - root_child0.Width = 60; - root_child0.Height = 40; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(45f, root_child0.LayoutX); - Assert.AreEqual(30f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(110f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(45f, root_child0.LayoutX); - Assert.AreEqual(30f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - } - - [Test] - public void Test_position_root_with_rtl_should_position_withoutdirection() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Left = 72; - root.Width = 52; - root.Height = 52; - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(72f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(72f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_percentage_bottom_based_on_parent_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Top = 50.Percent(); - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.PositionType = YogaPositionType.Absolute; - root_child1.Bottom = 50.Percent(); - root_child1.Width = 10; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.PositionType = YogaPositionType.Absolute; - root_child2.Top = 10.Percent(); - root_child2.Bottom = 10.Percent(); - root_child2.Width = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(100f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(90f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(160f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(90f, root_child0.LayoutX); - Assert.AreEqual(100f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(90f, root_child1.LayoutX); - Assert.AreEqual(90f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(90f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(160f, root_child2.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_in_wrap_reverse_column_container() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Wrap = YogaWrap.WrapReverse; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Width = 20; - root_child0.Height = 20; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_in_wrap_reverse_row_container() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Wrap = YogaWrap.WrapReverse; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Width = 20; - root_child0.Height = 20; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(80f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(80f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_in_wrap_reverse_column_container_flex_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Wrap = YogaWrap.WrapReverse; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.AlignSelf = YogaAlign.FlexEnd; - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Width = 20; - root_child0.Height = 20; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_in_wrap_reverse_row_container_flex_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Wrap = YogaWrap.WrapReverse; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.AlignSelf = YogaAlign.FlexEnd; - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Width = 20; - root_child0.Height = 20; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - } - - [Test] - public void Test_percent_absolute_position_infinite_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 300; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 300; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.PositionType = YogaPositionType.Absolute; - root_child1.Left = 20.Percent(); - root_child1.Top = 20.Percent(); - root_child1.Width = 20.Percent(); - root_child1.Height = 20.Percent(); - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(300f, root.LayoutWidth); - Assert.AreEqual(0f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(300f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(60f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(60f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(300f, root.LayoutWidth); - Assert.AreEqual(0f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(300f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(60f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(60f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_percentage_height_based_on_padded_parent() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.PaddingTop = 10; - root.BorderTopWidth = 10; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Width = 100; - root_child0.Height = 50.Percent(); - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - } - - [Test] - public void Test_absolute_layout_percentage_height_based_on_padded_parent_and_align_items_center() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.AlignItems = YogaAlign.Center; - root.PaddingTop = 20; - root.PaddingBottom = 20; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Width = 100; - root_child0.Height = 50.Percent(); - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(25f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(25f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGAlignBaselineTest.cs b/csharp/tests/Facebook.Yoga/YGAlignBaselineTest.cs deleted file mode 100644 index e747625fbf..0000000000 --- a/csharp/tests/Facebook.Yoga/YGAlignBaselineTest.cs +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGAlignBaselineTest - { - [Test] - public void Test_align_baseline_parent_using_child_in_column_as_reference() - { - YogaConfig config = new YogaConfig(); - YogaNode root = createYGNode(config, YogaFlexDirection.Row, 1000, 1000, true); - - YogaNode root_child0 = createYGNode(config, YogaFlexDirection.Column, 500, 600, false); - root.Insert(0, root_child0); - - YogaNode root_child1 = createYGNode(config, YogaFlexDirection.Column, 500, 800, false); - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = createYGNode(config, YogaFlexDirection.Column, 500, 300, false); - root_child1.Insert(0, root_child1_child0); - - YogaNode root_child1_child1 = createYGNode(config, YogaFlexDirection.Column, 500, 400, false); - root_child1_child1.SetBaselineFunction((_, width, height) => { - return height / 2; - }); - root_child1_child1.IsReferenceBaseline = true; - root_child1.Insert(1, root_child1_child1); - - root.CalculateLayout(); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - - Assert.AreEqual(500f, root_child1.LayoutX); - Assert.AreEqual(100f, root_child1.LayoutY); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - - Assert.AreEqual(0f, root_child1_child1.LayoutX); - Assert.AreEqual(300f, root_child1_child1.LayoutY); - } - - [Test] - public void Test_align_baseline_parent_using_child_in_row_as_reference() - { - YogaConfig config = new YogaConfig(); - - YogaNode root = createYGNode(config, YogaFlexDirection.Row, 1000, 1000, true); - - YogaNode root_child0 = createYGNode(config, YogaFlexDirection.Column, 500, 600, false); - root.Insert(0, root_child0); - - YogaNode root_child1 = createYGNode(config, YogaFlexDirection.Row, 500, 800, true); - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = createYGNode(config, YogaFlexDirection.Row, 500, 500, false); - root_child1.Insert(0, root_child1_child0); - - YogaNode root_child1_child1 = createYGNode(config, YogaFlexDirection.Row, 500, 400, false); - root_child1_child1.SetBaselineFunction((_, width, height) => { - return height / 2; - }); - root_child1_child1.IsReferenceBaseline = true; - root_child1.Insert(1, root_child1_child1); - - root.StyleDirection = YogaDirection.LTR; - - root.CalculateLayout(); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - - Assert.AreEqual(500f, root_child1.LayoutX); - Assert.AreEqual(100f, root_child1.LayoutY); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - - Assert.AreEqual(500f, root_child1_child1.LayoutX); - Assert.AreEqual(300f, root_child1_child1.LayoutY); - } - - private YogaNode createYGNode(YogaConfig config, YogaFlexDirection flexDirection, int width, int height, bool alignBaseline) { - YogaNode node = new YogaNode(config); - node.FlexDirection = flexDirection; - node.Width = width; - node.Height = height; - if (alignBaseline) { - node.AlignItems = YogaAlign.Baseline; - } - return node; - } - } -} diff --git a/csharp/tests/Facebook.Yoga/YGAlignContentTest.cs b/csharp/tests/Facebook.Yoga/YGAlignContentTest.cs deleted file mode 100644 index 56c88a43ac..0000000000 --- a/csharp/tests/Facebook.Yoga/YGAlignContentTest.cs +++ /dev/null @@ -1,1924 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGAlignContentTest - { - [Test] - public void Test_align_content_flex_start() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Wrap = YogaWrap.Wrap; - root.Width = 130; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root_child2.Height = 10; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 50; - root_child3.Height = 10; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root_child4.Height = 10; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(130f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(10f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - Assert.AreEqual(50f, root_child3.LayoutX); - Assert.AreEqual(10f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(10f, root_child3.LayoutHeight); - - Assert.AreEqual(0f, root_child4.LayoutX); - Assert.AreEqual(20f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(10f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(130f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(80f, root_child2.LayoutX); - Assert.AreEqual(10f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - Assert.AreEqual(30f, root_child3.LayoutX); - Assert.AreEqual(10f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(10f, root_child3.LayoutHeight); - - Assert.AreEqual(80f, root_child4.LayoutX); - Assert.AreEqual(20f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(10f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_flex_start_without_height_on_children() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 50; - root_child3.Height = 10; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(10f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(0f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(10f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(10f, root_child3.LayoutHeight); - - Assert.AreEqual(0f, root_child4.LayoutX); - Assert.AreEqual(20f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(0f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(50f, root_child2.LayoutX); - Assert.AreEqual(10f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(0f, root_child2.LayoutHeight); - - Assert.AreEqual(50f, root_child3.LayoutX); - Assert.AreEqual(10f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(10f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(20f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(0f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_flex_start_with_flex() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 120; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 0.Percent(); - root_child0.Width = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.FlexBasis = 0.Percent(); - root_child1.Width = 50; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.FlexGrow = 1; - root_child3.FlexShrink = 1; - root_child3.FlexBasis = 0.Percent(); - root_child3.Width = 50; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(120f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(40f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(80f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(0f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(80f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(40f, root_child3.LayoutHeight); - - Assert.AreEqual(0f, root_child4.LayoutX); - Assert.AreEqual(120f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(0f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(120f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(40f, root_child1.LayoutHeight); - - Assert.AreEqual(50f, root_child2.LayoutX); - Assert.AreEqual(80f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(0f, root_child2.LayoutHeight); - - Assert.AreEqual(50f, root_child3.LayoutX); - Assert.AreEqual(80f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(40f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(120f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(0f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_flex_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignContent = YogaAlign.FlexEnd; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root_child2.Height = 10; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 50; - root_child3.Height = 10; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root_child4.Height = 10; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(50f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - Assert.AreEqual(50f, root_child3.LayoutX); - Assert.AreEqual(30f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(10f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(40f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(10f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(30f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(10f, root_child3.LayoutHeight); - - Assert.AreEqual(0f, root_child4.LayoutX); - Assert.AreEqual(40f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(10f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_stretch() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignContent = YogaAlign.Stretch; - root.Wrap = YogaWrap.Wrap; - root.Width = 150; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 50; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(0f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(0f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(0f, root_child3.LayoutHeight); - - Assert.AreEqual(0f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(0f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(100f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - Assert.AreEqual(100f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(0f, root_child2.LayoutHeight); - - Assert.AreEqual(100f, root_child3.LayoutX); - Assert.AreEqual(0f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(0f, root_child3.LayoutHeight); - - Assert.AreEqual(100f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(0f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_spacebetween() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.SpaceBetween; - root.Wrap = YogaWrap.Wrap; - root.Width = 130; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root_child2.Height = 10; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 50; - root_child3.Height = 10; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root_child4.Height = 10; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(130f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(45f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - Assert.AreEqual(50f, root_child3.LayoutX); - Assert.AreEqual(45f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(10f, root_child3.LayoutHeight); - - Assert.AreEqual(0f, root_child4.LayoutX); - Assert.AreEqual(90f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(10f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(130f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(80f, root_child2.LayoutX); - Assert.AreEqual(45f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - Assert.AreEqual(30f, root_child3.LayoutX); - Assert.AreEqual(45f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(10f, root_child3.LayoutHeight); - - Assert.AreEqual(80f, root_child4.LayoutX); - Assert.AreEqual(90f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(10f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_spacearound() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.SpaceAround; - root.Wrap = YogaWrap.Wrap; - root.Width = 140; - root.Height = 120; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root_child2.Height = 10; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 50; - root_child3.Height = 10; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root_child4.Height = 10; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(140f, root.LayoutWidth); - Assert.AreEqual(120f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(15f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(15f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(55f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - Assert.AreEqual(50f, root_child3.LayoutX); - Assert.AreEqual(55f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(10f, root_child3.LayoutHeight); - - Assert.AreEqual(0f, root_child4.LayoutX); - Assert.AreEqual(95f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(10f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(140f, root.LayoutWidth); - Assert.AreEqual(120f, root.LayoutHeight); - - Assert.AreEqual(90f, root_child0.LayoutX); - Assert.AreEqual(15f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(15f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(90f, root_child2.LayoutX); - Assert.AreEqual(55f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - Assert.AreEqual(40f, root_child3.LayoutX); - Assert.AreEqual(55f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(10f, root_child3.LayoutHeight); - - Assert.AreEqual(90f, root_child4.LayoutX); - Assert.AreEqual(95f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(10f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_stretch_row() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.Stretch; - root.Wrap = YogaWrap.Wrap; - root.Width = 150; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 50; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(100f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(50f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(50f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(50f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - Assert.AreEqual(100f, root_child3.LayoutX); - Assert.AreEqual(50f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(50f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(50f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_stretch_row_with_children() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.Stretch; - root.Wrap = YogaWrap.Wrap; - root.Width = 150; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexGrow = 1; - root_child0_child0.FlexShrink = 1; - root_child0_child0.FlexBasis = 0.Percent(); - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 50; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(50f, root_child0_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(100f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(50f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(50f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(50f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(50f, root_child0_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - Assert.AreEqual(100f, root_child3.LayoutX); - Assert.AreEqual(50f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(50f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(50f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_stretch_row_with_flex() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.Stretch; - root.Wrap = YogaWrap.Wrap; - root.Width = 150; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.FlexShrink = 1; - root_child1.FlexBasis = 0.Percent(); - root_child1.Width = 50; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.FlexGrow = 1; - root_child3.FlexShrink = 1; - root_child3.FlexBasis = 0.Percent(); - root_child3.Width = 50; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(50f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - Assert.AreEqual(100f, root_child3.LayoutX); - Assert.AreEqual(0f, root_child3.LayoutY); - Assert.AreEqual(0f, root_child3.LayoutWidth); - Assert.AreEqual(100f, root_child3.LayoutHeight); - - Assert.AreEqual(100f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(100f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(100f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(50f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - Assert.AreEqual(50f, root_child3.LayoutX); - Assert.AreEqual(0f, root_child3.LayoutY); - Assert.AreEqual(0f, root_child3.LayoutWidth); - Assert.AreEqual(100f, root_child3.LayoutHeight); - - Assert.AreEqual(0f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(100f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_stretch_row_with_flex_no_shrink() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.Stretch; - root.Wrap = YogaWrap.Wrap; - root.Width = 150; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.FlexShrink = 1; - root_child1.FlexBasis = 0.Percent(); - root_child1.Width = 50; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.FlexGrow = 1; - root_child3.FlexBasis = 0.Percent(); - root_child3.Width = 50; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(50f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - Assert.AreEqual(100f, root_child3.LayoutX); - Assert.AreEqual(0f, root_child3.LayoutY); - Assert.AreEqual(0f, root_child3.LayoutWidth); - Assert.AreEqual(100f, root_child3.LayoutHeight); - - Assert.AreEqual(100f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(100f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(100f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(50f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - Assert.AreEqual(50f, root_child3.LayoutX); - Assert.AreEqual(0f, root_child3.LayoutY); - Assert.AreEqual(0f, root_child3.LayoutWidth); - Assert.AreEqual(100f, root_child3.LayoutHeight); - - Assert.AreEqual(0f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(100f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_stretch_row_with_margin() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.Stretch; - root.Wrap = YogaWrap.Wrap; - root.Width = 150; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.MarginLeft = 10; - root_child1.MarginTop = 10; - root_child1.MarginRight = 10; - root_child1.MarginBottom = 10; - root_child1.Width = 50; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.MarginLeft = 10; - root_child3.MarginTop = 10; - root_child3.MarginRight = 10; - root_child3.MarginBottom = 10; - root_child3.Width = 50; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - - Assert.AreEqual(60f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(40f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(40f, root_child2.LayoutHeight); - - Assert.AreEqual(60f, root_child3.LayoutX); - Assert.AreEqual(50f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(0f, root_child4.LayoutX); - Assert.AreEqual(80f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(100f, root_child2.LayoutX); - Assert.AreEqual(40f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(40f, root_child2.LayoutHeight); - - Assert.AreEqual(40f, root_child3.LayoutX); - Assert.AreEqual(50f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(100f, root_child4.LayoutX); - Assert.AreEqual(80f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_stretch_row_with_padding() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.Stretch; - root.Wrap = YogaWrap.Wrap; - root.Width = 150; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.PaddingLeft = 10; - root_child1.PaddingTop = 10; - root_child1.PaddingRight = 10; - root_child1.PaddingBottom = 10; - root_child1.Width = 50; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.PaddingLeft = 10; - root_child3.PaddingTop = 10; - root_child3.PaddingRight = 10; - root_child3.PaddingBottom = 10; - root_child3.Width = 50; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(100f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(50f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(50f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(50f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - Assert.AreEqual(100f, root_child3.LayoutX); - Assert.AreEqual(50f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(50f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(50f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_stretch_row_with_single_row() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.Stretch; - root.Wrap = YogaWrap.Wrap; - root.Width = 150; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - } - - [Test] - public void Test_align_content_stretch_row_with_fixed_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.Stretch; - root.Wrap = YogaWrap.Wrap; - root.Width = 150; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 60; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 50; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(60f, root_child1.LayoutHeight); - - Assert.AreEqual(100f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(80f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(80f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(80f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(60f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(80f, root_child2.LayoutHeight); - - Assert.AreEqual(100f, root_child3.LayoutX); - Assert.AreEqual(80f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(80f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_stretch_row_with_max_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.Stretch; - root.Wrap = YogaWrap.Wrap; - root.Width = 150; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.MaxHeight = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 50; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(100f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(50f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(50f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(50f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - Assert.AreEqual(100f, root_child3.LayoutX); - Assert.AreEqual(50f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(50f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(50f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_stretch_row_with_min_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.Stretch; - root.Wrap = YogaWrap.Wrap; - root.Width = 150; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.MinHeight = 80; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 50; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(90f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(90f, root_child1.LayoutHeight); - - Assert.AreEqual(100f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(90f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(90f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(10f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(90f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(10f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(90f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(90f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(90f, root_child2.LayoutHeight); - - Assert.AreEqual(100f, root_child3.LayoutX); - Assert.AreEqual(90f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(10f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(90f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(10f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_stretch_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignContent = YogaAlign.Stretch; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 150; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexGrow = 1; - root_child0_child0.FlexShrink = 1; - root_child0_child0.FlexBasis = 0.Percent(); - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.FlexShrink = 1; - root_child1.FlexBasis = 0.Percent(); - root_child1.Height = 50; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Height = 50; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Height = 50; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Height = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(150f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(50f, root_child0_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(50f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(100f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(50f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(150f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(50f, root_child0_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - Assert.AreEqual(50f, root_child2.LayoutX); - Assert.AreEqual(50f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - Assert.AreEqual(50f, root_child3.LayoutX); - Assert.AreEqual(100f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(50f, root_child3.LayoutHeight); - - Assert.AreEqual(0f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(50f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - } - - [Test] - public void Test_align_content_stretch_is_not_overriding_align_items() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignContent = YogaAlign.Stretch; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexDirection = YogaFlexDirection.Row; - root_child0.AlignContent = YogaAlign.Stretch; - root_child0.AlignItems = YogaAlign.Center; - root_child0.Width = 100; - root_child0.Height = 100; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.AlignContent = YogaAlign.Stretch; - root_child0_child0.Width = 10; - root_child0_child0.Height = 10; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(45f, root_child0_child0.LayoutY); - Assert.AreEqual(10f, root_child0_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(90f, root_child0_child0.LayoutX); - Assert.AreEqual(45f, root_child0_child0.LayoutY); - Assert.AreEqual(10f, root_child0_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0_child0.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs b/csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs deleted file mode 100644 index 1740bb4b0e..0000000000 --- a/csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs +++ /dev/null @@ -1,2224 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGAlignItemsTest - { - [Test] - public void Test_align_items_stretch() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_align_items_center() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Center; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(45f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(45f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_align_items_flex_start() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.FlexStart; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(90f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_align_items_flex_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.FlexEnd; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(90f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_align_baseline() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Baseline; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 20; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(30f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(30f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - } - - [Test] - public void Test_align_baseline_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Baseline; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.Width = 50; - root_child1_child0.Height = 10; - root_child1.Insert(0, root_child1_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - } - - [Test] - public void Test_align_baseline_child_multiline() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Baseline; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 60; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexDirection = YogaFlexDirection.Row; - root_child1.Wrap = YogaWrap.Wrap; - root_child1.Width = 50; - root_child1.Height = 25; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.Width = 25; - root_child1_child0.Height = 20; - root_child1.Insert(0, root_child1_child0); - - YogaNode root_child1_child1 = new YogaNode(config); - root_child1_child1.Width = 25; - root_child1_child1.Height = 10; - root_child1.Insert(1, root_child1_child1); - - YogaNode root_child1_child2 = new YogaNode(config); - root_child1_child2.Width = 25; - root_child1_child2.Height = 20; - root_child1.Insert(2, root_child1_child2); - - YogaNode root_child1_child3 = new YogaNode(config); - root_child1_child3.Width = 25; - root_child1_child3.Height = 10; - root_child1.Insert(3, root_child1_child3); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(25f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(25f, root_child1_child0.LayoutWidth); - Assert.AreEqual(20f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(25f, root_child1_child1.LayoutX); - Assert.AreEqual(0f, root_child1_child1.LayoutY); - Assert.AreEqual(25f, root_child1_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child2.LayoutX); - Assert.AreEqual(20f, root_child1_child2.LayoutY); - Assert.AreEqual(25f, root_child1_child2.LayoutWidth); - Assert.AreEqual(20f, root_child1_child2.LayoutHeight); - - Assert.AreEqual(25f, root_child1_child3.LayoutX); - Assert.AreEqual(20f, root_child1_child3.LayoutY); - Assert.AreEqual(25f, root_child1_child3.LayoutWidth); - Assert.AreEqual(10f, root_child1_child3.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(25f, root_child1.LayoutHeight); - - Assert.AreEqual(25f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(25f, root_child1_child0.LayoutWidth); - Assert.AreEqual(20f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child1.LayoutX); - Assert.AreEqual(0f, root_child1_child1.LayoutY); - Assert.AreEqual(25f, root_child1_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1_child1.LayoutHeight); - - Assert.AreEqual(25f, root_child1_child2.LayoutX); - Assert.AreEqual(20f, root_child1_child2.LayoutY); - Assert.AreEqual(25f, root_child1_child2.LayoutWidth); - Assert.AreEqual(20f, root_child1_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child3.LayoutX); - Assert.AreEqual(20f, root_child1_child3.LayoutY); - Assert.AreEqual(25f, root_child1_child3.LayoutWidth); - Assert.AreEqual(10f, root_child1_child3.LayoutHeight); - } - - [Test] - public void Test_align_baseline_child_multiline_override() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Baseline; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 60; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexDirection = YogaFlexDirection.Row; - root_child1.Wrap = YogaWrap.Wrap; - root_child1.Width = 50; - root_child1.Height = 25; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.Width = 25; - root_child1_child0.Height = 20; - root_child1.Insert(0, root_child1_child0); - - YogaNode root_child1_child1 = new YogaNode(config); - root_child1_child1.AlignSelf = YogaAlign.Baseline; - root_child1_child1.Width = 25; - root_child1_child1.Height = 10; - root_child1.Insert(1, root_child1_child1); - - YogaNode root_child1_child2 = new YogaNode(config); - root_child1_child2.Width = 25; - root_child1_child2.Height = 20; - root_child1.Insert(2, root_child1_child2); - - YogaNode root_child1_child3 = new YogaNode(config); - root_child1_child3.AlignSelf = YogaAlign.Baseline; - root_child1_child3.Width = 25; - root_child1_child3.Height = 10; - root_child1.Insert(3, root_child1_child3); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(25f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(25f, root_child1_child0.LayoutWidth); - Assert.AreEqual(20f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(25f, root_child1_child1.LayoutX); - Assert.AreEqual(0f, root_child1_child1.LayoutY); - Assert.AreEqual(25f, root_child1_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child2.LayoutX); - Assert.AreEqual(20f, root_child1_child2.LayoutY); - Assert.AreEqual(25f, root_child1_child2.LayoutWidth); - Assert.AreEqual(20f, root_child1_child2.LayoutHeight); - - Assert.AreEqual(25f, root_child1_child3.LayoutX); - Assert.AreEqual(20f, root_child1_child3.LayoutY); - Assert.AreEqual(25f, root_child1_child3.LayoutWidth); - Assert.AreEqual(10f, root_child1_child3.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(25f, root_child1.LayoutHeight); - - Assert.AreEqual(25f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(25f, root_child1_child0.LayoutWidth); - Assert.AreEqual(20f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child1.LayoutX); - Assert.AreEqual(0f, root_child1_child1.LayoutY); - Assert.AreEqual(25f, root_child1_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1_child1.LayoutHeight); - - Assert.AreEqual(25f, root_child1_child2.LayoutX); - Assert.AreEqual(20f, root_child1_child2.LayoutY); - Assert.AreEqual(25f, root_child1_child2.LayoutWidth); - Assert.AreEqual(20f, root_child1_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child3.LayoutX); - Assert.AreEqual(20f, root_child1_child3.LayoutY); - Assert.AreEqual(25f, root_child1_child3.LayoutWidth); - Assert.AreEqual(10f, root_child1_child3.LayoutHeight); - } - - [Test] - public void Test_align_baseline_child_multiline_no_override_on_secondline() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Baseline; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 60; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexDirection = YogaFlexDirection.Row; - root_child1.Wrap = YogaWrap.Wrap; - root_child1.Width = 50; - root_child1.Height = 25; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.Width = 25; - root_child1_child0.Height = 20; - root_child1.Insert(0, root_child1_child0); - - YogaNode root_child1_child1 = new YogaNode(config); - root_child1_child1.Width = 25; - root_child1_child1.Height = 10; - root_child1.Insert(1, root_child1_child1); - - YogaNode root_child1_child2 = new YogaNode(config); - root_child1_child2.Width = 25; - root_child1_child2.Height = 20; - root_child1.Insert(2, root_child1_child2); - - YogaNode root_child1_child3 = new YogaNode(config); - root_child1_child3.AlignSelf = YogaAlign.Baseline; - root_child1_child3.Width = 25; - root_child1_child3.Height = 10; - root_child1.Insert(3, root_child1_child3); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(25f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(25f, root_child1_child0.LayoutWidth); - Assert.AreEqual(20f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(25f, root_child1_child1.LayoutX); - Assert.AreEqual(0f, root_child1_child1.LayoutY); - Assert.AreEqual(25f, root_child1_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child2.LayoutX); - Assert.AreEqual(20f, root_child1_child2.LayoutY); - Assert.AreEqual(25f, root_child1_child2.LayoutWidth); - Assert.AreEqual(20f, root_child1_child2.LayoutHeight); - - Assert.AreEqual(25f, root_child1_child3.LayoutX); - Assert.AreEqual(20f, root_child1_child3.LayoutY); - Assert.AreEqual(25f, root_child1_child3.LayoutWidth); - Assert.AreEqual(10f, root_child1_child3.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(25f, root_child1.LayoutHeight); - - Assert.AreEqual(25f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(25f, root_child1_child0.LayoutWidth); - Assert.AreEqual(20f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child1.LayoutX); - Assert.AreEqual(0f, root_child1_child1.LayoutY); - Assert.AreEqual(25f, root_child1_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1_child1.LayoutHeight); - - Assert.AreEqual(25f, root_child1_child2.LayoutX); - Assert.AreEqual(20f, root_child1_child2.LayoutY); - Assert.AreEqual(25f, root_child1_child2.LayoutWidth); - Assert.AreEqual(20f, root_child1_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child3.LayoutX); - Assert.AreEqual(20f, root_child1_child3.LayoutY); - Assert.AreEqual(25f, root_child1_child3.LayoutWidth); - Assert.AreEqual(10f, root_child1_child3.LayoutHeight); - } - - [Test] - public void Test_align_baseline_child_top() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Baseline; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Top = 10; - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.Width = 50; - root_child1_child0.Height = 10; - root_child1.Insert(0, root_child1_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - } - - [Test] - public void Test_align_baseline_child_top2() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Baseline; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Top = 5; - root_child1.Width = 50; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.Width = 50; - root_child1_child0.Height = 10; - root_child1.Insert(0, root_child1_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(45f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(45f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - } - - [Test] - public void Test_align_baseline_double_nested_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Baseline; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.Width = 50; - root_child0_child0.Height = 20; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.Width = 50; - root_child1_child0.Height = 15; - root_child1.Insert(0, root_child1_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(50f, root_child0_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(5f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(15f, root_child1_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(50f, root_child0_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(5f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(15f, root_child1_child0.LayoutHeight); - } - - [Test] - public void Test_align_baseline_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Baseline; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 20; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - } - - [Test] - public void Test_align_baseline_child_margin() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Baseline; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginLeft = 5; - root_child0.MarginTop = 5; - root_child0.MarginRight = 5; - root_child0.MarginBottom = 5; - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.MarginLeft = 1; - root_child1_child0.MarginTop = 1; - root_child1_child0.MarginRight = 1; - root_child1_child0.MarginBottom = 1; - root_child1_child0.Width = 50; - root_child1_child0.Height = 10; - root_child1.Insert(0, root_child1_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(5f, root_child0.LayoutX); - Assert.AreEqual(5f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(60f, root_child1.LayoutX); - Assert.AreEqual(44f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(1f, root_child1_child0.LayoutX); - Assert.AreEqual(1f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(45f, root_child0.LayoutX); - Assert.AreEqual(5f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(-10f, root_child1.LayoutX); - Assert.AreEqual(44f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(-1f, root_child1_child0.LayoutX); - Assert.AreEqual(1f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - } - - [Test] - public void Test_align_baseline_child_padding() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Baseline; - root.PaddingLeft = 5; - root.PaddingTop = 5; - root.PaddingRight = 5; - root.PaddingBottom = 5; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.PaddingLeft = 5; - root_child1.PaddingTop = 5; - root_child1.PaddingRight = 5; - root_child1.PaddingBottom = 5; - root_child1.Width = 50; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.Width = 50; - root_child1_child0.Height = 10; - root_child1.Insert(0, root_child1_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(5f, root_child0.LayoutX); - Assert.AreEqual(5f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(55f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(5f, root_child1_child0.LayoutX); - Assert.AreEqual(5f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(45f, root_child0.LayoutX); - Assert.AreEqual(5f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(-5f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(-5f, root_child1_child0.LayoutX); - Assert.AreEqual(5f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - } - - [Test] - public void Test_align_baseline_multiline() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Baseline; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.Width = 50; - root_child1_child0.Height = 10; - root_child1.Insert(0, root_child1_child0); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root_child2.Height = 20; - root.Insert(2, root_child2); - - YogaNode root_child2_child0 = new YogaNode(config); - root_child2_child0.Width = 50; - root_child2_child0.Height = 10; - root_child2.Insert(0, root_child2_child0); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 50; - root_child3.Height = 50; - root.Insert(3, root_child3); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(100f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child2_child0.LayoutX); - Assert.AreEqual(0f, root_child2_child0.LayoutY); - Assert.AreEqual(50f, root_child2_child0.LayoutWidth); - Assert.AreEqual(10f, root_child2_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child3.LayoutX); - Assert.AreEqual(60f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(50f, root_child3.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child2.LayoutX); - Assert.AreEqual(100f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child2_child0.LayoutX); - Assert.AreEqual(0f, root_child2_child0.LayoutY); - Assert.AreEqual(50f, root_child2_child0.LayoutWidth); - Assert.AreEqual(10f, root_child2_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(60f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(50f, root_child3.LayoutHeight); - } - - [Test] - [Ignore] - public void Test_align_baseline_multiline_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Baseline; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 30; - root_child1.Height = 50; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.Width = 20; - root_child1_child0.Height = 20; - root_child1.Insert(0, root_child1_child0); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 40; - root_child2.Height = 70; - root.Insert(2, root_child2); - - YogaNode root_child2_child0 = new YogaNode(config); - root_child2_child0.Width = 10; - root_child2_child0.Height = 10; - root_child2.Insert(0, root_child2_child0); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 50; - root_child3.Height = 20; - root.Insert(3, root_child3); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(20f, root_child1_child0.LayoutWidth); - Assert.AreEqual(20f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(40f, root_child2.LayoutWidth); - Assert.AreEqual(70f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child2_child0.LayoutX); - Assert.AreEqual(0f, root_child2_child0.LayoutY); - Assert.AreEqual(10f, root_child2_child0.LayoutWidth); - Assert.AreEqual(10f, root_child2_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child3.LayoutX); - Assert.AreEqual(70f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(10f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(20f, root_child1_child0.LayoutWidth); - Assert.AreEqual(20f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(40f, root_child2.LayoutWidth); - Assert.AreEqual(70f, root_child2.LayoutHeight); - - Assert.AreEqual(30f, root_child2_child0.LayoutX); - Assert.AreEqual(0f, root_child2_child0.LayoutY); - Assert.AreEqual(10f, root_child2_child0.LayoutWidth); - Assert.AreEqual(10f, root_child2_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(70f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - } - - [Test] - [Ignore] - public void Test_align_baseline_multiline_column2() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Baseline; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 30; - root_child1.Height = 50; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.Width = 20; - root_child1_child0.Height = 20; - root_child1.Insert(0, root_child1_child0); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 40; - root_child2.Height = 70; - root.Insert(2, root_child2); - - YogaNode root_child2_child0 = new YogaNode(config); - root_child2_child0.Width = 10; - root_child2_child0.Height = 10; - root_child2.Insert(0, root_child2_child0); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 50; - root_child3.Height = 20; - root.Insert(3, root_child3); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(20f, root_child1_child0.LayoutWidth); - Assert.AreEqual(20f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(40f, root_child2.LayoutWidth); - Assert.AreEqual(70f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child2_child0.LayoutX); - Assert.AreEqual(0f, root_child2_child0.LayoutY); - Assert.AreEqual(10f, root_child2_child0.LayoutWidth); - Assert.AreEqual(10f, root_child2_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child3.LayoutX); - Assert.AreEqual(70f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(10f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(20f, root_child1_child0.LayoutWidth); - Assert.AreEqual(20f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(40f, root_child2.LayoutWidth); - Assert.AreEqual(70f, root_child2.LayoutHeight); - - Assert.AreEqual(30f, root_child2_child0.LayoutX); - Assert.AreEqual(0f, root_child2_child0.LayoutY); - Assert.AreEqual(10f, root_child2_child0.LayoutWidth); - Assert.AreEqual(10f, root_child2_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(70f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - } - - [Test] - public void Test_align_baseline_multiline_row_and_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Baseline; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.Width = 50; - root_child1_child0.Height = 10; - root_child1.Insert(0, root_child1_child0); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root_child2.Height = 20; - root.Insert(2, root_child2); - - YogaNode root_child2_child0 = new YogaNode(config); - root_child2_child0.Width = 50; - root_child2_child0.Height = 10; - root_child2.Insert(0, root_child2_child0); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 50; - root_child3.Height = 20; - root.Insert(3, root_child3); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(100f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child2_child0.LayoutX); - Assert.AreEqual(0f, root_child2_child0.LayoutY); - Assert.AreEqual(50f, root_child2_child0.LayoutWidth); - Assert.AreEqual(10f, root_child2_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child3.LayoutX); - Assert.AreEqual(90f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child2.LayoutX); - Assert.AreEqual(100f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child2_child0.LayoutX); - Assert.AreEqual(0f, root_child2_child0.LayoutY); - Assert.AreEqual(50f, root_child2_child0.LayoutWidth); - Assert.AreEqual(10f, root_child2_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(90f, root_child3.LayoutY); - Assert.AreEqual(50f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - } - - [Test] - public void Test_align_items_center_child_with_margin_bigger_than_parent() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.AlignItems = YogaAlign.Center; - root.Width = 52; - root.Height = 52; - - YogaNode root_child0 = new YogaNode(config); - root_child0.AlignItems = YogaAlign.Center; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.MarginLeft = 10; - root_child0_child0.MarginRight = 10; - root_child0_child0.Width = 52; - root_child0_child0.Height = 52; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(-10f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(52f, root_child0.LayoutHeight); - - Assert.AreEqual(10f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(52f, root_child0_child0.LayoutWidth); - Assert.AreEqual(52f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(-10f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(52f, root_child0.LayoutHeight); - - Assert.AreEqual(10f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(52f, root_child0_child0.LayoutWidth); - Assert.AreEqual(52f, root_child0_child0.LayoutHeight); - } - - [Test] - public void Test_align_items_flex_end_child_with_margin_bigger_than_parent() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.AlignItems = YogaAlign.Center; - root.Width = 52; - root.Height = 52; - - YogaNode root_child0 = new YogaNode(config); - root_child0.AlignItems = YogaAlign.FlexEnd; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.MarginLeft = 10; - root_child0_child0.MarginRight = 10; - root_child0_child0.Width = 52; - root_child0_child0.Height = 52; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(-10f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(52f, root_child0.LayoutHeight); - - Assert.AreEqual(10f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(52f, root_child0_child0.LayoutWidth); - Assert.AreEqual(52f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(-10f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(52f, root_child0.LayoutHeight); - - Assert.AreEqual(10f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(52f, root_child0_child0.LayoutWidth); - Assert.AreEqual(52f, root_child0_child0.LayoutHeight); - } - - [Test] - public void Test_align_items_center_child_without_margin_bigger_than_parent() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.AlignItems = YogaAlign.Center; - root.Width = 52; - root.Height = 52; - - YogaNode root_child0 = new YogaNode(config); - root_child0.AlignItems = YogaAlign.Center; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.Width = 72; - root_child0_child0.Height = 72; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(-10f, root_child0.LayoutX); - Assert.AreEqual(-10f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(72f, root_child0_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(-10f, root_child0.LayoutX); - Assert.AreEqual(-10f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(72f, root_child0_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0_child0.LayoutHeight); - } - - [Test] - public void Test_align_items_flex_end_child_without_margin_bigger_than_parent() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.AlignItems = YogaAlign.Center; - root.Width = 52; - root.Height = 52; - - YogaNode root_child0 = new YogaNode(config); - root_child0.AlignItems = YogaAlign.FlexEnd; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.Width = 72; - root_child0_child0.Height = 72; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(-10f, root_child0.LayoutX); - Assert.AreEqual(-10f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(72f, root_child0_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(-10f, root_child0.LayoutX); - Assert.AreEqual(-10f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(72f, root_child0_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0_child0.LayoutHeight); - } - - [Test] - public void Test_align_center_should_size_based_on_content() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Center; - root.MarginTop = 20; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.JustifyContent = YogaJustify.Center; - root_child0.FlexShrink = 1; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexGrow = 1; - root_child0_child0.FlexShrink = 1; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0.Width = 20; - root_child0_child0_child0.Height = 20; - root_child0_child0.Insert(0, root_child0_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(20f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(40f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(20f, root_child0_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(20f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(20f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(40f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(20f, root_child0_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(20f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0_child0_child0.LayoutHeight); - } - - [Test] - public void Test_align_stretch_should_size_based_on_parent() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.MarginTop = 20; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.JustifyContent = YogaJustify.Center; - root_child0.FlexShrink = 1; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexGrow = 1; - root_child0_child0.FlexShrink = 1; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0.Width = 20; - root_child0_child0_child0.Height = 20; - root_child0_child0.Insert(0, root_child0_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(20f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(20f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(20f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(80f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(20f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0_child0_child0.LayoutHeight); - } - - [Test] - public void Test_align_flex_start_with_shrinking_children() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 500; - root.Height = 500; - - YogaNode root_child0 = new YogaNode(config); - root_child0.AlignItems = YogaAlign.FlexStart; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexGrow = 1; - root_child0_child0.FlexShrink = 1; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0.FlexGrow = 1; - root_child0_child0_child0.FlexShrink = 1; - root_child0_child0.Insert(0, root_child0_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(500f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(0f, root_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(500f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(500f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(0f, root_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutHeight); - } - - [Test] - public void Test_align_flex_start_with_stretching_children() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 500; - root.Height = 500; - - YogaNode root_child0 = new YogaNode(config); - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexGrow = 1; - root_child0_child0.FlexShrink = 1; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0.FlexGrow = 1; - root_child0_child0_child0.FlexShrink = 1; - root_child0_child0.Insert(0, root_child0_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(500f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(500f, root_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(500f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(500f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(500f, root_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(500f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutHeight); - } - - [Test] - public void Test_align_flex_start_with_shrinking_children_with_stretch() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 500; - root.Height = 500; - - YogaNode root_child0 = new YogaNode(config); - root_child0.AlignItems = YogaAlign.FlexStart; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexGrow = 1; - root_child0_child0.FlexShrink = 1; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0.FlexGrow = 1; - root_child0_child0_child0.FlexShrink = 1; - root_child0_child0.Insert(0, root_child0_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(500f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(0f, root_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(500f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(500f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(0f, root_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGAlignSelfTest.cs b/csharp/tests/Facebook.Yoga/YGAlignSelfTest.cs deleted file mode 100644 index 998d72084b..0000000000 --- a/csharp/tests/Facebook.Yoga/YGAlignSelfTest.cs +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGAlignSelfTest - { - [Test] - public void Test_align_self_center() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.AlignSelf = YogaAlign.Center; - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(45f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(45f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_align_self_flex_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.AlignSelf = YogaAlign.FlexEnd; - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(90f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_align_self_flex_start() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.AlignSelf = YogaAlign.FlexStart; - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(90f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_align_self_flex_end_override_flex_start() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.FlexStart; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.AlignSelf = YogaAlign.FlexEnd; - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(90f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_align_self_baseline() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.AlignSelf = YogaAlign.Baseline; - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.AlignSelf = YogaAlign.Baseline; - root_child1.Width = 50; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.Width = 50; - root_child1_child0.Height = 10; - root_child1.Insert(0, root_child1_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(50f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGAndroidNewsFeed.cs b/csharp/tests/Facebook.Yoga/YGAndroidNewsFeed.cs deleted file mode 100644 index e524cc493b..0000000000 --- a/csharp/tests/Facebook.Yoga/YGAndroidNewsFeed.cs +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGAndroidNewsFeed.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGAndroidNewsFeed - { - [Test] - public void Test_android_news_feed() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignContent = YogaAlign.Stretch; - root.Width = 1080; - - YogaNode root_child0 = new YogaNode(config); - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.AlignContent = YogaAlign.Stretch; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0.AlignContent = YogaAlign.Stretch; - root_child0_child0.Insert(0, root_child0_child0_child0); - - YogaNode root_child0_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0_child0.FlexDirection = YogaFlexDirection.Row; - root_child0_child0_child0_child0.AlignContent = YogaAlign.Stretch; - root_child0_child0_child0_child0.AlignItems = YogaAlign.FlexStart; - root_child0_child0_child0_child0.MarginStart = 36; - root_child0_child0_child0_child0.MarginTop = 24; - root_child0_child0_child0.Insert(0, root_child0_child0_child0_child0); - - YogaNode root_child0_child0_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0_child0_child0.FlexDirection = YogaFlexDirection.Row; - root_child0_child0_child0_child0_child0.AlignContent = YogaAlign.Stretch; - root_child0_child0_child0_child0.Insert(0, root_child0_child0_child0_child0_child0); - - YogaNode root_child0_child0_child0_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0_child0_child0_child0.AlignContent = YogaAlign.Stretch; - root_child0_child0_child0_child0_child0_child0.Width = 120; - root_child0_child0_child0_child0_child0_child0.Height = 120; - root_child0_child0_child0_child0_child0.Insert(0, root_child0_child0_child0_child0_child0_child0); - - YogaNode root_child0_child0_child0_child0_child1 = new YogaNode(config); - root_child0_child0_child0_child0_child1.AlignContent = YogaAlign.Stretch; - root_child0_child0_child0_child0_child1.FlexShrink = 1; - root_child0_child0_child0_child0_child1.MarginRight = 36; - root_child0_child0_child0_child0_child1.PaddingLeft = 36; - root_child0_child0_child0_child0_child1.PaddingTop = 21; - root_child0_child0_child0_child0_child1.PaddingRight = 36; - root_child0_child0_child0_child0_child1.PaddingBottom = 18; - root_child0_child0_child0_child0.Insert(1, root_child0_child0_child0_child0_child1); - - YogaNode root_child0_child0_child0_child0_child1_child0 = new YogaNode(config); - root_child0_child0_child0_child0_child1_child0.FlexDirection = YogaFlexDirection.Row; - root_child0_child0_child0_child0_child1_child0.AlignContent = YogaAlign.Stretch; - root_child0_child0_child0_child0_child1_child0.FlexShrink = 1; - root_child0_child0_child0_child0_child1.Insert(0, root_child0_child0_child0_child0_child1_child0); - - YogaNode root_child0_child0_child0_child0_child1_child1 = new YogaNode(config); - root_child0_child0_child0_child0_child1_child1.AlignContent = YogaAlign.Stretch; - root_child0_child0_child0_child0_child1_child1.FlexShrink = 1; - root_child0_child0_child0_child0_child1.Insert(1, root_child0_child0_child0_child0_child1_child1); - - YogaNode root_child0_child0_child1 = new YogaNode(config); - root_child0_child0_child1.AlignContent = YogaAlign.Stretch; - root_child0_child0.Insert(1, root_child0_child0_child1); - - YogaNode root_child0_child0_child1_child0 = new YogaNode(config); - root_child0_child0_child1_child0.FlexDirection = YogaFlexDirection.Row; - root_child0_child0_child1_child0.AlignContent = YogaAlign.Stretch; - root_child0_child0_child1_child0.AlignItems = YogaAlign.FlexStart; - root_child0_child0_child1_child0.MarginStart = 174; - root_child0_child0_child1_child0.MarginTop = 24; - root_child0_child0_child1.Insert(0, root_child0_child0_child1_child0); - - YogaNode root_child0_child0_child1_child0_child0 = new YogaNode(config); - root_child0_child0_child1_child0_child0.FlexDirection = YogaFlexDirection.Row; - root_child0_child0_child1_child0_child0.AlignContent = YogaAlign.Stretch; - root_child0_child0_child1_child0.Insert(0, root_child0_child0_child1_child0_child0); - - YogaNode root_child0_child0_child1_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child1_child0_child0_child0.AlignContent = YogaAlign.Stretch; - root_child0_child0_child1_child0_child0_child0.Width = 72; - root_child0_child0_child1_child0_child0_child0.Height = 72; - root_child0_child0_child1_child0_child0.Insert(0, root_child0_child0_child1_child0_child0_child0); - - YogaNode root_child0_child0_child1_child0_child1 = new YogaNode(config); - root_child0_child0_child1_child0_child1.AlignContent = YogaAlign.Stretch; - root_child0_child0_child1_child0_child1.FlexShrink = 1; - root_child0_child0_child1_child0_child1.MarginRight = 36; - root_child0_child0_child1_child0_child1.PaddingLeft = 36; - root_child0_child0_child1_child0_child1.PaddingTop = 21; - root_child0_child0_child1_child0_child1.PaddingRight = 36; - root_child0_child0_child1_child0_child1.PaddingBottom = 18; - root_child0_child0_child1_child0.Insert(1, root_child0_child0_child1_child0_child1); - - YogaNode root_child0_child0_child1_child0_child1_child0 = new YogaNode(config); - root_child0_child0_child1_child0_child1_child0.FlexDirection = YogaFlexDirection.Row; - root_child0_child0_child1_child0_child1_child0.AlignContent = YogaAlign.Stretch; - root_child0_child0_child1_child0_child1_child0.FlexShrink = 1; - root_child0_child0_child1_child0_child1.Insert(0, root_child0_child0_child1_child0_child1_child0); - - YogaNode root_child0_child0_child1_child0_child1_child1 = new YogaNode(config); - root_child0_child0_child1_child0_child1_child1.AlignContent = YogaAlign.Stretch; - root_child0_child0_child1_child0_child1_child1.FlexShrink = 1; - root_child0_child0_child1_child0_child1.Insert(1, root_child0_child0_child1_child0_child1_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(1080f, root.LayoutWidth); - Assert.AreEqual(240f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(1080f, root_child0.LayoutWidth); - Assert.AreEqual(240f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(1080f, root_child0_child0.LayoutWidth); - Assert.AreEqual(240f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(1080f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(144f, root_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(36f, root_child0_child0_child0_child0.LayoutX); - Assert.AreEqual(24f, root_child0_child0_child0_child0.LayoutY); - Assert.AreEqual(1044f, root_child0_child0_child0_child0.LayoutWidth); - Assert.AreEqual(120f, root_child0_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0_child0_child0.LayoutY); - Assert.AreEqual(120f, root_child0_child0_child0_child0_child0.LayoutWidth); - Assert.AreEqual(120f, root_child0_child0_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0_child0_child0_child0.LayoutY); - Assert.AreEqual(120f, root_child0_child0_child0_child0_child0_child0.LayoutWidth); - Assert.AreEqual(120f, root_child0_child0_child0_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(120f, root_child0_child0_child0_child0_child1.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0_child0_child1.LayoutY); - Assert.AreEqual(72f, root_child0_child0_child0_child0_child1.LayoutWidth); - Assert.AreEqual(39f, root_child0_child0_child0_child0_child1.LayoutHeight); - - Assert.AreEqual(36f, root_child0_child0_child0_child0_child1_child0.LayoutX); - Assert.AreEqual(21f, root_child0_child0_child0_child0_child1_child0.LayoutY); - Assert.AreEqual(0f, root_child0_child0_child0_child0_child1_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0_child0_child0_child1_child0.LayoutHeight); - - Assert.AreEqual(36f, root_child0_child0_child0_child0_child1_child1.LayoutX); - Assert.AreEqual(21f, root_child0_child0_child0_child0_child1_child1.LayoutY); - Assert.AreEqual(0f, root_child0_child0_child0_child0_child1_child1.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0_child0_child0_child1_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child1.LayoutX); - Assert.AreEqual(144f, root_child0_child0_child1.LayoutY); - Assert.AreEqual(1080f, root_child0_child0_child1.LayoutWidth); - Assert.AreEqual(96f, root_child0_child0_child1.LayoutHeight); - - Assert.AreEqual(174f, root_child0_child0_child1_child0.LayoutX); - Assert.AreEqual(24f, root_child0_child0_child1_child0.LayoutY); - Assert.AreEqual(906f, root_child0_child0_child1_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0_child0_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child1_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child1_child0_child0.LayoutY); - Assert.AreEqual(72f, root_child0_child0_child1_child0_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0_child0_child1_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child1_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child1_child0_child0_child0.LayoutY); - Assert.AreEqual(72f, root_child0_child0_child1_child0_child0_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0_child0_child1_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(72f, root_child0_child0_child1_child0_child1.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child1_child0_child1.LayoutY); - Assert.AreEqual(72f, root_child0_child0_child1_child0_child1.LayoutWidth); - Assert.AreEqual(39f, root_child0_child0_child1_child0_child1.LayoutHeight); - - Assert.AreEqual(36f, root_child0_child0_child1_child0_child1_child0.LayoutX); - Assert.AreEqual(21f, root_child0_child0_child1_child0_child1_child0.LayoutY); - Assert.AreEqual(0f, root_child0_child0_child1_child0_child1_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0_child1_child0_child1_child0.LayoutHeight); - - Assert.AreEqual(36f, root_child0_child0_child1_child0_child1_child1.LayoutX); - Assert.AreEqual(21f, root_child0_child0_child1_child0_child1_child1.LayoutY); - Assert.AreEqual(0f, root_child0_child0_child1_child0_child1_child1.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0_child1_child0_child1_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(1080f, root.LayoutWidth); - Assert.AreEqual(240f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(1080f, root_child0.LayoutWidth); - Assert.AreEqual(240f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(1080f, root_child0_child0.LayoutWidth); - Assert.AreEqual(240f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(1080f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(144f, root_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0_child0.LayoutX); - Assert.AreEqual(24f, root_child0_child0_child0_child0.LayoutY); - Assert.AreEqual(1044f, root_child0_child0_child0_child0.LayoutWidth); - Assert.AreEqual(120f, root_child0_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(924f, root_child0_child0_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0_child0_child0.LayoutY); - Assert.AreEqual(120f, root_child0_child0_child0_child0_child0.LayoutWidth); - Assert.AreEqual(120f, root_child0_child0_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0_child0_child0_child0.LayoutY); - Assert.AreEqual(120f, root_child0_child0_child0_child0_child0_child0.LayoutWidth); - Assert.AreEqual(120f, root_child0_child0_child0_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(816f, root_child0_child0_child0_child0_child1.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0_child0_child1.LayoutY); - Assert.AreEqual(72f, root_child0_child0_child0_child0_child1.LayoutWidth); - Assert.AreEqual(39f, root_child0_child0_child0_child0_child1.LayoutHeight); - - Assert.AreEqual(36f, root_child0_child0_child0_child0_child1_child0.LayoutX); - Assert.AreEqual(21f, root_child0_child0_child0_child0_child1_child0.LayoutY); - Assert.AreEqual(0f, root_child0_child0_child0_child0_child1_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0_child0_child0_child1_child0.LayoutHeight); - - Assert.AreEqual(36f, root_child0_child0_child0_child0_child1_child1.LayoutX); - Assert.AreEqual(21f, root_child0_child0_child0_child0_child1_child1.LayoutY); - Assert.AreEqual(0f, root_child0_child0_child0_child0_child1_child1.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0_child0_child0_child1_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child1.LayoutX); - Assert.AreEqual(144f, root_child0_child0_child1.LayoutY); - Assert.AreEqual(1080f, root_child0_child0_child1.LayoutWidth); - Assert.AreEqual(96f, root_child0_child0_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child1_child0.LayoutX); - Assert.AreEqual(24f, root_child0_child0_child1_child0.LayoutY); - Assert.AreEqual(906f, root_child0_child0_child1_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0_child0_child1_child0.LayoutHeight); - - Assert.AreEqual(834f, root_child0_child0_child1_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child1_child0_child0.LayoutY); - Assert.AreEqual(72f, root_child0_child0_child1_child0_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0_child0_child1_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child1_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child1_child0_child0_child0.LayoutY); - Assert.AreEqual(72f, root_child0_child0_child1_child0_child0_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0_child0_child1_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(726f, root_child0_child0_child1_child0_child1.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child1_child0_child1.LayoutY); - Assert.AreEqual(72f, root_child0_child0_child1_child0_child1.LayoutWidth); - Assert.AreEqual(39f, root_child0_child0_child1_child0_child1.LayoutHeight); - - Assert.AreEqual(36f, root_child0_child0_child1_child0_child1_child0.LayoutX); - Assert.AreEqual(21f, root_child0_child0_child1_child0_child1_child0.LayoutY); - Assert.AreEqual(0f, root_child0_child0_child1_child0_child1_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0_child1_child0_child1_child0.LayoutHeight); - - Assert.AreEqual(36f, root_child0_child0_child1_child0_child1_child1.LayoutX); - Assert.AreEqual(21f, root_child0_child0_child1_child0_child1_child1.LayoutY); - Assert.AreEqual(0f, root_child0_child0_child1_child0_child1_child1.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0_child1_child0_child1_child1.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGBorderTest.cs b/csharp/tests/Facebook.Yoga/YGBorderTest.cs deleted file mode 100644 index 084d00a7d8..0000000000 --- a/csharp/tests/Facebook.Yoga/YGBorderTest.cs +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGBorderTest - { - [Test] - public void Test_border_no_size() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.BorderLeftWidth = 10; - root.BorderTopWidth = 10; - root.BorderRightWidth = 10; - root.BorderBottomWidth = 10; - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(20f, root.LayoutWidth); - Assert.AreEqual(20f, root.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(20f, root.LayoutWidth); - Assert.AreEqual(20f, root.LayoutHeight); - } - - [Test] - public void Test_border_container_match_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.BorderLeftWidth = 10; - root.BorderTopWidth = 10; - root.BorderRightWidth = 10; - root.BorderBottomWidth = 10; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(30f, root.LayoutWidth); - Assert.AreEqual(30f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(30f, root.LayoutWidth); - Assert.AreEqual(30f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_border_flex_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.BorderLeftWidth = 10; - root.BorderTopWidth = 10; - root.BorderRightWidth = 10; - root.BorderBottomWidth = 10; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.Width = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - } - - [Test] - public void Test_border_stretch_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.BorderLeftWidth = 10; - root.BorderTopWidth = 10; - root.BorderRightWidth = 10; - root.BorderBottomWidth = 10; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(80f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(80f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_border_center_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.AlignItems = YogaAlign.Center; - root.BorderStartWidth = 10; - root.BorderEndWidth = 20; - root.BorderBottomWidth = 20; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(40f, root_child0.LayoutX); - Assert.AreEqual(35f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(35f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGDimensionTest.cs b/csharp/tests/Facebook.Yoga/YGDimensionTest.cs deleted file mode 100644 index 8263bcd9d1..0000000000 --- a/csharp/tests/Facebook.Yoga/YGDimensionTest.cs +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGDimensionTest - { - [Test] - public void Test_wrap_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 100; - root_child0.Height = 100; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - } - - [Test] - public void Test_wrap_grandchild() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - - YogaNode root_child0 = new YogaNode(config); - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.Width = 100; - root_child0_child0.Height = 100; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGDisplayTest.cs b/csharp/tests/Facebook.Yoga/YGDisplayTest.cs deleted file mode 100644 index ba6e17ee80..0000000000 --- a/csharp/tests/Facebook.Yoga/YGDisplayTest.cs +++ /dev/null @@ -1,392 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGDisplayTest - { - [Test] - public void Test_display_none() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.Display = YogaDisplay.None; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - } - - [Test] - public void Test_display_none_fixed_size() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root_child1.Height = 20; - root_child1.Display = YogaDisplay.None; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - } - - [Test] - public void Test_display_none_with_margin() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginLeft = 10; - root_child0.MarginTop = 10; - root_child0.MarginRight = 10; - root_child0.MarginBottom = 10; - root_child0.Width = 20; - root_child0.Height = 20; - root_child0.Display = YogaDisplay.None; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - } - - [Test] - public void Test_display_none_with_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexShrink = 1; - root_child0.FlexBasis = 0.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.FlexShrink = 1; - root_child1.FlexBasis = 0.Percent(); - root_child1.Display = YogaDisplay.None; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.FlexGrow = 1; - root_child1_child0.FlexShrink = 1; - root_child1_child0.FlexBasis = 0.Percent(); - root_child1_child0.Width = 20; - root_child1.Insert(0, root_child1_child0); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root_child2.FlexShrink = 1; - root_child2.FlexBasis = 0.Percent(); - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(0f, root_child1_child0.LayoutWidth); - Assert.AreEqual(0f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(0f, root_child1_child0.LayoutWidth); - Assert.AreEqual(0f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_display_none_with_position() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.Top = 10; - root_child1.Display = YogaDisplay.None; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - } - - [Test] - public void Test_display_none_with_position_absolute() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Width = 100; - root_child0.Height = 100; - root_child0.Display = YogaDisplay.None; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGFlexDirectionTest.cs b/csharp/tests/Facebook.Yoga/YGFlexDirectionTest.cs deleted file mode 100644 index 99c352eac6..0000000000 --- a/csharp/tests/Facebook.Yoga/YGFlexDirectionTest.cs +++ /dev/null @@ -1,435 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGFlexDirectionTest - { - [Test] - public void Test_flex_direction_column_no_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(30f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(30f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - } - - [Test] - public void Test_flex_direction_row_no_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(30f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(10f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(20f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(30f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(20f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(10f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_flex_direction_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - } - - [Test] - public void Test_flex_direction_row() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(10f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(20f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(90f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(80f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(70f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_flex_direction_column_reverse() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.ColumnReverse; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(90f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(80f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(70f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(90f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(80f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(70f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - } - - [Test] - public void Test_flex_direction_row_reverse() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.RowReverse; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(90f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(80f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(70f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(10f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(20f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGFlexTest.cs b/csharp/tests/Facebook.Yoga/YGFlexTest.cs deleted file mode 100644 index 54345ed4fe..0000000000 --- a/csharp/tests/Facebook.Yoga/YGFlexTest.cs +++ /dev/null @@ -1,636 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGFlexTest - { - [Test] - public void Test_flex_basis_flex_grow_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(75f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(75f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(25f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(75f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(75f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(25f, root_child1.LayoutHeight); - } - - [Test] - public void Test_flex_shrink_flex_grow_row() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 500; - root.Height = 500; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexShrink = 1; - root_child0.Width = 500; - root_child0.Height = 100; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexShrink = 1; - root_child1.Width = 500; - root_child1.Height = 100; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(250f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(250f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(250f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(250f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(250f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(250f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - } - - [Test] - public void Test_flex_shrink_flex_grow_child_flex_shrink_other_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 500; - root.Height = 500; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexShrink = 1; - root_child0.Width = 500; - root_child0.Height = 100; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.FlexShrink = 1; - root_child1.Width = 500; - root_child1.Height = 100; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(250f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(250f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(250f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(250f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(250f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(250f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - } - - [Test] - public void Test_flex_basis_flex_grow_row() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(75f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(25f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(25f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(75f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(25f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - } - - [Test] - public void Test_flex_basis_flex_shrink_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexShrink = 1; - root_child0.FlexBasis = 100; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexBasis = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_flex_basis_flex_shrink_row() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexShrink = 1; - root_child0.FlexBasis = 100; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexBasis = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - } - - [Test] - public void Test_flex_shrink_to_zero() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Height = 75; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexShrink = 1; - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root_child2.Height = 50; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(50f, root.LayoutWidth); - Assert.AreEqual(75f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(50f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(50f, root.LayoutWidth); - Assert.AreEqual(75f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(50f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - } - - [Test] - public void Test_flex_basis_overrides_main_size() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 50; - root_child0.Height = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(60f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(80f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(60f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(80f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - } - - [Test] - public void Test_flex_grow_shrink_at_most() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexGrow = 1; - root_child0_child0.FlexShrink = 1; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0.LayoutHeight); - } - - [Test] - public void Test_flex_grow_less_than_factor_one() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 500; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 0.2f; - root_child0.FlexBasis = 40; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 0.2f; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 0.4f; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(132f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(132f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(92f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(224f, root_child2.LayoutY); - Assert.AreEqual(200f, root_child2.LayoutWidth); - Assert.AreEqual(184f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(132f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(132f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(92f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(224f, root_child2.LayoutY); - Assert.AreEqual(200f, root_child2.LayoutWidth); - Assert.AreEqual(184f, root_child2.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs b/csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs deleted file mode 100644 index 8812dc57bc..0000000000 --- a/csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs +++ /dev/null @@ -1,1783 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGFlexWrapTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGFlexWrapTest - { - [Test] - public void Test_wrap_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Wrap = YogaWrap.Wrap; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 30; - root_child0.Height = 30; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 30; - root_child1.Height = 30; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 30; - root_child2.Height = 30; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 30; - root_child3.Height = 30; - root.Insert(3, root_child3); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(60f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(30f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(30f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(30f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(60f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(30f, root_child3.LayoutX); - Assert.AreEqual(0f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(30f, root_child3.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(60f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(30f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(30f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(30f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(30f, root_child1.LayoutHeight); - - Assert.AreEqual(30f, root_child2.LayoutX); - Assert.AreEqual(60f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(0f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(30f, root_child3.LayoutHeight); - } - - [Test] - public void Test_wrap_row() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 30; - root_child0.Height = 30; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 30; - root_child1.Height = 30; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 30; - root_child2.Height = 30; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 30; - root_child3.Height = 30; - root.Insert(3, root_child3); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(60f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(30f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(30f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(30f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(30f, root_child3.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(60f, root.LayoutHeight); - - Assert.AreEqual(70f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(30f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(30f, root_child1.LayoutHeight); - - Assert.AreEqual(10f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(70f, root_child3.LayoutX); - Assert.AreEqual(30f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(30f, root_child3.LayoutHeight); - } - - [Test] - public void Test_wrap_row_align_items_flex_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.FlexEnd; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 30; - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 30; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 30; - root_child2.Height = 30; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 30; - root_child3.Height = 30; - root.Insert(3, root_child3); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(60f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(20f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(30f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(30f, root_child3.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(60f, root.LayoutHeight); - - Assert.AreEqual(70f, root_child0.LayoutX); - Assert.AreEqual(20f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(10f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(70f, root_child3.LayoutX); - Assert.AreEqual(30f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(30f, root_child3.LayoutHeight); - } - - [Test] - public void Test_wrap_row_align_items_center() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Center; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 30; - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 30; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 30; - root_child2.Height = 30; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 30; - root_child3.Height = 30; - root.Insert(3, root_child3); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(60f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(5f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(30f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(30f, root_child3.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(60f, root.LayoutHeight); - - Assert.AreEqual(70f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(5f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(10f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(70f, root_child3.LayoutX); - Assert.AreEqual(30f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(30f, root_child3.LayoutHeight); - } - - [Test] - public void Test_flex_wrap_children_with_min_main_overriding_flex_basis() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexBasis = 50; - root_child0.MinWidth = 55; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexBasis = 50; - root_child1.MinWidth = 55; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(55f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(55f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(45f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(55f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(45f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(55f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_flex_wrap_wrap_to_child_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexDirection = YogaFlexDirection.Row; - root_child0.AlignItems = YogaAlign.FlexStart; - root_child0.Wrap = YogaWrap.Wrap; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.Width = 100; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0.Width = 100; - root_child0_child0_child0.Height = 100; - root_child0_child0.Insert(0, root_child0_child0_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 100; - root_child1.Height = 100; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(100f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(100f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - } - - [Test] - public void Test_flex_wrap_align_stretch_fits_one_row() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Wrap = YogaWrap.Wrap; - root.Width = 150; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(150f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - } - - [Test] - public void Test_wrap_reverse_row_align_content_flex_start() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Wrap = YogaWrap.WrapReverse; - root.Width = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 30; - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 30; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 30; - root_child2.Height = 30; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 30; - root_child3.Height = 40; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 30; - root_child4.Height = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(80f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(70f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(60f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(50f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(10f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(40f, root_child3.LayoutHeight); - - Assert.AreEqual(30f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(30f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(80f, root.LayoutHeight); - - Assert.AreEqual(70f, root_child0.LayoutX); - Assert.AreEqual(70f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(60f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(10f, root_child2.LayoutX); - Assert.AreEqual(50f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(70f, root_child3.LayoutX); - Assert.AreEqual(10f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(40f, root_child3.LayoutHeight); - - Assert.AreEqual(40f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(30f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - } - - [Test] - public void Test_wrap_reverse_row_align_content_center() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.Center; - root.Wrap = YogaWrap.WrapReverse; - root.Width = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 30; - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 30; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 30; - root_child2.Height = 30; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 30; - root_child3.Height = 40; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 30; - root_child4.Height = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(80f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(70f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(60f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(50f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(10f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(40f, root_child3.LayoutHeight); - - Assert.AreEqual(30f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(30f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(80f, root.LayoutHeight); - - Assert.AreEqual(70f, root_child0.LayoutX); - Assert.AreEqual(70f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(60f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(10f, root_child2.LayoutX); - Assert.AreEqual(50f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(70f, root_child3.LayoutX); - Assert.AreEqual(10f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(40f, root_child3.LayoutHeight); - - Assert.AreEqual(40f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(30f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - } - - [Test] - public void Test_wrap_reverse_row_single_line_different_size() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Wrap = YogaWrap.WrapReverse; - root.Width = 300; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 30; - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 30; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 30; - root_child2.Height = 30; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 30; - root_child3.Height = 40; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 30; - root_child4.Height = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(300f, root.LayoutWidth); - Assert.AreEqual(50f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(40f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(30f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(90f, root_child3.LayoutX); - Assert.AreEqual(10f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(40f, root_child3.LayoutHeight); - - Assert.AreEqual(120f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(30f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(300f, root.LayoutWidth); - Assert.AreEqual(50f, root.LayoutHeight); - - Assert.AreEqual(270f, root_child0.LayoutX); - Assert.AreEqual(40f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(240f, root_child1.LayoutX); - Assert.AreEqual(30f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(210f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(180f, root_child3.LayoutX); - Assert.AreEqual(10f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(40f, root_child3.LayoutHeight); - - Assert.AreEqual(150f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(30f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - } - - [Test] - public void Test_wrap_reverse_row_align_content_stretch() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.Stretch; - root.Wrap = YogaWrap.WrapReverse; - root.Width = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 30; - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 30; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 30; - root_child2.Height = 30; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 30; - root_child3.Height = 40; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 30; - root_child4.Height = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(80f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(70f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(60f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(50f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(10f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(40f, root_child3.LayoutHeight); - - Assert.AreEqual(30f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(30f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(80f, root.LayoutHeight); - - Assert.AreEqual(70f, root_child0.LayoutX); - Assert.AreEqual(70f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(60f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(10f, root_child2.LayoutX); - Assert.AreEqual(50f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(70f, root_child3.LayoutX); - Assert.AreEqual(10f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(40f, root_child3.LayoutHeight); - - Assert.AreEqual(40f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(30f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - } - - [Test] - public void Test_wrap_reverse_row_align_content_space_around() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.SpaceAround; - root.Wrap = YogaWrap.WrapReverse; - root.Width = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 30; - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 30; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 30; - root_child2.Height = 30; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 30; - root_child3.Height = 40; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 30; - root_child4.Height = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(80f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(70f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(60f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(50f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(10f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(40f, root_child3.LayoutHeight); - - Assert.AreEqual(30f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(30f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(80f, root.LayoutHeight); - - Assert.AreEqual(70f, root_child0.LayoutX); - Assert.AreEqual(70f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(60f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(10f, root_child2.LayoutX); - Assert.AreEqual(50f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(70f, root_child3.LayoutX); - Assert.AreEqual(10f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(40f, root_child3.LayoutHeight); - - Assert.AreEqual(40f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(30f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - } - - [Test] - public void Test_wrap_reverse_column_fixed_size() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Center; - root.Wrap = YogaWrap.WrapReverse; - root.Width = 200; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 30; - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 30; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 30; - root_child2.Height = 30; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 30; - root_child3.Height = 40; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 30; - root_child4.Height = 50; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(170f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(170f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(170f, root_child2.LayoutX); - Assert.AreEqual(30f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(170f, root_child3.LayoutX); - Assert.AreEqual(60f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(40f, root_child3.LayoutHeight); - - Assert.AreEqual(140f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(30f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(30f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(30f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(30f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(60f, root_child3.LayoutY); - Assert.AreEqual(30f, root_child3.LayoutWidth); - Assert.AreEqual(40f, root_child3.LayoutHeight); - - Assert.AreEqual(30f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(30f, root_child4.LayoutWidth); - Assert.AreEqual(50f, root_child4.LayoutHeight); - } - - [Test] - public void Test_wrapped_row_within_align_items_center() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Center; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexDirection = YogaFlexDirection.Row; - root_child0.Wrap = YogaWrap.Wrap; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.Width = 150; - root_child0_child0.Height = 80; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child1 = new YogaNode(config); - root_child0_child1.Width = 80; - root_child0_child1.Height = 80; - root_child0.Insert(1, root_child0_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(160f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(150f, root_child0_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1.LayoutX); - Assert.AreEqual(80f, root_child0_child1.LayoutY); - Assert.AreEqual(80f, root_child0_child1.LayoutWidth); - Assert.AreEqual(80f, root_child0_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(160f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(150f, root_child0_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(120f, root_child0_child1.LayoutX); - Assert.AreEqual(80f, root_child0_child1.LayoutY); - Assert.AreEqual(80f, root_child0_child1.LayoutWidth); - Assert.AreEqual(80f, root_child0_child1.LayoutHeight); - } - - [Test] - public void Test_wrapped_row_within_align_items_flex_start() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.FlexStart; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexDirection = YogaFlexDirection.Row; - root_child0.Wrap = YogaWrap.Wrap; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.Width = 150; - root_child0_child0.Height = 80; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child1 = new YogaNode(config); - root_child0_child1.Width = 80; - root_child0_child1.Height = 80; - root_child0.Insert(1, root_child0_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(160f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(150f, root_child0_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1.LayoutX); - Assert.AreEqual(80f, root_child0_child1.LayoutY); - Assert.AreEqual(80f, root_child0_child1.LayoutWidth); - Assert.AreEqual(80f, root_child0_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(160f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(150f, root_child0_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(120f, root_child0_child1.LayoutX); - Assert.AreEqual(80f, root_child0_child1.LayoutY); - Assert.AreEqual(80f, root_child0_child1.LayoutWidth); - Assert.AreEqual(80f, root_child0_child1.LayoutHeight); - } - - [Test] - public void Test_wrapped_row_within_align_items_flex_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.FlexEnd; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexDirection = YogaFlexDirection.Row; - root_child0.Wrap = YogaWrap.Wrap; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.Width = 150; - root_child0_child0.Height = 80; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child1 = new YogaNode(config); - root_child0_child1.Width = 80; - root_child0_child1.Height = 80; - root_child0.Insert(1, root_child0_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(160f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(150f, root_child0_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1.LayoutX); - Assert.AreEqual(80f, root_child0_child1.LayoutY); - Assert.AreEqual(80f, root_child0_child1.LayoutWidth); - Assert.AreEqual(80f, root_child0_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(160f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(150f, root_child0_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(120f, root_child0_child1.LayoutX); - Assert.AreEqual(80f, root_child0_child1.LayoutY); - Assert.AreEqual(80f, root_child0_child1.LayoutWidth); - Assert.AreEqual(80f, root_child0_child1.LayoutHeight); - } - - [Test] - public void Test_wrapped_column_max_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.AlignContent = YogaAlign.Center; - root.AlignItems = YogaAlign.Center; - root.Wrap = YogaWrap.Wrap; - root.Width = 700; - root.Height = 500; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 100; - root_child0.Height = 500; - root_child0.MaxHeight = 200; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.MarginLeft = 20; - root_child1.MarginTop = 20; - root_child1.MarginRight = 20; - root_child1.MarginBottom = 20; - root_child1.Width = 200; - root_child1.Height = 200; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 100; - root_child2.Height = 100; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(700f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(250f, root_child0.LayoutX); - Assert.AreEqual(30f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0.LayoutHeight); - - Assert.AreEqual(200f, root_child1.LayoutX); - Assert.AreEqual(250f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(200f, root_child1.LayoutHeight); - - Assert.AreEqual(420f, root_child2.LayoutX); - Assert.AreEqual(200f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(700f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(350f, root_child0.LayoutX); - Assert.AreEqual(30f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0.LayoutHeight); - - Assert.AreEqual(300f, root_child1.LayoutX); - Assert.AreEqual(250f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(200f, root_child1.LayoutHeight); - - Assert.AreEqual(180f, root_child2.LayoutX); - Assert.AreEqual(200f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_wrapped_column_max_height_flex() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.AlignContent = YogaAlign.Center; - root.AlignItems = YogaAlign.Center; - root.Wrap = YogaWrap.Wrap; - root.Width = 700; - root.Height = 500; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexShrink = 1; - root_child0.FlexBasis = 0.Percent(); - root_child0.Width = 100; - root_child0.Height = 500; - root_child0.MaxHeight = 200; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.FlexShrink = 1; - root_child1.FlexBasis = 0.Percent(); - root_child1.MarginLeft = 20; - root_child1.MarginTop = 20; - root_child1.MarginRight = 20; - root_child1.MarginBottom = 20; - root_child1.Width = 200; - root_child1.Height = 200; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 100; - root_child2.Height = 100; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(700f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(300f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(180f, root_child0.LayoutHeight); - - Assert.AreEqual(250f, root_child1.LayoutX); - Assert.AreEqual(200f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(180f, root_child1.LayoutHeight); - - Assert.AreEqual(300f, root_child2.LayoutX); - Assert.AreEqual(400f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(700f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(300f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(180f, root_child0.LayoutHeight); - - Assert.AreEqual(250f, root_child1.LayoutX); - Assert.AreEqual(200f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(180f, root_child1.LayoutHeight); - - Assert.AreEqual(300f, root_child2.LayoutX); - Assert.AreEqual(400f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_wrap_nodes_with_content_sizing_overflowing_margin() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 500; - root.Height = 500; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexDirection = YogaFlexDirection.Row; - root_child0.Wrap = YogaWrap.Wrap; - root_child0.Width = 85; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0.Width = 40; - root_child0_child0_child0.Height = 40; - root_child0_child0.Insert(0, root_child0_child0_child0); - - YogaNode root_child0_child1 = new YogaNode(config); - root_child0_child1.MarginRight = 10; - root_child0.Insert(1, root_child0_child1); - - YogaNode root_child0_child1_child0 = new YogaNode(config); - root_child0_child1_child0.Width = 40; - root_child0_child1_child0.Height = 40; - root_child0_child1.Insert(0, root_child0_child1_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(85f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(40f, root_child0_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(40f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1.LayoutX); - Assert.AreEqual(40f, root_child0_child1.LayoutY); - Assert.AreEqual(40f, root_child0_child1.LayoutWidth); - Assert.AreEqual(40f, root_child0_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child1_child0.LayoutY); - Assert.AreEqual(40f, root_child0_child1_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0_child1_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(415f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(85f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - - Assert.AreEqual(45f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(40f, root_child0_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(40f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(35f, root_child0_child1.LayoutX); - Assert.AreEqual(40f, root_child0_child1.LayoutY); - Assert.AreEqual(40f, root_child0_child1.LayoutWidth); - Assert.AreEqual(40f, root_child0_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child1_child0.LayoutY); - Assert.AreEqual(40f, root_child0_child1_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0_child1_child0.LayoutHeight); - } - - [Test] - public void Test_wrap_nodes_with_content_sizing_margin_cross() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 500; - root.Height = 500; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexDirection = YogaFlexDirection.Row; - root_child0.Wrap = YogaWrap.Wrap; - root_child0.Width = 70; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0.Width = 40; - root_child0_child0_child0.Height = 40; - root_child0_child0.Insert(0, root_child0_child0_child0); - - YogaNode root_child0_child1 = new YogaNode(config); - root_child0_child1.MarginTop = 10; - root_child0.Insert(1, root_child0_child1); - - YogaNode root_child0_child1_child0 = new YogaNode(config); - root_child0_child1_child0.Width = 40; - root_child0_child1_child0.Height = 40; - root_child0_child1.Insert(0, root_child0_child1_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(70f, root_child0.LayoutWidth); - Assert.AreEqual(90f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(40f, root_child0_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(40f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1.LayoutX); - Assert.AreEqual(50f, root_child0_child1.LayoutY); - Assert.AreEqual(40f, root_child0_child1.LayoutWidth); - Assert.AreEqual(40f, root_child0_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child1_child0.LayoutY); - Assert.AreEqual(40f, root_child0_child1_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0_child1_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(430f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(70f, root_child0.LayoutWidth); - Assert.AreEqual(90f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(40f, root_child0_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(40f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child0_child1.LayoutX); - Assert.AreEqual(50f, root_child0_child1.LayoutY); - Assert.AreEqual(40f, root_child0_child1.LayoutWidth); - Assert.AreEqual(40f, root_child0_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child1_child0.LayoutY); - Assert.AreEqual(40f, root_child0_child1_child0.LayoutWidth); - Assert.AreEqual(40f, root_child0_child1_child0.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGGapTest.cs b/csharp/tests/Facebook.Yoga/YGGapTest.cs deleted file mode 100644 index fb258ae177..0000000000 --- a/csharp/tests/Facebook.Yoga/YGGapTest.cs +++ /dev/null @@ -1,2166 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGGapTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGGapTest - { - [Test] - public void Test_column_gap_flexible() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 80; - root.Height = 100; - root.ColumnGap = 10; - root.RowGap = 20; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexShrink = 1; - root_child0.FlexBasis = 0.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.FlexShrink = 1; - root_child1.FlexBasis = 0.Percent(); - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root_child2.FlexShrink = 1; - root_child2.FlexBasis = 0.Percent(); - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(80f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(80f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(60f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_column_gap_inflexible() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 80; - root.Height = 100; - root.ColumnGap = 10; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(80f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(80f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(60f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_column_gap_mixed_flexible() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 80; - root.Height = 100; - root.ColumnGap = 10; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.FlexShrink = 1; - root_child1.FlexBasis = 0.Percent(); - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(80f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(80f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(60f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_column_gap_child_margins() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 80; - root.Height = 100; - root.ColumnGap = 10; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexShrink = 1; - root_child0.FlexBasis = 0.Percent(); - root_child0.MarginLeft = 2; - root_child0.MarginRight = 2; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.FlexShrink = 1; - root_child1.FlexBasis = 0.Percent(); - root_child1.MarginLeft = 10; - root_child1.MarginRight = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root_child2.FlexShrink = 1; - root_child2.FlexBasis = 0.Percent(); - root_child2.MarginLeft = 15; - root_child2.MarginRight = 15; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(80f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(2f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(2f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(26f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(2f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(63f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(2f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(80f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(76f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(2f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(52f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(2f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(15f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(2f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_column_row_gap_wrapping() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Wrap = YogaWrap.Wrap; - root.Width = 80; - root.ColumnGap = 10; - root.RowGap = 20; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root_child0.Height = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root_child2.Height = 20; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 20; - root_child3.Height = 20; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 20; - root_child4.Height = 20; - root.Insert(4, root_child4); - - YogaNode root_child5 = new YogaNode(config); - root_child5.Width = 20; - root_child5.Height = 20; - root.Insert(5, root_child5); - - YogaNode root_child6 = new YogaNode(config); - root_child6.Width = 20; - root_child6.Height = 20; - root.Insert(6, root_child6); - - YogaNode root_child7 = new YogaNode(config); - root_child7.Width = 20; - root_child7.Height = 20; - root.Insert(7, root_child7); - - YogaNode root_child8 = new YogaNode(config); - root_child8.Width = 20; - root_child8.Height = 20; - root.Insert(8, root_child8); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(80f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(40f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(30f, root_child4.LayoutX); - Assert.AreEqual(40f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - - Assert.AreEqual(60f, root_child5.LayoutX); - Assert.AreEqual(40f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(20f, root_child5.LayoutHeight); - - Assert.AreEqual(0f, root_child6.LayoutX); - Assert.AreEqual(80f, root_child6.LayoutY); - Assert.AreEqual(20f, root_child6.LayoutWidth); - Assert.AreEqual(20f, root_child6.LayoutHeight); - - Assert.AreEqual(30f, root_child7.LayoutX); - Assert.AreEqual(80f, root_child7.LayoutY); - Assert.AreEqual(20f, root_child7.LayoutWidth); - Assert.AreEqual(20f, root_child7.LayoutHeight); - - Assert.AreEqual(60f, root_child8.LayoutX); - Assert.AreEqual(80f, root_child8.LayoutY); - Assert.AreEqual(20f, root_child8.LayoutWidth); - Assert.AreEqual(20f, root_child8.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(80f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(60f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(60f, root_child3.LayoutX); - Assert.AreEqual(40f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(30f, root_child4.LayoutX); - Assert.AreEqual(40f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - - Assert.AreEqual(0f, root_child5.LayoutX); - Assert.AreEqual(40f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(20f, root_child5.LayoutHeight); - - Assert.AreEqual(60f, root_child6.LayoutX); - Assert.AreEqual(80f, root_child6.LayoutY); - Assert.AreEqual(20f, root_child6.LayoutWidth); - Assert.AreEqual(20f, root_child6.LayoutHeight); - - Assert.AreEqual(30f, root_child7.LayoutX); - Assert.AreEqual(80f, root_child7.LayoutY); - Assert.AreEqual(20f, root_child7.LayoutWidth); - Assert.AreEqual(20f, root_child7.LayoutHeight); - - Assert.AreEqual(0f, root_child8.LayoutX); - Assert.AreEqual(80f, root_child8.LayoutY); - Assert.AreEqual(20f, root_child8.LayoutWidth); - Assert.AreEqual(20f, root_child8.LayoutHeight); - } - - [Test] - public void Test_column_gap_justify_flex_start() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - root.ColumnGap = 10; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(20f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_column_gap_justify_center() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.JustifyContent = YogaJustify.Center; - root.Width = 100; - root.Height = 100; - root.ColumnGap = 10; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(70f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(70f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(10f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_column_gap_justify_flex_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.JustifyContent = YogaJustify.FlexEnd; - root.Width = 100; - root.Height = 100; - root.ColumnGap = 10; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(20f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(80f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(60f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_column_gap_justify_space_between() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.JustifyContent = YogaJustify.SpaceBetween; - root.Width = 100; - root.Height = 100; - root.ColumnGap = 10; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(80f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_column_gap_justify_space_around() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.JustifyContent = YogaJustify.SpaceAround; - root.Width = 100; - root.Height = 100; - root.ColumnGap = 10; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(3f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(77f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(77f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(3f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_column_gap_justify_space_evenly() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.JustifyContent = YogaJustify.SpaceEvenly; - root.Width = 100; - root.Height = 100; - root.ColumnGap = 10; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(5f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(75f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(5f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_column_gap_wrap_align_flex_start() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 100; - root.ColumnGap = 10; - root.RowGap = 20; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root_child0.Height = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root_child2.Height = 20; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 20; - root_child3.Height = 20; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 20; - root_child4.Height = 20; - root.Insert(4, root_child4); - - YogaNode root_child5 = new YogaNode(config); - root_child5.Width = 20; - root_child5.Height = 20; - root.Insert(5, root_child5); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(40f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(30f, root_child4.LayoutX); - Assert.AreEqual(40f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - - Assert.AreEqual(60f, root_child5.LayoutX); - Assert.AreEqual(40f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(20f, root_child5.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(20f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(80f, root_child3.LayoutX); - Assert.AreEqual(40f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(40f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - - Assert.AreEqual(20f, root_child5.LayoutX); - Assert.AreEqual(40f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(20f, root_child5.LayoutHeight); - } - - [Test] - public void Test_column_gap_wrap_align_center() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.Center; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 100; - root.ColumnGap = 10; - root.RowGap = 20; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root_child0.Height = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root_child2.Height = 20; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 20; - root_child3.Height = 20; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 20; - root_child4.Height = 20; - root.Insert(4, root_child4); - - YogaNode root_child5 = new YogaNode(config); - root_child5.Width = 20; - root_child5.Height = 20; - root.Insert(5, root_child5); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(20f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(20f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(60f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(30f, root_child4.LayoutX); - Assert.AreEqual(60f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - - Assert.AreEqual(60f, root_child5.LayoutX); - Assert.AreEqual(60f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(20f, root_child5.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(20f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(20f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(20f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(80f, root_child3.LayoutX); - Assert.AreEqual(60f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(60f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - - Assert.AreEqual(20f, root_child5.LayoutX); - Assert.AreEqual(60f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(20f, root_child5.LayoutHeight); - } - - [Test] - public void Test_column_gap_wrap_align_flex_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.FlexEnd; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 100; - root.ColumnGap = 10; - root.RowGap = 20; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root_child0.Height = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root_child2.Height = 20; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 20; - root_child3.Height = 20; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 20; - root_child4.Height = 20; - root.Insert(4, root_child4); - - YogaNode root_child5 = new YogaNode(config); - root_child5.Width = 20; - root_child5.Height = 20; - root.Insert(5, root_child5); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(40f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(40f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(80f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(30f, root_child4.LayoutX); - Assert.AreEqual(80f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - - Assert.AreEqual(60f, root_child5.LayoutX); - Assert.AreEqual(80f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(20f, root_child5.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(40f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(40f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(20f, root_child2.LayoutX); - Assert.AreEqual(40f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(80f, root_child3.LayoutX); - Assert.AreEqual(80f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(80f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - - Assert.AreEqual(20f, root_child5.LayoutX); - Assert.AreEqual(80f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(20f, root_child5.LayoutHeight); - } - - [Test] - public void Test_column_gap_wrap_align_space_between() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.SpaceBetween; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 100; - root.ColumnGap = 10; - root.RowGap = 20; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root_child0.Height = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root_child2.Height = 20; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 20; - root_child3.Height = 20; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 20; - root_child4.Height = 20; - root.Insert(4, root_child4); - - YogaNode root_child5 = new YogaNode(config); - root_child5.Width = 20; - root_child5.Height = 20; - root.Insert(5, root_child5); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(80f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(30f, root_child4.LayoutX); - Assert.AreEqual(80f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - - Assert.AreEqual(60f, root_child5.LayoutX); - Assert.AreEqual(80f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(20f, root_child5.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(20f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(80f, root_child3.LayoutX); - Assert.AreEqual(80f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(80f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - - Assert.AreEqual(20f, root_child5.LayoutX); - Assert.AreEqual(80f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(20f, root_child5.LayoutHeight); - } - - [Test] - public void Test_column_gap_wrap_align_space_around() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.SpaceAround; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 100; - root.ColumnGap = 10; - root.RowGap = 20; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root_child0.Height = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root_child2.Height = 20; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 20; - root_child3.Height = 20; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 20; - root_child4.Height = 20; - root.Insert(4, root_child4); - - YogaNode root_child5 = new YogaNode(config); - root_child5.Width = 20; - root_child5.Height = 20; - root.Insert(5, root_child5); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(10f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(70f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(30f, root_child4.LayoutX); - Assert.AreEqual(70f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - - Assert.AreEqual(60f, root_child5.LayoutX); - Assert.AreEqual(70f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(20f, root_child5.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(20f, root_child2.LayoutX); - Assert.AreEqual(10f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(20f, root_child2.LayoutHeight); - - Assert.AreEqual(80f, root_child3.LayoutX); - Assert.AreEqual(70f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(20f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(70f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(20f, root_child4.LayoutHeight); - - Assert.AreEqual(20f, root_child5.LayoutX); - Assert.AreEqual(70f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(20f, root_child5.LayoutHeight); - } - - [Test] - public void Test_column_gap_wrap_align_stretch() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.Stretch; - root.Wrap = YogaWrap.Wrap; - root.Width = 300; - root.Height = 300; - root.ColumnGap = 5; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MinWidth = 60; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.MinWidth = 60; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root_child2.MinWidth = 60; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.FlexGrow = 1; - root_child3.MinWidth = 60; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.FlexGrow = 1; - root_child4.MinWidth = 60; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(300f, root.LayoutWidth); - Assert.AreEqual(300f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(71f, root_child0.LayoutWidth); - Assert.AreEqual(150f, root_child0.LayoutHeight); - - Assert.AreEqual(76f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(72f, root_child1.LayoutWidth); - Assert.AreEqual(150f, root_child1.LayoutHeight); - - Assert.AreEqual(153f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(71f, root_child2.LayoutWidth); - Assert.AreEqual(150f, root_child2.LayoutHeight); - - Assert.AreEqual(229f, root_child3.LayoutX); - Assert.AreEqual(0f, root_child3.LayoutY); - Assert.AreEqual(71f, root_child3.LayoutWidth); - Assert.AreEqual(150f, root_child3.LayoutHeight); - - Assert.AreEqual(0f, root_child4.LayoutX); - Assert.AreEqual(150f, root_child4.LayoutY); - Assert.AreEqual(300f, root_child4.LayoutWidth); - Assert.AreEqual(150f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(300f, root.LayoutWidth); - Assert.AreEqual(300f, root.LayoutHeight); - - Assert.AreEqual(229f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(71f, root_child0.LayoutWidth); - Assert.AreEqual(150f, root_child0.LayoutHeight); - - Assert.AreEqual(153f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(71f, root_child1.LayoutWidth); - Assert.AreEqual(150f, root_child1.LayoutHeight); - - Assert.AreEqual(76f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(72f, root_child2.LayoutWidth); - Assert.AreEqual(150f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(0f, root_child3.LayoutY); - Assert.AreEqual(71f, root_child3.LayoutWidth); - Assert.AreEqual(150f, root_child3.LayoutHeight); - - Assert.AreEqual(0f, root_child4.LayoutX); - Assert.AreEqual(150f, root_child4.LayoutY); - Assert.AreEqual(300f, root_child4.LayoutWidth); - Assert.AreEqual(150f, root_child4.LayoutHeight); - } - - [Test] - public void Test_column_gap_determines_parent_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Height = 100; - root.ColumnGap = 10; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 30; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(80f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(20f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(50f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(80f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(70f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(30f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_row_gap_align_items_stretch() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignContent = YogaAlign.Stretch; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 200; - root.ColumnGap = 10; - root.RowGap = 20; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 20; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 20; - root.Insert(4, root_child4); - - YogaNode root_child5 = new YogaNode(config); - root_child5.Width = 20; - root.Insert(5, root_child5); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(90f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(90f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(90f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(110f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(90f, root_child3.LayoutHeight); - - Assert.AreEqual(30f, root_child4.LayoutX); - Assert.AreEqual(110f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(90f, root_child4.LayoutHeight); - - Assert.AreEqual(60f, root_child5.LayoutX); - Assert.AreEqual(110f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(90f, root_child5.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(90f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(90f, root_child1.LayoutHeight); - - Assert.AreEqual(20f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(90f, root_child2.LayoutHeight); - - Assert.AreEqual(80f, root_child3.LayoutX); - Assert.AreEqual(110f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(90f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(110f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(90f, root_child4.LayoutHeight); - - Assert.AreEqual(20f, root_child5.LayoutX); - Assert.AreEqual(110f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(90f, root_child5.LayoutHeight); - } - - [Test] - public void Test_row_gap_align_items_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.FlexEnd; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 200; - root.ColumnGap = 10; - root.RowGap = 20; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 20; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.Width = 20; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.Width = 20; - root.Insert(4, root_child4); - - YogaNode root_child5 = new YogaNode(config); - root_child5.Width = 20; - root.Insert(5, root_child5); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(30f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - Assert.AreEqual(60f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(0f, root_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child3.LayoutX); - Assert.AreEqual(20f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(0f, root_child3.LayoutHeight); - - Assert.AreEqual(30f, root_child4.LayoutX); - Assert.AreEqual(20f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(0f, root_child4.LayoutHeight); - - Assert.AreEqual(60f, root_child5.LayoutX); - Assert.AreEqual(20f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(0f, root_child5.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - Assert.AreEqual(20f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(20f, root_child2.LayoutWidth); - Assert.AreEqual(0f, root_child2.LayoutHeight); - - Assert.AreEqual(80f, root_child3.LayoutX); - Assert.AreEqual(20f, root_child3.LayoutY); - Assert.AreEqual(20f, root_child3.LayoutWidth); - Assert.AreEqual(0f, root_child3.LayoutHeight); - - Assert.AreEqual(50f, root_child4.LayoutX); - Assert.AreEqual(20f, root_child4.LayoutY); - Assert.AreEqual(20f, root_child4.LayoutWidth); - Assert.AreEqual(0f, root_child4.LayoutHeight); - - Assert.AreEqual(20f, root_child5.LayoutX); - Assert.AreEqual(20f, root_child5.LayoutY); - Assert.AreEqual(20f, root_child5.LayoutWidth); - Assert.AreEqual(0f, root_child5.LayoutHeight); - } - - [Test] - public void Test_row_gap_column_child_margins() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 200; - root.RowGap = 10; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexShrink = 1; - root_child0.FlexBasis = 0.Percent(); - root_child0.MarginTop = 2; - root_child0.MarginBottom = 2; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.FlexShrink = 1; - root_child1.FlexBasis = 0.Percent(); - root_child1.MarginTop = 10; - root_child1.MarginBottom = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root_child2.FlexShrink = 1; - root_child2.FlexBasis = 0.Percent(); - root_child2.MarginTop = 15; - root_child2.MarginBottom = 15; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(2f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(42f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(66f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(42f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(143f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(42f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(2f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(42f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(66f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(42f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(143f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(42f, root_child2.LayoutHeight); - } - - [Test] - public void Test_row_gap_row_wrap_child_margins() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Wrap = YogaWrap.Wrap; - root.Width = 100; - root.Height = 200; - root.RowGap = 10; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginTop = 2; - root_child0.MarginBottom = 2; - root_child0.Width = 60; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.MarginTop = 10; - root_child1.MarginBottom = 10; - root_child1.Width = 60; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.MarginTop = 15; - root_child2.MarginBottom = 15; - root_child2.Width = 60; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(2f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(24f, root_child1.LayoutY); - Assert.AreEqual(60f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(59f, root_child2.LayoutY); - Assert.AreEqual(60f, root_child2.LayoutWidth); - Assert.AreEqual(0f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(40f, root_child0.LayoutX); - Assert.AreEqual(2f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(24f, root_child1.LayoutY); - Assert.AreEqual(60f, root_child1.LayoutWidth); - Assert.AreEqual(0f, root_child1.LayoutHeight); - - Assert.AreEqual(40f, root_child2.LayoutX); - Assert.AreEqual(59f, root_child2.LayoutY); - Assert.AreEqual(60f, root_child2.LayoutWidth); - Assert.AreEqual(0f, root_child2.LayoutHeight); - } - - [Test] - public void Test_row_gap_determines_parent_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.RowGap = 10; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 20; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Height = 30; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(80f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(20f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(50f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(80f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(20f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(50f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(30f, root_child2.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGJustifyContentTest.cs b/csharp/tests/Facebook.Yoga/YGJustifyContentTest.cs deleted file mode 100644 index 5e3c516d5a..0000000000 --- a/csharp/tests/Facebook.Yoga/YGJustifyContentTest.cs +++ /dev/null @@ -1,1197 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGJustifyContentTest - { - [Test] - public void Test_justify_content_row_flex_start() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 102; - root.Height = 102; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(102f, root_child0.LayoutHeight); - - Assert.AreEqual(10f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(102f, root_child1.LayoutHeight); - - Assert.AreEqual(20f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(102f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(92f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(102f, root_child0.LayoutHeight); - - Assert.AreEqual(82f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(102f, root_child1.LayoutHeight); - - Assert.AreEqual(72f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(102f, root_child2.LayoutHeight); - } - - [Test] - public void Test_justify_content_row_flex_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.JustifyContent = YogaJustify.FlexEnd; - root.Width = 102; - root.Height = 102; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(72f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(102f, root_child0.LayoutHeight); - - Assert.AreEqual(82f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(102f, root_child1.LayoutHeight); - - Assert.AreEqual(92f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(102f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(20f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(102f, root_child0.LayoutHeight); - - Assert.AreEqual(10f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(102f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(102f, root_child2.LayoutHeight); - } - - [Test] - public void Test_justify_content_row_center() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.JustifyContent = YogaJustify.Center; - root.Width = 102; - root.Height = 102; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(36f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(102f, root_child0.LayoutHeight); - - Assert.AreEqual(46f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(102f, root_child1.LayoutHeight); - - Assert.AreEqual(56f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(102f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(56f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(102f, root_child0.LayoutHeight); - - Assert.AreEqual(46f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(102f, root_child1.LayoutHeight); - - Assert.AreEqual(36f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(102f, root_child2.LayoutHeight); - } - - [Test] - public void Test_justify_content_row_space_between() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.JustifyContent = YogaJustify.SpaceBetween; - root.Width = 102; - root.Height = 102; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(102f, root_child0.LayoutHeight); - - Assert.AreEqual(46f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(102f, root_child1.LayoutHeight); - - Assert.AreEqual(92f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(102f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(92f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(102f, root_child0.LayoutHeight); - - Assert.AreEqual(46f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(102f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(102f, root_child2.LayoutHeight); - } - - [Test] - public void Test_justify_content_row_space_around() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.JustifyContent = YogaJustify.SpaceAround; - root.Width = 102; - root.Height = 102; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(12f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(102f, root_child0.LayoutHeight); - - Assert.AreEqual(46f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(102f, root_child1.LayoutHeight); - - Assert.AreEqual(80f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(102f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(102f, root_child0.LayoutHeight); - - Assert.AreEqual(46f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(102f, root_child1.LayoutHeight); - - Assert.AreEqual(12f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(102f, root_child2.LayoutHeight); - } - - [Test] - public void Test_justify_content_column_flex_start() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 102; - root.Height = 102; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(102f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(102f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(102f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(102f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(10f, root_child1.LayoutY); - Assert.AreEqual(102f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(20f, root_child2.LayoutY); - Assert.AreEqual(102f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - } - - [Test] - public void Test_justify_content_column_flex_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.FlexEnd; - root.Width = 102; - root.Height = 102; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(72f, root_child0.LayoutY); - Assert.AreEqual(102f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(82f, root_child1.LayoutY); - Assert.AreEqual(102f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(92f, root_child2.LayoutY); - Assert.AreEqual(102f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(72f, root_child0.LayoutY); - Assert.AreEqual(102f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(82f, root_child1.LayoutY); - Assert.AreEqual(102f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(92f, root_child2.LayoutY); - Assert.AreEqual(102f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - } - - [Test] - public void Test_justify_content_column_center() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.Width = 102; - root.Height = 102; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(36f, root_child0.LayoutY); - Assert.AreEqual(102f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(46f, root_child1.LayoutY); - Assert.AreEqual(102f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(56f, root_child2.LayoutY); - Assert.AreEqual(102f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(36f, root_child0.LayoutY); - Assert.AreEqual(102f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(46f, root_child1.LayoutY); - Assert.AreEqual(102f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(56f, root_child2.LayoutY); - Assert.AreEqual(102f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - } - - [Test] - public void Test_justify_content_column_space_between() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.SpaceBetween; - root.Width = 102; - root.Height = 102; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(102f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(46f, root_child1.LayoutY); - Assert.AreEqual(102f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(92f, root_child2.LayoutY); - Assert.AreEqual(102f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(102f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(46f, root_child1.LayoutY); - Assert.AreEqual(102f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(92f, root_child2.LayoutY); - Assert.AreEqual(102f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - } - - [Test] - public void Test_justify_content_column_space_around() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.SpaceAround; - root.Width = 102; - root.Height = 102; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(12f, root_child0.LayoutY); - Assert.AreEqual(102f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(46f, root_child1.LayoutY); - Assert.AreEqual(102f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(80f, root_child2.LayoutY); - Assert.AreEqual(102f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(12f, root_child0.LayoutY); - Assert.AreEqual(102f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(46f, root_child1.LayoutY); - Assert.AreEqual(102f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(80f, root_child2.LayoutY); - Assert.AreEqual(102f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - } - - [Test] - public void Test_justify_content_row_min_width_and_margin() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.JustifyContent = YogaJustify.Center; - root.MarginLeft = 100; - root.MinWidth = 50; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root_child0.Height = 20; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(100f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(50f, root.LayoutWidth); - Assert.AreEqual(20f, root.LayoutHeight); - - Assert.AreEqual(15f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(100f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(50f, root.LayoutWidth); - Assert.AreEqual(20f, root.LayoutHeight); - - Assert.AreEqual(15f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - } - - [Test] - public void Test_justify_content_row_max_width_and_margin() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.JustifyContent = YogaJustify.Center; - root.MarginLeft = 100; - root.Width = 100; - root.MaxWidth = 80; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root_child0.Height = 20; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(100f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(80f, root.LayoutWidth); - Assert.AreEqual(20f, root.LayoutHeight); - - Assert.AreEqual(30f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(100f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(80f, root.LayoutWidth); - Assert.AreEqual(20f, root.LayoutHeight); - - Assert.AreEqual(30f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - } - - [Test] - public void Test_justify_content_column_min_height_and_margin() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.MarginTop = 100; - root.MinHeight = 50; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root_child0.Height = 20; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(100f, root.LayoutY); - Assert.AreEqual(20f, root.LayoutWidth); - Assert.AreEqual(50f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(15f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(100f, root.LayoutY); - Assert.AreEqual(20f, root.LayoutWidth); - Assert.AreEqual(50f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(15f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - } - - [Test] - public void Test_justify_content_colunn_max_height_and_margin() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.MarginTop = 100; - root.Height = 100; - root.MaxHeight = 80; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 20; - root_child0.Height = 20; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(100f, root.LayoutY); - Assert.AreEqual(20f, root.LayoutWidth); - Assert.AreEqual(80f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(30f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(100f, root.LayoutY); - Assert.AreEqual(20f, root.LayoutWidth); - Assert.AreEqual(80f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(30f, root_child0.LayoutY); - Assert.AreEqual(20f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - } - - [Test] - public void Test_justify_content_column_space_evenly() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.SpaceEvenly; - root.Width = 102; - root.Height = 102; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(18f, root_child0.LayoutY); - Assert.AreEqual(102f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(46f, root_child1.LayoutY); - Assert.AreEqual(102f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(74f, root_child2.LayoutY); - Assert.AreEqual(102f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(18f, root_child0.LayoutY); - Assert.AreEqual(102f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(46f, root_child1.LayoutY); - Assert.AreEqual(102f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(74f, root_child2.LayoutY); - Assert.AreEqual(102f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - } - - [Test] - public void Test_justify_content_row_space_evenly() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.JustifyContent = YogaJustify.SpaceEvenly; - root.Width = 102; - root.Height = 102; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(26f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(51f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(77f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(0f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(102f, root.LayoutWidth); - Assert.AreEqual(102f, root.LayoutHeight); - - Assert.AreEqual(77f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(51f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(26f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(0f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - } - - [Test] - public void Test_justify_content_min_width_with_padding_child_width_greater_than_parent() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignContent = YogaAlign.Stretch; - root.Width = 1000; - root.Height = 1584; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexDirection = YogaFlexDirection.Row; - root_child0.AlignContent = YogaAlign.Stretch; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexDirection = YogaFlexDirection.Row; - root_child0_child0.JustifyContent = YogaJustify.Center; - root_child0_child0.AlignContent = YogaAlign.Stretch; - root_child0_child0.PaddingLeft = 100; - root_child0_child0.PaddingRight = 100; - root_child0_child0.MinWidth = 400; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0.FlexDirection = YogaFlexDirection.Row; - root_child0_child0_child0.AlignContent = YogaAlign.Stretch; - root_child0_child0_child0.Width = 300; - root_child0_child0_child0.Height = 100; - root_child0_child0.Insert(0, root_child0_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(1000f, root.LayoutWidth); - Assert.AreEqual(1584f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(1000f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(500f, root_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(100f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(300f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(1000f, root.LayoutWidth); - Assert.AreEqual(1584f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(1000f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(500f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(500f, root_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(100f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(300f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0_child0.LayoutHeight); - } - - [Test] - public void Test_justify_content_min_width_with_padding_child_width_lower_than_parent() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignContent = YogaAlign.Stretch; - root.Width = 1080; - root.Height = 1584; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexDirection = YogaFlexDirection.Row; - root_child0.AlignContent = YogaAlign.Stretch; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexDirection = YogaFlexDirection.Row; - root_child0_child0.JustifyContent = YogaJustify.Center; - root_child0_child0.AlignContent = YogaAlign.Stretch; - root_child0_child0.PaddingLeft = 100; - root_child0_child0.PaddingRight = 100; - root_child0_child0.MinWidth = 400; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0.FlexDirection = YogaFlexDirection.Row; - root_child0_child0_child0.AlignContent = YogaAlign.Stretch; - root_child0_child0_child0.Width = 199; - root_child0_child0_child0.Height = 100; - root_child0_child0.Insert(0, root_child0_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(1080f, root.LayoutWidth); - Assert.AreEqual(1584f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(1080f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(400f, root_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(101f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(199f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(1080f, root.LayoutWidth); - Assert.AreEqual(1584f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(1080f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(680f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(400f, root_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(101f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(199f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0_child0.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGMarginTest.cs b/csharp/tests/Facebook.Yoga/YGMarginTest.cs deleted file mode 100644 index 5d9991be64..0000000000 --- a/csharp/tests/Facebook.Yoga/YGMarginTest.cs +++ /dev/null @@ -1,1791 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGMarginTest - { - [Test] - public void Test_margin_start() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginStart = 10; - root_child0.Width = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - } - - [Test] - public void Test_margin_top() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginTop = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_margin_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.JustifyContent = YogaJustify.FlexEnd; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginEnd = 10; - root_child0.Width = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - } - - [Test] - public void Test_margin_bottom() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.FlexEnd; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginBottom = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(80f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(80f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_margin_and_flex_row() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MarginStart = 10; - root_child0.MarginEnd = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(80f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(80f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - } - - [Test] - public void Test_margin_and_flex_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MarginTop = 10; - root_child0.MarginBottom = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - } - - [Test] - public void Test_margin_and_stretch_row() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MarginTop = 10; - root_child0.MarginBottom = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - } - - [Test] - public void Test_margin_and_stretch_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MarginStart = 10; - root_child0.MarginEnd = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(80f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(80f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - } - - [Test] - public void Test_margin_with_sibling_row() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MarginEnd = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(45f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(55f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(45f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(55f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(45f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(45f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_with_sibling_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MarginBottom = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(45f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(55f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(45f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(45f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(55f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(45f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_auto_bottom() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Center; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginBottom = YogaValue.Auto(); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(150f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(150f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_auto_top() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Center; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginTop = YogaValue.Auto(); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(100f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(150f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(100f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(150f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_auto_bottom_and_top() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Center; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginTop = YogaValue.Auto(); - root_child0.MarginBottom = YogaValue.Auto(); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(50f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(150f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(50f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(150f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_auto_bottom_and_top_justify_center() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginTop = YogaValue.Auto(); - root_child0.MarginBottom = YogaValue.Auto(); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(50f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(150f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(150f, root_child0.LayoutX); - Assert.AreEqual(50f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(150f, root_child1.LayoutX); - Assert.AreEqual(150f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_auto_mutiple_children_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Center; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginTop = YogaValue.Auto(); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.MarginTop = YogaValue.Auto(); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root_child2.Height = 50; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(25f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(100f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(75f, root_child2.LayoutX); - Assert.AreEqual(150f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(25f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(100f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(75f, root_child2.LayoutX); - Assert.AreEqual(150f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - } - - [Test] - public void Test_margin_auto_mutiple_children_row() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Center; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginRight = YogaValue.Auto(); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.MarginRight = YogaValue.Auto(); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root_child2.Height = 50; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(75f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(75f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(150f, root_child2.LayoutX); - Assert.AreEqual(75f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(125f, root_child0.LayoutX); - Assert.AreEqual(75f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(75f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(75f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - } - - [Test] - public void Test_margin_auto_left_and_right_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Center; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginLeft = YogaValue.Auto(); - root_child0.MarginRight = YogaValue.Auto(); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(75f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(150f, root_child1.LayoutX); - Assert.AreEqual(75f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(75f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(75f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_auto_left_and_right() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginLeft = YogaValue.Auto(); - root_child0.MarginRight = YogaValue.Auto(); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(150f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_auto_start_and_end_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.Center; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginStart = YogaValue.Auto(); - root_child0.MarginEnd = YogaValue.Auto(); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(75f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(150f, root_child1.LayoutX); - Assert.AreEqual(75f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(75f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(75f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_auto_start_and_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginStart = YogaValue.Auto(); - root_child0.MarginEnd = YogaValue.Auto(); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(150f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_auto_left_and_right_column_and_center() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Center; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginLeft = YogaValue.Auto(); - root_child0.MarginRight = YogaValue.Auto(); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_auto_left() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Center; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginLeft = YogaValue.Auto(); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(150f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(150f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_auto_right() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Center; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginRight = YogaValue.Auto(); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_auto_left_and_right_stretch() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginLeft = YogaValue.Auto(); - root_child0.MarginRight = YogaValue.Auto(); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(150f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_auto_top_and_bottom_stretch() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginTop = YogaValue.Auto(); - root_child0.MarginBottom = YogaValue.Auto(); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(50f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(150f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(150f, root_child0.LayoutX); - Assert.AreEqual(50f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(150f, root_child1.LayoutX); - Assert.AreEqual(150f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_should_not_be_part_of_max_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 250; - root.Height = 250; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginTop = 20; - root_child0.Width = 100; - root_child0.Height = 100; - root_child0.MaxHeight = 100; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(250f, root.LayoutWidth); - Assert.AreEqual(250f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(20f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(250f, root.LayoutWidth); - Assert.AreEqual(250f, root.LayoutHeight); - - Assert.AreEqual(150f, root_child0.LayoutX); - Assert.AreEqual(20f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - } - - [Test] - public void Test_margin_should_not_be_part_of_max_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 250; - root.Height = 250; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginLeft = 20; - root_child0.Width = 100; - root_child0.MaxWidth = 100; - root_child0.Height = 100; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(250f, root.LayoutWidth); - Assert.AreEqual(250f, root.LayoutHeight); - - Assert.AreEqual(20f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(250f, root.LayoutWidth); - Assert.AreEqual(250f, root.LayoutHeight); - - Assert.AreEqual(150f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - } - - [Test] - public void Test_margin_auto_left_right_child_bigger_than_parent() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.Width = 52; - root.Height = 52; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginLeft = YogaValue.Auto(); - root_child0.MarginRight = YogaValue.Auto(); - root_child0.Width = 72; - root_child0.Height = 72; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(-10f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(-20f, root_child0.LayoutX); - Assert.AreEqual(-10f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0.LayoutHeight); - } - - [Test] - public void Test_margin_auto_left_child_bigger_than_parent() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.Width = 52; - root.Height = 52; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginLeft = YogaValue.Auto(); - root_child0.Width = 72; - root_child0.Height = 72; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(-10f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(-20f, root_child0.LayoutX); - Assert.AreEqual(-10f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0.LayoutHeight); - } - - [Test] - public void Test_margin_fix_left_auto_right_child_bigger_than_parent() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.Width = 52; - root.Height = 52; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginLeft = 10; - root_child0.MarginRight = YogaValue.Auto(); - root_child0.Width = 72; - root_child0.Height = 72; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(-10f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(-20f, root_child0.LayoutX); - Assert.AreEqual(-10f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0.LayoutHeight); - } - - [Test] - public void Test_margin_auto_left_fix_right_child_bigger_than_parent() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.Width = 52; - root.Height = 52; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MarginLeft = YogaValue.Auto(); - root_child0.MarginRight = 10; - root_child0.Width = 72; - root_child0.Height = 72; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(-10f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(52f, root.LayoutWidth); - Assert.AreEqual(52f, root.LayoutHeight); - - Assert.AreEqual(-30f, root_child0.LayoutX); - Assert.AreEqual(-10f, root_child0.LayoutY); - Assert.AreEqual(72f, root_child0.LayoutWidth); - Assert.AreEqual(72f, root_child0.LayoutHeight); - } - - [Test] - public void Test_margin_auto_top_stretching_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Center; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexShrink = 1; - root_child0.FlexBasis = 0.Percent(); - root_child0.MarginTop = YogaValue.Auto(); - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(150f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(150f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(150f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(150f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_margin_auto_left_stretching_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Center; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexShrink = 1; - root_child0.FlexBasis = 0.Percent(); - root_child0.MarginLeft = YogaValue.Auto(); - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(200f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(150f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(150f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(200f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(150f, root_child0.LayoutHeight); - - Assert.AreEqual(75f, root_child1.LayoutX); - Assert.AreEqual(150f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGMinMaxDimensionTest.cs b/csharp/tests/Facebook.Yoga/YGMinMaxDimensionTest.cs deleted file mode 100644 index 30b782b4a6..0000000000 --- a/csharp/tests/Facebook.Yoga/YGMinMaxDimensionTest.cs +++ /dev/null @@ -1,1359 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGMinMaxDimensionTest - { - [Test] - public void Test_max_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MaxWidth = 50; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_max_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root_child0.MaxHeight = 50; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(90f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - } - - [Test] - [Ignore] - public void Test_min_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MinHeight = 60; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(60f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(40f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(60f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(40f, root_child1.LayoutHeight); - } - - [Test] - [Ignore] - public void Test_min_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MinWidth = 60; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(60f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(40f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(40f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(40f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - } - - [Test] - public void Test_justify_content_min_max() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.Width = 100; - root.MinHeight = 100; - root.MaxHeight = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 60; - root_child0.Height = 60; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(20f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(40f, root_child0.LayoutX); - Assert.AreEqual(20f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - } - - [Test] - public void Test_align_items_min_max() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.Center; - root.MinWidth = 100; - root.MaxWidth = 200; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 60; - root_child0.Height = 60; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(20f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(20f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - } - - [Test] - public void Test_justify_content_overflow_min_max() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.MinHeight = 100; - root.MaxHeight = 110; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50; - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root_child1.Height = 50; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 50; - root_child2.Height = 50; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(50f, root.LayoutWidth); - Assert.AreEqual(110f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(-20f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(30f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(80f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(50f, root.LayoutWidth); - Assert.AreEqual(110f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(-20f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(30f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(80f, root_child2.LayoutY); - Assert.AreEqual(50f, root_child2.LayoutWidth); - Assert.AreEqual(50f, root_child2.LayoutHeight); - } - - [Test] - public void Test_flex_grow_to_min() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.MinHeight = 100; - root.MaxHeight = 500; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexShrink = 1; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_flex_grow_in_at_most_container() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.AlignItems = YogaAlign.FlexStart; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexDirection = YogaFlexDirection.Row; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexGrow = 1; - root_child0_child0.FlexBasis = 0; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(0f, root_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(0f, root_child0_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0_child0.LayoutHeight); - } - - [Test] - public void Test_flex_grow_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 0; - root_child0.Height = 100; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(0f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(0f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - } - - [Test] - public void Test_flex_grow_within_constrained_min_max_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.MinHeight = 100; - root.MaxHeight = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(0f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(0f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_flex_grow_within_max_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexDirection = YogaFlexDirection.Row; - root_child0.MaxWidth = 100; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexGrow = 1; - root_child0_child0.Height = 20; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0_child0.LayoutHeight); - } - - [Test] - public void Test_flex_grow_within_constrained_max_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexDirection = YogaFlexDirection.Row; - root_child0.MaxWidth = 300; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexGrow = 1; - root_child0_child0.Height = 20; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(200f, root_child0_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(200f, root_child0_child0.LayoutWidth); - Assert.AreEqual(20f, root_child0_child0.LayoutHeight); - } - - [Test] - public void Test_flex_root_ignored() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexGrow = 1; - root.Width = 100; - root.MinHeight = 100; - root.MaxHeight = 500; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 200; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 100; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(300f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(200f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(300f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(200f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - } - - [Test] - public void Test_flex_grow_root_minimized() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.MinHeight = 100; - root.MaxHeight = 500; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MinHeight = 100; - root_child0.MaxHeight = 500; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexGrow = 1; - root_child0_child0.FlexBasis = 200; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child1 = new YogaNode(config); - root_child0_child1.Height = 100; - root_child0.Insert(1, root_child0_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(300f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(300f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1.LayoutX); - Assert.AreEqual(200f, root_child0_child1.LayoutY); - Assert.AreEqual(100f, root_child0_child1.LayoutWidth); - Assert.AreEqual(100f, root_child0_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(300f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(300f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1.LayoutX); - Assert.AreEqual(200f, root_child0_child1.LayoutY); - Assert.AreEqual(100f, root_child0_child1.LayoutWidth); - Assert.AreEqual(100f, root_child0_child1.LayoutHeight); - } - - [Test] - public void Test_flex_grow_height_maximized() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 500; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MinHeight = 100; - root_child0.MaxHeight = 500; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexGrow = 1; - root_child0_child0.FlexBasis = 200; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child1 = new YogaNode(config); - root_child0_child1.Height = 100; - root_child0.Insert(1, root_child0_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(500f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(400f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1.LayoutX); - Assert.AreEqual(400f, root_child0_child1.LayoutY); - Assert.AreEqual(100f, root_child0_child1.LayoutWidth); - Assert.AreEqual(100f, root_child0_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(500f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(400f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1.LayoutX); - Assert.AreEqual(400f, root_child0_child1.LayoutY); - Assert.AreEqual(100f, root_child0_child1.LayoutWidth); - Assert.AreEqual(100f, root_child0_child1.LayoutHeight); - } - - [Test] - public void Test_flex_grow_within_constrained_min_row() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.MinWidth = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Width = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(50f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(50f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - } - - [Test] - public void Test_flex_grow_within_constrained_min_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.MinHeight = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(0f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(0f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(0f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_flex_grow_within_constrained_max_row() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexDirection = YogaFlexDirection.Row; - root_child0.MaxWidth = 100; - root_child0.Height = 100; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexShrink = 1; - root_child0_child0.FlexBasis = 100; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child1 = new YogaNode(config); - root_child0_child1.Width = 50; - root_child0.Insert(1, root_child0_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(50f, root_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child0_child1.LayoutX); - Assert.AreEqual(0f, root_child0_child1.LayoutY); - Assert.AreEqual(50f, root_child0_child1.LayoutWidth); - Assert.AreEqual(100f, root_child0_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(50f, root_child0_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1.LayoutX); - Assert.AreEqual(0f, root_child0_child1.LayoutY); - Assert.AreEqual(50f, root_child0_child1.LayoutWidth); - Assert.AreEqual(100f, root_child0_child1.LayoutHeight); - } - - [Test] - public void Test_flex_grow_within_constrained_max_column() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.MaxHeight = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexShrink = 1; - root_child0.FlexBasis = 100; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.Height = 50; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_child_min_max_width_flexing() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 120; - root.Height = 50; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 0; - root_child0.MinWidth = 60; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.FlexBasis = 50.Percent(); - root_child1.MaxWidth = 20; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(120f, root.LayoutWidth); - Assert.AreEqual(50f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(100f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(120f, root.LayoutWidth); - Assert.AreEqual(50f, root.LayoutHeight); - - Assert.AreEqual(20f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(50f, root_child1.LayoutHeight); - } - - [Test] - public void Test_min_width_overrides_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 50; - root.MinWidth = 100; - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(0f, root.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(0f, root.LayoutHeight); - } - - [Test] - public void Test_max_width_overrides_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.MaxWidth = 100; - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(0f, root.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(0f, root.LayoutHeight); - } - - [Test] - public void Test_min_height_overrides_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Height = 50; - root.MinHeight = 100; - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(0f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(0f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - } - - [Test] - public void Test_max_height_overrides_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Height = 200; - root.MaxHeight = 100; - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(0f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(0f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - } - - [Test] - public void Test_min_max_percent_no_width_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.AlignItems = YogaAlign.FlexStart; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.MinWidth = 10.Percent(); - root_child0.MaxWidth = 10.Percent(); - root_child0.MinHeight = 10.Percent(); - root_child0.MaxHeight = 10.Percent(); - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(90f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGPaddingTest.cs b/csharp/tests/Facebook.Yoga/YGPaddingTest.cs deleted file mode 100644 index 8f44c6a3f9..0000000000 --- a/csharp/tests/Facebook.Yoga/YGPaddingTest.cs +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGPaddingTest - { - [Test] - public void Test_padding_no_size() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.PaddingLeft = 10; - root.PaddingTop = 10; - root.PaddingRight = 10; - root.PaddingBottom = 10; - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(20f, root.LayoutWidth); - Assert.AreEqual(20f, root.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(20f, root.LayoutWidth); - Assert.AreEqual(20f, root.LayoutHeight); - } - - [Test] - public void Test_padding_container_match_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.PaddingLeft = 10; - root.PaddingTop = 10; - root.PaddingRight = 10; - root.PaddingBottom = 10; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(30f, root.LayoutWidth); - Assert.AreEqual(30f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(30f, root.LayoutWidth); - Assert.AreEqual(30f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_padding_flex_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.PaddingLeft = 10; - root.PaddingTop = 10; - root.PaddingRight = 10; - root.PaddingBottom = 10; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.Width = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - } - - [Test] - public void Test_padding_stretch_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.PaddingLeft = 10; - root.PaddingTop = 10; - root.PaddingRight = 10; - root.PaddingBottom = 10; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(80f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(10f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(80f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_padding_center_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.AlignItems = YogaAlign.Center; - root.PaddingStart = 10; - root.PaddingEnd = 20; - root.PaddingBottom = 20; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(40f, root_child0.LayoutX); - Assert.AreEqual(35f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(35f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_child_with_padding_align_end() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.FlexEnd; - root.AlignItems = YogaAlign.FlexEnd; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PaddingLeft = 20; - root_child0.PaddingTop = 20; - root_child0.PaddingRight = 20; - root_child0.PaddingBottom = 20; - root_child0.Width = 100; - root_child0.Height = 100; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(100f, root_child0.LayoutX); - Assert.AreEqual(100f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(100f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGPercentageTest.cs b/csharp/tests/Facebook.Yoga/YGPercentageTest.cs deleted file mode 100644 index 2ae950e734..0000000000 --- a/csharp/tests/Facebook.Yoga/YGPercentageTest.cs +++ /dev/null @@ -1,1243 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGPercentageTest - { - [Test] - public void Test_percentage_width_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 30.Percent(); - root_child0.Height = 30.Percent(); - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(140f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - } - - [Test] - public void Test_percentage_position_left_top() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 400; - root.Height = 400; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Left = 10.Percent(); - root_child0.Top = 20.Percent(); - root_child0.Width = 45.Percent(); - root_child0.Height = 55.Percent(); - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(400f, root.LayoutWidth); - Assert.AreEqual(400f, root.LayoutHeight); - - Assert.AreEqual(40f, root_child0.LayoutX); - Assert.AreEqual(80f, root_child0.LayoutY); - Assert.AreEqual(180f, root_child0.LayoutWidth); - Assert.AreEqual(220f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(400f, root.LayoutWidth); - Assert.AreEqual(400f, root.LayoutHeight); - - Assert.AreEqual(260f, root_child0.LayoutX); - Assert.AreEqual(80f, root_child0.LayoutY); - Assert.AreEqual(180f, root_child0.LayoutWidth); - Assert.AreEqual(220f, root_child0.LayoutHeight); - } - - [Test] - public void Test_percentage_position_bottom_right() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 500; - root.Height = 500; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Right = 20.Percent(); - root_child0.Bottom = 10.Percent(); - root_child0.Width = 55.Percent(); - root_child0.Height = 15.Percent(); - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(-100f, root_child0.LayoutX); - Assert.AreEqual(-50f, root_child0.LayoutY); - Assert.AreEqual(275f, root_child0.LayoutWidth); - Assert.AreEqual(75f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(500f, root.LayoutWidth); - Assert.AreEqual(500f, root.LayoutHeight); - - Assert.AreEqual(125f, root_child0.LayoutX); - Assert.AreEqual(-50f, root_child0.LayoutY); - Assert.AreEqual(275f, root_child0.LayoutWidth); - Assert.AreEqual(75f, root_child0.LayoutHeight); - } - - [Test] - public void Test_percentage_flex_basis() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 50.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.FlexBasis = 25.Percent(); - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(125f, root_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0.LayoutHeight); - - Assert.AreEqual(125f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(75f, root_child1.LayoutWidth); - Assert.AreEqual(200f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(75f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(125f, root_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(75f, root_child1.LayoutWidth); - Assert.AreEqual(200f, root_child1.LayoutHeight); - } - - [Test] - public void Test_percentage_flex_basis_cross() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 50.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.FlexBasis = 25.Percent(); - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(125f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(125f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(75f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(125f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(125f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(75f, root_child1.LayoutHeight); - } - - [Test] - [Ignore] - public void Test_percentage_flex_basis_cross_min_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MinHeight = 60.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 2; - root_child1.MinHeight = 10.Percent(); - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(120f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(120f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(80f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(120f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(120f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(80f, root_child1.LayoutHeight); - } - - [Test] - public void Test_percentage_flex_basis_main_max_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 10.Percent(); - root_child0.MaxHeight = 60.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 4; - root_child1.FlexBasis = 10.Percent(); - root_child1.MaxHeight = 20.Percent(); - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(52f, root_child0.LayoutWidth); - Assert.AreEqual(120f, root_child0.LayoutHeight); - - Assert.AreEqual(52f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(148f, root_child1.LayoutWidth); - Assert.AreEqual(40f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(148f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(52f, root_child0.LayoutWidth); - Assert.AreEqual(120f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(148f, root_child1.LayoutWidth); - Assert.AreEqual(40f, root_child1.LayoutHeight); - } - - [Test] - public void Test_percentage_flex_basis_cross_max_height() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 10.Percent(); - root_child0.MaxHeight = 60.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 4; - root_child1.FlexBasis = 10.Percent(); - root_child1.MaxHeight = 20.Percent(); - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(120f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(120f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(40f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(120f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(120f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(40f, root_child1.LayoutHeight); - } - - [Test] - public void Test_percentage_flex_basis_main_max_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 15.Percent(); - root_child0.MaxWidth = 60.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 4; - root_child1.FlexBasis = 10.Percent(); - root_child1.MaxWidth = 20.Percent(); - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(120f, root_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0.LayoutHeight); - - Assert.AreEqual(120f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(40f, root_child1.LayoutWidth); - Assert.AreEqual(200f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(120f, root_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0.LayoutHeight); - - Assert.AreEqual(40f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(40f, root_child1.LayoutWidth); - Assert.AreEqual(200f, root_child1.LayoutHeight); - } - - [Test] - public void Test_percentage_flex_basis_cross_max_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 10.Percent(); - root_child0.MaxWidth = 60.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 4; - root_child1.FlexBasis = 15.Percent(); - root_child1.MaxWidth = 20.Percent(); - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(120f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(40f, root_child1.LayoutWidth); - Assert.AreEqual(150f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(120f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(160f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(40f, root_child1.LayoutWidth); - Assert.AreEqual(150f, root_child1.LayoutHeight); - } - - [Test] - public void Test_percentage_flex_basis_main_min_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 15.Percent(); - root_child0.MinWidth = 60.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 4; - root_child1.FlexBasis = 10.Percent(); - root_child1.MinWidth = 20.Percent(); - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(120f, root_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0.LayoutHeight); - - Assert.AreEqual(120f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(80f, root_child1.LayoutWidth); - Assert.AreEqual(200f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(80f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(120f, root_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(80f, root_child1.LayoutWidth); - Assert.AreEqual(200f, root_child1.LayoutHeight); - } - - [Test] - public void Test_percentage_flex_basis_cross_min_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 10.Percent(); - root_child0.MinWidth = 60.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 4; - root_child1.FlexBasis = 15.Percent(); - root_child1.MinWidth = 20.Percent(); - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(150f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(50f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(150f, root_child1.LayoutHeight); - } - - [Test] - public void Test_percentage_multiple_nested_with_padding_margin_and_percentage_values() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 10.Percent(); - root_child0.MarginLeft = 5; - root_child0.MarginTop = 5; - root_child0.MarginRight = 5; - root_child0.MarginBottom = 5; - root_child0.PaddingLeft = 3; - root_child0.PaddingTop = 3; - root_child0.PaddingRight = 3; - root_child0.PaddingBottom = 3; - root_child0.MinWidth = 60.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.MarginLeft = 5; - root_child0_child0.MarginTop = 5; - root_child0_child0.MarginRight = 5; - root_child0_child0.MarginBottom = 5; - root_child0_child0.PaddingLeft = 3.Percent(); - root_child0_child0.PaddingTop = 3.Percent(); - root_child0_child0.PaddingRight = 3.Percent(); - root_child0_child0.PaddingBottom = 3.Percent(); - root_child0_child0.Width = 50.Percent(); - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0.MarginLeft = 5.Percent(); - root_child0_child0_child0.MarginTop = 5.Percent(); - root_child0_child0_child0.MarginRight = 5.Percent(); - root_child0_child0_child0.MarginBottom = 5.Percent(); - root_child0_child0_child0.PaddingLeft = 3; - root_child0_child0_child0.PaddingTop = 3; - root_child0_child0_child0.PaddingRight = 3; - root_child0_child0_child0.PaddingBottom = 3; - root_child0_child0_child0.Width = 45.Percent(); - root_child0_child0.Insert(0, root_child0_child0_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 4; - root_child1.FlexBasis = 15.Percent(); - root_child1.MinWidth = 20.Percent(); - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(5f, root_child0.LayoutX); - Assert.AreEqual(5f, root_child0.LayoutY); - Assert.AreEqual(190f, root_child0.LayoutWidth); - Assert.AreEqual(48f, root_child0.LayoutHeight); - - Assert.AreEqual(8f, root_child0_child0.LayoutX); - Assert.AreEqual(8f, root_child0_child0.LayoutY); - Assert.AreEqual(92f, root_child0_child0.LayoutWidth); - Assert.AreEqual(25f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(10f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(10f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(36f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(6f, root_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(58f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(142f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(5f, root_child0.LayoutX); - Assert.AreEqual(5f, root_child0.LayoutY); - Assert.AreEqual(190f, root_child0.LayoutWidth); - Assert.AreEqual(48f, root_child0.LayoutHeight); - - Assert.AreEqual(90f, root_child0_child0.LayoutX); - Assert.AreEqual(8f, root_child0_child0.LayoutY); - Assert.AreEqual(92f, root_child0_child0.LayoutWidth); - Assert.AreEqual(25f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(46f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(10f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(36f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(6f, root_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(58f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(142f, root_child1.LayoutHeight); - } - - [Test] - public void Test_percentage_margin_should_calculate_based_only_on_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MarginLeft = 10.Percent(); - root_child0.MarginTop = 10.Percent(); - root_child0.MarginRight = 10.Percent(); - root_child0.MarginBottom = 10.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.Width = 10; - root_child0_child0.Height = 10; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(20f, root_child0.LayoutX); - Assert.AreEqual(20f, root_child0.LayoutY); - Assert.AreEqual(160f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(10f, root_child0_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(20f, root_child0.LayoutX); - Assert.AreEqual(20f, root_child0.LayoutY); - Assert.AreEqual(160f, root_child0.LayoutWidth); - Assert.AreEqual(60f, root_child0.LayoutHeight); - - Assert.AreEqual(150f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(10f, root_child0_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0_child0.LayoutHeight); - } - - [Test] - public void Test_percentage_padding_should_calculate_based_only_on_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.PaddingLeft = 10.Percent(); - root_child0.PaddingTop = 10.Percent(); - root_child0.PaddingRight = 10.Percent(); - root_child0.PaddingBottom = 10.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.Width = 10; - root_child0_child0.Height = 10; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(20f, root_child0_child0.LayoutX); - Assert.AreEqual(20f, root_child0_child0.LayoutY); - Assert.AreEqual(10f, root_child0_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(170f, root_child0_child0.LayoutX); - Assert.AreEqual(20f, root_child0_child0.LayoutY); - Assert.AreEqual(10f, root_child0_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0_child0.LayoutHeight); - } - - [Test] - public void Test_percentage_absolute_position() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Left = 30.Percent(); - root_child0.Top = 10.Percent(); - root_child0.Width = 10; - root_child0.Height = 10; - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(60f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(60f, root_child0.LayoutX); - Assert.AreEqual(10f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - } - - [Test] - public void Test_percentage_width_height_undefined_parent_size() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 50.Percent(); - root_child0.Height = 50.Percent(); - root.Insert(0, root_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(0f, root.LayoutWidth); - Assert.AreEqual(0f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(0f, root.LayoutWidth); - Assert.AreEqual(0f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(0f, root_child0.LayoutWidth); - Assert.AreEqual(0f, root_child0.LayoutHeight); - } - - [Test] - public void Test_percent_within_flex_grow() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 350; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 100; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.Width = 100.Percent(); - root_child1.Insert(0, root_child1_child0); - - YogaNode root_child2 = new YogaNode(config); - root_child2.Width = 100; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(350f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(100f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(150f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(150f, root_child1_child0.LayoutWidth); - Assert.AreEqual(0f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(250f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(350f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(250f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(100f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(150f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(150f, root_child1_child0.LayoutWidth); - Assert.AreEqual(0f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_percentage_container_in_wrapping_container() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.JustifyContent = YogaJustify.Center; - root.AlignItems = YogaAlign.Center; - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexDirection = YogaFlexDirection.Row; - root_child0_child0.JustifyContent = YogaJustify.Center; - root_child0_child0.Width = 100.Percent(); - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child0_child0 = new YogaNode(config); - root_child0_child0_child0.Width = 50; - root_child0_child0_child0.Height = 50; - root_child0_child0.Insert(0, root_child0_child0_child0); - - YogaNode root_child0_child0_child1 = new YogaNode(config); - root_child0_child0_child1.Width = 50; - root_child0_child0_child1.Height = 50; - root_child0_child0.Insert(1, root_child0_child0_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(75f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(50f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child0_child0_child1.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child1.LayoutY); - Assert.AreEqual(50f, root_child0_child0_child1.LayoutWidth); - Assert.AreEqual(50f, root_child0_child0_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(75f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(50f, root_child0_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child0.LayoutY); - Assert.AreEqual(50f, root_child0_child0_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0_child1.LayoutX); - Assert.AreEqual(0f, root_child0_child0_child1.LayoutY); - Assert.AreEqual(50f, root_child0_child0_child1.LayoutWidth); - Assert.AreEqual(50f, root_child0_child0_child1.LayoutHeight); - } - - [Test] - public void Test_percent_absolute_position() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 60; - root.Height = 50; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexDirection = YogaFlexDirection.Row; - root_child0.PositionType = YogaPositionType.Absolute; - root_child0.Left = 50.Percent(); - root_child0.Width = 100.Percent(); - root_child0.Height = 50; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.Width = 100.Percent(); - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child1 = new YogaNode(config); - root_child0_child1.Width = 100.Percent(); - root_child0.Insert(1, root_child0_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(60f, root.LayoutWidth); - Assert.AreEqual(50f, root.LayoutHeight); - - Assert.AreEqual(30f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(60f, root_child0_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(60f, root_child0_child1.LayoutX); - Assert.AreEqual(0f, root_child0_child1.LayoutY); - Assert.AreEqual(60f, root_child0_child1.LayoutWidth); - Assert.AreEqual(50f, root_child0_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(60f, root.LayoutWidth); - Assert.AreEqual(50f, root.LayoutHeight); - - Assert.AreEqual(30f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(60f, root_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(60f, root_child0_child0.LayoutWidth); - Assert.AreEqual(50f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(-60f, root_child0_child1.LayoutX); - Assert.AreEqual(0f, root_child0_child1.LayoutY); - Assert.AreEqual(60f, root_child0_child1.LayoutWidth); - Assert.AreEqual(50f, root_child0_child1.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGRoundingTest.cs b/csharp/tests/Facebook.Yoga/YGRoundingTest.cs deleted file mode 100644 index 78cf068f97..0000000000 --- a/csharp/tests/Facebook.Yoga/YGRoundingTest.cs +++ /dev/null @@ -1,1111 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGRoundingTest - { - [Test] - public void Test_rounding_flex_basis_flex_grow_row_width_of_100() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(33f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(33f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(34f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(67f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(33f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(67f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(33f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(33f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(34f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(33f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_rounding_flex_basis_flex_grow_row_prime_number_width() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 113; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root.Insert(2, root_child2); - - YogaNode root_child3 = new YogaNode(config); - root_child3.FlexGrow = 1; - root.Insert(3, root_child3); - - YogaNode root_child4 = new YogaNode(config); - root_child4.FlexGrow = 1; - root.Insert(4, root_child4); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(113f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(23f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(23f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(22f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(45f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(23f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - Assert.AreEqual(68f, root_child3.LayoutX); - Assert.AreEqual(0f, root_child3.LayoutY); - Assert.AreEqual(22f, root_child3.LayoutWidth); - Assert.AreEqual(100f, root_child3.LayoutHeight); - - Assert.AreEqual(90f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(23f, root_child4.LayoutWidth); - Assert.AreEqual(100f, root_child4.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(113f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(90f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(23f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(68f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(22f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(45f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(23f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - Assert.AreEqual(23f, root_child3.LayoutX); - Assert.AreEqual(0f, root_child3.LayoutY); - Assert.AreEqual(22f, root_child3.LayoutWidth); - Assert.AreEqual(100f, root_child3.LayoutHeight); - - Assert.AreEqual(0f, root_child4.LayoutX); - Assert.AreEqual(0f, root_child4.LayoutY); - Assert.AreEqual(23f, root_child4.LayoutWidth); - Assert.AreEqual(100f, root_child4.LayoutHeight); - } - - [Test] - public void Test_rounding_flex_basis_flex_shrink_row() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 101; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexShrink = 1; - root_child0.FlexBasis = 100; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexBasis = 25; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexBasis = 25; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(101f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(51f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(51f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(25f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(76f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(25f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(101f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(50f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(51f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(25f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(25f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(25f, root_child2.LayoutWidth); - Assert.AreEqual(100f, root_child2.LayoutHeight); - } - - [Test] - public void Test_rounding_flex_basis_overrides_main_size() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 113; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 50; - root_child0.Height = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(113f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(64f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(64f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(25f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(89f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(24f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(113f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(64f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(64f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(25f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(89f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(24f, root_child2.LayoutHeight); - } - - [Test] - public void Test_rounding_total_fractial() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 87.4f; - root.Height = 113.4f; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 0.7f; - root_child0.FlexBasis = 50.3f; - root_child0.Height = 20.3f; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1.6f; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1.1f; - root_child2.Height = 10.7f; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(87f, root.LayoutWidth); - Assert.AreEqual(113f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(87f, root_child0.LayoutWidth); - Assert.AreEqual(59f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(59f, root_child1.LayoutY); - Assert.AreEqual(87f, root_child1.LayoutWidth); - Assert.AreEqual(30f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(89f, root_child2.LayoutY); - Assert.AreEqual(87f, root_child2.LayoutWidth); - Assert.AreEqual(24f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(87f, root.LayoutWidth); - Assert.AreEqual(113f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(87f, root_child0.LayoutWidth); - Assert.AreEqual(59f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(59f, root_child1.LayoutY); - Assert.AreEqual(87f, root_child1.LayoutWidth); - Assert.AreEqual(30f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(89f, root_child2.LayoutY); - Assert.AreEqual(87f, root_child2.LayoutWidth); - Assert.AreEqual(24f, root_child2.LayoutHeight); - } - - [Test] - public void Test_rounding_total_fractial_nested() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 87.4f; - root.Height = 113.4f; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 0.7f; - root_child0.FlexBasis = 50.3f; - root_child0.Height = 20.3f; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.FlexGrow = 1; - root_child0_child0.FlexBasis = 0.3f; - root_child0_child0.Bottom = 13.3f; - root_child0_child0.Height = 9.9f; - root_child0.Insert(0, root_child0_child0); - - YogaNode root_child0_child1 = new YogaNode(config); - root_child0_child1.FlexGrow = 4; - root_child0_child1.FlexBasis = 0.3f; - root_child0_child1.Top = 13.3f; - root_child0_child1.Height = 1.1f; - root_child0.Insert(1, root_child0_child1); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1.6f; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1.1f; - root_child2.Height = 10.7f; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(87f, root.LayoutWidth); - Assert.AreEqual(113f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(87f, root_child0.LayoutWidth); - Assert.AreEqual(59f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(-13f, root_child0_child0.LayoutY); - Assert.AreEqual(87f, root_child0_child0.LayoutWidth); - Assert.AreEqual(12f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1.LayoutX); - Assert.AreEqual(25f, root_child0_child1.LayoutY); - Assert.AreEqual(87f, root_child0_child1.LayoutWidth); - Assert.AreEqual(47f, root_child0_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(59f, root_child1.LayoutY); - Assert.AreEqual(87f, root_child1.LayoutWidth); - Assert.AreEqual(30f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(89f, root_child2.LayoutY); - Assert.AreEqual(87f, root_child2.LayoutWidth); - Assert.AreEqual(24f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(87f, root.LayoutWidth); - Assert.AreEqual(113f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(87f, root_child0.LayoutWidth); - Assert.AreEqual(59f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(-13f, root_child0_child0.LayoutY); - Assert.AreEqual(87f, root_child0_child0.LayoutWidth); - Assert.AreEqual(12f, root_child0_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child1.LayoutX); - Assert.AreEqual(25f, root_child0_child1.LayoutY); - Assert.AreEqual(87f, root_child0_child1.LayoutWidth); - Assert.AreEqual(47f, root_child0_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(59f, root_child1.LayoutY); - Assert.AreEqual(87f, root_child1.LayoutWidth); - Assert.AreEqual(30f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(89f, root_child2.LayoutY); - Assert.AreEqual(87f, root_child2.LayoutWidth); - Assert.AreEqual(24f, root_child2.LayoutHeight); - } - - [Test] - public void Test_rounding_fractial_input_1() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 113.4f; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 50; - root_child0.Height = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(113f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(64f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(64f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(25f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(89f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(24f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(113f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(64f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(64f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(25f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(89f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(24f, root_child2.LayoutHeight); - } - - [Test] - public void Test_rounding_fractial_input_2() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 113.6f; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 50; - root_child0.Height = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(114f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(65f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(65f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(24f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(89f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(25f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(114f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(65f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(65f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(24f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(89f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(25f, root_child2.LayoutHeight); - } - - [Test] - public void Test_rounding_fractial_input_3() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Top = 0.3f; - root.Width = 100; - root.Height = 113.4f; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 50; - root_child0.Height = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(114f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(65f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(64f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(24f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(89f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(25f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(114f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(65f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(64f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(24f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(89f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(25f, root_child2.LayoutHeight); - } - - [Test] - public void Test_rounding_fractial_input_4() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Top = 0.7f; - root.Width = 100; - root.Height = 113.4f; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.FlexBasis = 50; - root_child0.Height = 20; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(1f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(113f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(64f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(64f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(25f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(89f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(24f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(1f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(113f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(64f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(64f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(25f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(89f, root_child2.LayoutY); - Assert.AreEqual(100f, root_child2.LayoutWidth); - Assert.AreEqual(24f, root_child2.LayoutHeight); - } - - [Test] - public void Test_rounding_inner_node_controversy_horizontal() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 320; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.Height = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.Height = 10; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.FlexGrow = 1; - root_child1_child0.Height = 10; - root_child1.Insert(0, root_child1_child0); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root_child2.Height = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(320f, root.LayoutWidth); - Assert.AreEqual(10f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(107f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(107f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(106f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(106f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(213f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(107f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(320f, root.LayoutWidth); - Assert.AreEqual(10f, root.LayoutHeight); - - Assert.AreEqual(213f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(107f, root_child0.LayoutWidth); - Assert.AreEqual(10f, root_child0.LayoutHeight); - - Assert.AreEqual(107f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(106f, root_child1.LayoutWidth); - Assert.AreEqual(10f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(106f, root_child1_child0.LayoutWidth); - Assert.AreEqual(10f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(107f, root_child2.LayoutWidth); - Assert.AreEqual(10f, root_child2.LayoutHeight); - } - - [Test] - public void Test_rounding_inner_node_controversy_vertical() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Height = 320; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.Width = 10; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.Width = 10; - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.FlexGrow = 1; - root_child1_child0.Width = 10; - root_child1.Insert(0, root_child1_child0); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root_child2.Width = 10; - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(10f, root.LayoutWidth); - Assert.AreEqual(320f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(107f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(107f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(106f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(10f, root_child1_child0.LayoutWidth); - Assert.AreEqual(106f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(213f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(107f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(10f, root.LayoutWidth); - Assert.AreEqual(320f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(10f, root_child0.LayoutWidth); - Assert.AreEqual(107f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(107f, root_child1.LayoutY); - Assert.AreEqual(10f, root_child1.LayoutWidth); - Assert.AreEqual(106f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(10f, root_child1_child0.LayoutWidth); - Assert.AreEqual(106f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(213f, root_child2.LayoutY); - Assert.AreEqual(10f, root_child2.LayoutWidth); - Assert.AreEqual(107f, root_child2.LayoutHeight); - } - - [Test] - public void Test_rounding_inner_node_controversy_combined() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 640; - root.Height = 320; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.Height = 100.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root_child1.Height = 100.Percent(); - root.Insert(1, root_child1); - - YogaNode root_child1_child0 = new YogaNode(config); - root_child1_child0.FlexGrow = 1; - root_child1_child0.Width = 100.Percent(); - root_child1.Insert(0, root_child1_child0); - - YogaNode root_child1_child1 = new YogaNode(config); - root_child1_child1.FlexGrow = 1; - root_child1_child1.Width = 100.Percent(); - root_child1.Insert(1, root_child1_child1); - - YogaNode root_child1_child1_child0 = new YogaNode(config); - root_child1_child1_child0.FlexGrow = 1; - root_child1_child1_child0.Width = 100.Percent(); - root_child1_child1.Insert(0, root_child1_child1_child0); - - YogaNode root_child1_child2 = new YogaNode(config); - root_child1_child2.FlexGrow = 1; - root_child1_child2.Width = 100.Percent(); - root_child1.Insert(2, root_child1_child2); - - YogaNode root_child2 = new YogaNode(config); - root_child2.FlexGrow = 1; - root_child2.Height = 100.Percent(); - root.Insert(2, root_child2); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(640f, root.LayoutWidth); - Assert.AreEqual(320f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(213f, root_child0.LayoutWidth); - Assert.AreEqual(320f, root_child0.LayoutHeight); - - Assert.AreEqual(213f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(214f, root_child1.LayoutWidth); - Assert.AreEqual(320f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(214f, root_child1_child0.LayoutWidth); - Assert.AreEqual(107f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child1.LayoutX); - Assert.AreEqual(107f, root_child1_child1.LayoutY); - Assert.AreEqual(214f, root_child1_child1.LayoutWidth); - Assert.AreEqual(106f, root_child1_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child1_child0.LayoutY); - Assert.AreEqual(214f, root_child1_child1_child0.LayoutWidth); - Assert.AreEqual(106f, root_child1_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child2.LayoutX); - Assert.AreEqual(213f, root_child1_child2.LayoutY); - Assert.AreEqual(214f, root_child1_child2.LayoutWidth); - Assert.AreEqual(107f, root_child1_child2.LayoutHeight); - - Assert.AreEqual(427f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(213f, root_child2.LayoutWidth); - Assert.AreEqual(320f, root_child2.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(640f, root.LayoutWidth); - Assert.AreEqual(320f, root.LayoutHeight); - - Assert.AreEqual(427f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(213f, root_child0.LayoutWidth); - Assert.AreEqual(320f, root_child0.LayoutHeight); - - Assert.AreEqual(213f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(214f, root_child1.LayoutWidth); - Assert.AreEqual(320f, root_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child0.LayoutY); - Assert.AreEqual(214f, root_child1_child0.LayoutWidth); - Assert.AreEqual(107f, root_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child1.LayoutX); - Assert.AreEqual(107f, root_child1_child1.LayoutY); - Assert.AreEqual(214f, root_child1_child1.LayoutWidth); - Assert.AreEqual(106f, root_child1_child1.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child1_child0.LayoutX); - Assert.AreEqual(0f, root_child1_child1_child0.LayoutY); - Assert.AreEqual(214f, root_child1_child1_child0.LayoutWidth); - Assert.AreEqual(106f, root_child1_child1_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1_child2.LayoutX); - Assert.AreEqual(213f, root_child1_child2.LayoutY); - Assert.AreEqual(214f, root_child1_child2.LayoutWidth); - Assert.AreEqual(107f, root_child1_child2.LayoutHeight); - - Assert.AreEqual(0f, root_child2.LayoutX); - Assert.AreEqual(0f, root_child2.LayoutY); - Assert.AreEqual(213f, root_child2.LayoutWidth); - Assert.AreEqual(320f, root_child2.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YGSizeOverflowTest.cs b/csharp/tests/Facebook.Yoga/YGSizeOverflowTest.cs deleted file mode 100644 index f4f7459d8b..0000000000 --- a/csharp/tests/Facebook.Yoga/YGSizeOverflowTest.cs +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by gentest/gentest.rb from gentest/fixtures/YGSizeOverflowTest.html - -using System; -using NUnit.Framework; - -namespace Facebook.Yoga -{ - [TestFixture] - public class YGSizeOverflowTest - { - [Test] - public void Test_nested_overflowing_child() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.Width = 200; - root_child0_child0.Height = 200; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(200f, root_child0_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0.LayoutHeight); - - Assert.AreEqual(-100f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(200f, root_child0_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0_child0.LayoutHeight); - } - - [Test] - public void Test_nested_overflowing_child_in_constraint_parent() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 100; - root_child0.Height = 100; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.Width = 200; - root_child0_child0.Height = 200; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(200f, root_child0_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(-100f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(200f, root_child0_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0_child0.LayoutHeight); - } - - [Test] - public void Test_parent_wrap_child_size_overflowing_parent() - { - YogaConfig config = new YogaConfig(); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.Width = 100; - root.Insert(0, root_child0); - - YogaNode root_child0_child0 = new YogaNode(config); - root_child0_child0.Width = 100; - root_child0_child0.Height = 200; - root_child0.Insert(0, root_child0_child0); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0_child0.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child0_child0.LayoutX); - Assert.AreEqual(0f, root_child0_child0.LayoutY); - Assert.AreEqual(100f, root_child0_child0.LayoutWidth); - Assert.AreEqual(200f, root_child0_child0.LayoutHeight); - } - - } -} diff --git a/csharp/tests/Facebook.Yoga/YogaConfigTest.cs b/csharp/tests/Facebook.Yoga/YogaConfigTest.cs deleted file mode 100644 index 88211c3e23..0000000000 --- a/csharp/tests/Facebook.Yoga/YogaConfigTest.cs +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using NUnit.Framework; -using System; - -/** - * Tests for {@link YogaConfig}. - */ -namespace Facebook.Yoga -{ - [TestFixture] - public class YogaConfigTest - { - [Test] - public void TestUseWebDefaults() - { - YogaNode node0 = new YogaNode(new YogaConfig{UseWebDefaults = true}); - Assert.AreEqual(YogaFlexDirection.Row, node0.FlexDirection); - - node0.Reset(); - Assert.AreEqual(YogaFlexDirection.Row, node0.FlexDirection); - - YogaConfig config = new YogaConfig(); - config.UseWebDefaults = true; - YogaNode node1 = new YogaNode(config); - Assert.AreEqual(YogaFlexDirection.Row, node1.FlexDirection); - - node1.Reset(); - Assert.AreEqual(YogaFlexDirection.Row, node1.FlexDirection); - } - - [Test] - public void TestDefaultConfig() - { - YogaNode node0 = new YogaNode(); - Assert.AreEqual(YogaFlexDirection.Column, node0.FlexDirection); - - YogaNode node1 = new YogaNode(new YogaConfig()); - Assert.AreEqual(YogaFlexDirection.Column, node1.FlexDirection); - } - - [Test] - public void TestCopyConstructor() - { - YogaNode srcNode = new YogaNode(new YogaConfig{UseWebDefaults = true}); - YogaNode node0 = new YogaNode(srcNode); - Assert.AreEqual(YogaFlexDirection.Row, node0.FlexDirection); - - node0.FlexDirection = YogaFlexDirection.Column; - Assert.AreEqual(YogaFlexDirection.Column, node0.FlexDirection); - - node0.Reset(); - Assert.AreEqual(YogaFlexDirection.Row, node0.FlexDirection); - - YogaNode node1 = new YogaNode(srcNode) - { - FlexDirection = YogaFlexDirection.Column - }; - Assert.AreEqual(YogaFlexDirection.Column, node1.FlexDirection); - - node1.Reset(); - Assert.AreEqual(YogaFlexDirection.Row, node1.FlexDirection); - } - -#if !UNITY_5_4_OR_NEWER - public static void ForceGC() - { - YogaNodeTest.ForceGC(); - } - - [Test] - public void TestDestructor() - { - ForceGC(); - int instanceCount = YogaConfig.GetInstanceCount(); - TestDestructorForGC(instanceCount); - ForceGC(); - Assert.AreEqual(instanceCount, YogaConfig.GetInstanceCount()); - } - - private void TestDestructorForGC(int instanceCount) - { - YogaConfig config = new YogaConfig(); - Assert.IsNotNull(config); - Assert.AreEqual(instanceCount + 1, YogaConfig.GetInstanceCount()); - config = null; - } - - [Test] - public void TestRetainConfig() - { - ForceGC(); - int nodeInstanceCount = YogaNode.GetInstanceCount(); - int configInstanceCount = YogaConfig.GetInstanceCount(); - TestRetainConfigForGC(nodeInstanceCount, configInstanceCount); - ForceGC(); - - Assert.AreEqual(nodeInstanceCount, YogaNode.GetInstanceCount()); - Assert.AreEqual(configInstanceCount, YogaConfig.GetInstanceCount()); - } - - private void TestRetainConfigForGC(int nodeInstanceCount, int configInstanceCount) - { - ForceGC(); - Assert.AreEqual(nodeInstanceCount, YogaNode.GetInstanceCount()); - Assert.AreEqual(configInstanceCount, YogaConfig.GetInstanceCount()); - YogaNode node = TestRetainConfigForGC2(nodeInstanceCount, configInstanceCount); - ForceGC(); - Assert.IsNotNull(node); - Assert.AreEqual(configInstanceCount + 1, YogaConfig.GetInstanceCount()); - Assert.AreEqual(nodeInstanceCount + 1, YogaNode.GetInstanceCount()); - node = null; - } - - private YogaNode TestRetainConfigForGC2(int nodeInstanceCount, int configInstanceCount) - { - YogaConfig config = new YogaConfig(); - Assert.IsNotNull(config); - Assert.AreEqual(configInstanceCount + 1, YogaConfig.GetInstanceCount()); - - YogaNode node = new YogaNode(config); - Assert.IsNotNull(node); - Assert.AreEqual(nodeInstanceCount + 1, YogaNode.GetInstanceCount()); - - config = null; - - return node; - } -#endif - } -} diff --git a/csharp/tests/Facebook.Yoga/YogaNodeSpacingTest.cs b/csharp/tests/Facebook.Yoga/YogaNodeSpacingTest.cs deleted file mode 100644 index 0492dfebc4..0000000000 --- a/csharp/tests/Facebook.Yoga/YogaNodeSpacingTest.cs +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using NUnit.Framework; -using System; - -/** - * Tests for {@link YogaNode}. - */ -namespace Facebook.Yoga -{ - [TestFixture] - public class YogaNodeSpacingTest - { - [Test] - public void TestObjectInitializer() - { - YogaNode node = new YogaNode - { - Top = 1, - Bottom = 2, - Left = 3, - Right = 4, - - MarginTop = 5, - MarginBottom = 6, - MarginLeft = 7, - MarginRight = 8, - - PaddingTop = 9, - PaddingBottom = 10, - PaddingLeft = 11, - PaddingRight = 12, - - BorderTopWidth = 13, - BorderBottomWidth = 14, - BorderLeftWidth = 15, - BorderRightWidth = 16, - }; - - Assert.AreEqual(1.Pt(), node.Top); - Assert.AreEqual(2.Pt(), node.Bottom); - Assert.AreEqual(3.Pt(), node.Left); - Assert.AreEqual(4.Pt(), node.Right); - - Assert.AreEqual(5.Pt(), node.MarginTop); - Assert.AreEqual(6.Pt(), node.MarginBottom); - Assert.AreEqual(7.Pt(), node.MarginLeft); - Assert.AreEqual(8.Pt(), node.MarginRight); - - Assert.AreEqual(9.Pt(), node.PaddingTop); - Assert.AreEqual(10.Pt(), node.PaddingBottom); - Assert.AreEqual(11.Pt(), node.PaddingLeft); - Assert.AreEqual(12.Pt(), node.PaddingRight); - - Assert.AreEqual(13, node.BorderTopWidth); - Assert.AreEqual(14, node.BorderBottomWidth); - Assert.AreEqual(15, node.BorderLeftWidth); - Assert.AreEqual(16, node.BorderRightWidth); - } - - [Test] - public void TestWriteRead() - { - YogaNode node = new YogaNode(); - - node.Top = 1; - node.Bottom = 2; - node.Left = 3; - node.Right = 4; - - node.MarginTop = 5; - node.MarginBottom = 6; - node.MarginLeft = 7; - node.MarginRight = 8; - - node.PaddingTop = 9; - node.PaddingBottom = 10; - node.PaddingLeft = 11; - node.PaddingRight = 12; - - node.BorderTopWidth = 13; - node.BorderBottomWidth = 14; - node.BorderLeftWidth = 15; - node.BorderRightWidth = 16; - - Assert.AreEqual(1.Pt(), node.Top); - Assert.AreEqual(2.Pt(), node.Bottom); - Assert.AreEqual(3.Pt(), node.Left); - Assert.AreEqual(4.Pt(), node.Right); - - Assert.AreEqual(5.Pt(), node.MarginTop); - Assert.AreEqual(6.Pt(), node.MarginBottom); - Assert.AreEqual(7.Pt(), node.MarginLeft); - Assert.AreEqual(8.Pt(), node.MarginRight); - - Assert.AreEqual(9.Pt(), node.PaddingTop); - Assert.AreEqual(10.Pt(), node.PaddingBottom); - Assert.AreEqual(11.Pt(), node.PaddingLeft); - Assert.AreEqual(12.Pt(), node.PaddingRight); - - Assert.AreEqual(13, node.BorderTopWidth); - Assert.AreEqual(14, node.BorderBottomWidth); - Assert.AreEqual(15, node.BorderLeftWidth); - Assert.AreEqual(16, node.BorderRightWidth); - } - } -} diff --git a/csharp/tests/Facebook.Yoga/YogaNodeTest.cs b/csharp/tests/Facebook.Yoga/YogaNodeTest.cs deleted file mode 100644 index 6d92343a4d..0000000000 --- a/csharp/tests/Facebook.Yoga/YogaNodeTest.cs +++ /dev/null @@ -1,496 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using NUnit.Framework; -using System; - -/** - * Tests for {@link YogaNode}. - */ -namespace Facebook.Yoga -{ - [TestFixture] - public class YogaNodeTest - { - [Test] - public void TestAddChildGetParent() - { - YogaNode parent = new YogaNode(); - YogaNode child = new YogaNode(); - - Assert.IsNull(child.Parent); - Assert.AreEqual(0, parent.Count); - - parent.Insert(0, child); - - Assert.AreEqual(1, parent.Count); - Assert.AreEqual(child, parent[0]); - Assert.AreEqual(parent, child.Parent); - - parent.RemoveAt(0); - - Assert.IsNull(child.Parent); - Assert.AreEqual(0, parent.Count); - } - - [Test] - public void TestChildren() - { - YogaNode parent = new YogaNode(); - foreach (YogaNode node in parent) { - Assert.Fail(node.ToString()); - } - - YogaNode child0 = new YogaNode(); - Assert.AreEqual(-1, parent.IndexOf(child0)); - parent.Insert(0, child0); - foreach (YogaNode node in parent) { - Assert.AreEqual(0, parent.IndexOf(node)); - } - - YogaNode child1 = new YogaNode(); - parent.Insert(1, child1); - int index = 0; - foreach (YogaNode node in parent) { - Assert.AreEqual(index++, parent.IndexOf(node)); - } - - parent.RemoveAt(0); - Assert.AreEqual(-1, parent.IndexOf(child0)); - Assert.AreEqual(0, parent.IndexOf(child1)); - - parent.Clear(); - Assert.AreEqual(0, parent.Count); - - parent.Clear(); - Assert.AreEqual(0, parent.Count); - } - - [Test] - public void TestRemoveAtFromEmpty() - { - YogaNode parent = new YogaNode(); - Assert.Throws(() => parent.RemoveAt(0)); - } - - [Test] - public void TestRemoveAtOutOfRange() - { - YogaNode parent = new YogaNode(); - YogaNode child = new YogaNode(); - parent.Insert(0, child); - Assert.Throws(() => parent.RemoveAt(1)); - } - - [Test] - public void TestCannotAddChildToMultipleParents() - { - YogaNode parent1 = new YogaNode(); - YogaNode parent2 = new YogaNode(); - YogaNode child = new YogaNode(); - - parent1.Insert(0, child); - Assert.Throws(() => parent2.Insert(0, child)); - } - - [Test] - public void TestReset() - { - int instanceCount = YogaNode.GetInstanceCount(); - YogaNode node = new YogaNode(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - node.Reset(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - } - - [Test] - public void TestResetParent() - { - YogaNode parent = new YogaNode(); - YogaNode child = new YogaNode(); - parent.Insert(0, child); - Assert.Throws(() => parent.Reset()); - } - - [Test] - public void TestResetChild() - { - YogaNode parent = new YogaNode(); - YogaNode child = new YogaNode(); - parent.Insert(0, child); - Assert.Throws(() => child.Reset()); - } - - [Test] - public void TestClear() - { - 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, YogaNode.GetInstanceCount()); - } - - [Test] - public void TestMeasureFunc() - { - YogaNode node = new YogaNode(); - node.SetMeasureFunction((_, width, widthMode, height, heightMode) => { - return MeasureOutput.Make(100, 150); - }); - node.CalculateLayout(); - Assert.AreEqual(100, node.LayoutWidth); - Assert.AreEqual(150, node.LayoutHeight); - } - - [Test] - public void TestMeasureFuncWithFloat() - { - YogaNode node = new YogaNode(); - node.SetMeasureFunction((_, width, widthMode, height, heightMode) => { - return MeasureOutput.Make(123.4f, 81.7f); - }); - node.CalculateLayout(); - Assert.AreEqual(124.0f, node.LayoutWidth); - Assert.AreEqual(82.0f, node.LayoutHeight); - - node = new YogaNode(new YogaConfig{PointScaleFactor = 0}); - node.SetMeasureFunction((_, width, widthMode, height, heightMode) => { - return MeasureOutput.Make(123.4f, 81.7f); - }); - node.CalculateLayout(); - Assert.AreEqual(123.4f, node.LayoutWidth); - Assert.AreEqual(81.7f, node.LayoutHeight); - } - - [Test] - public void TestChildWithMeasureFunc() - { - YogaNode node = new YogaNode(); - node.SetMeasureFunction((_, width, widthMode, height, heightMode) => { - return MeasureOutput.Make(100, 150); - }); - YogaNode child = new YogaNode(); - Assert.Throws(() => node.Insert(0, child)); - } - - [Test] - public void TestMeasureFuncWithChild() - { - YogaNode node = new YogaNode(); - YogaNode child = new YogaNode(); - node.Insert(0, child); - Assert.Throws(() => - node.SetMeasureFunction((_, width, widthMode, height, heightMode) => { - return MeasureOutput.Make(100, 150); - }) - ); - } - - [Test] - public void TestBaselineFunc() - { - YogaNode node = new YogaNode(); - node.Height = 200; - node.FlexDirection = YogaFlexDirection.Row; - node.AlignItems = YogaAlign.Baseline; - - YogaNode child0 = new YogaNode(); - child0.Width = 100; - child0.Height = 110; - child0.SetBaselineFunction((_, width, height) => { - Assert.AreEqual(100, width); - Assert.AreEqual(110, height); - return 65; - }); - node.Insert(0, child0); - - YogaNode child1 = new YogaNode(); - child1.Width = 100; - child1.Height = 110; - child1.SetBaselineFunction((_, width, height) => { - Assert.AreEqual(100, width); - Assert.AreEqual(110, height); - return 80; - }); - node.Insert(1, child1); - - YogaNode child2 = new YogaNode(); - child2.Width = 100; - child2.Height = 110; - child2.SetBaselineFunction((_, width, height) => { - Assert.AreEqual(100, width); - Assert.AreEqual(110, height); - return 88; - }); - node.Insert(2, child2); - - node.CalculateLayout(); - - Assert.AreEqual(0, child0.LayoutX); - Assert.AreEqual(23, child0.LayoutY); - Assert.AreEqual(100, child1.LayoutX); - Assert.AreEqual(8, child1.LayoutY); - Assert.AreEqual(200, child2.LayoutX); - Assert.AreEqual(0, child2.LayoutY); - } - - [Test] - public void TestPrintOneNode() - { - YogaNode node = new YogaNode(); - node.Width = 100; - node.Height = 120; - node.CalculateLayout(); - Assert.AreEqual("
", node.Print()); - } - - [Test] - public void TestPrintWithLogger() - { - YogaNode node = new YogaNode(); - node.Width = 110; - node.Height = 105; - node.CalculateLayout(); - Assert.AreEqual("
", node.Print()); - } - - [Test] - public void TestPrint() - { - YogaNode parent = new YogaNode(); - parent.Width = 100; - parent.Height = 120; - YogaNode child0 = new YogaNode(); - child0.Width = 30; - child0.Height = 40; - YogaNode child1 = new YogaNode(); - child1.Width = 35; - child1.Height = 45; - parent.Insert(0, child0); - parent.Insert(0, child1); - parent.CalculateLayout(); - Assert.AreEqual("
\n
\n
\n
", parent.Print()); - } - - [Test] - public void TestCopyStyle() - { - YogaNode node0 = new YogaNode(); - Assert.IsTrue(YogaConstants.IsUndefined(node0.MaxHeight)); - - YogaNode node1 = new YogaNode(); - node1.MaxHeight = 100; - - node0.CopyStyle(node1); - Assert.AreEqual(100.Pt(), node0.MaxHeight); - } - - [Test] - public void TestCopyConstructor() - { - YogaNode node0 = new YogaNode(); - node0.MaxWidth = 80; - - YogaNode node1 = new YogaNode(node0); - Assert.AreEqual(80.Pt(), node1.MaxWidth); - - YogaNode node2 = new YogaNode(node1) - { - MaxHeight = 90, - }; - Assert.AreEqual(80.Pt(), node2.MaxWidth); - Assert.AreEqual(90.Pt(), node2.MaxHeight); - - YogaNode node3 = new YogaNode(node0) - { - MaxWidth = 100, - }; - Assert.AreEqual(100.Pt(), node3.MaxWidth); - - YogaNode node4 = new YogaNode(node2) - { - MaxWidth = 100, - }; - Assert.AreEqual(100.Pt(), node4.MaxWidth); - Assert.AreEqual(90.Pt(), node4.MaxHeight); - } - -#if !UNITY_5_4_OR_NEWER - public static void ForceGC() - { - GC.Collect(); - GC.WaitForPendingFinalizers(); - } - - [Test] - public void TestDestructor() - { - ForceGC(); - int instanceCount = YogaNode.GetInstanceCount(); - TestDestructorForGC(instanceCount); - ForceGC(); - Assert.AreEqual(instanceCount, YogaNode.GetInstanceCount()); - } - - private void TestDestructorForGC(int instanceCount) - { - YogaNode node = new YogaNode(); - Assert.IsNotNull(node); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - node = null; - } - - [Test] - public void TestDestructorWithChildren() - { - ForceGC(); - int instanceCount = YogaNode.GetInstanceCount(); - TestDestructorWithChildrenForGC1(instanceCount); - ForceGC(); - Assert.AreEqual(instanceCount, YogaNode.GetInstanceCount()); - } - - private void TestDestructorWithChildrenForGC1(int instanceCount) - { - YogaNode node = new YogaNode(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - - TestDestructorWithChildrenForGC2(node, instanceCount + 1); - ForceGC(); - Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount()); - - TestDestructorWithChildrenForGC2(node, instanceCount + 2); - ForceGC(); - Assert.AreEqual(instanceCount + 3, YogaNode.GetInstanceCount()); - - node = null; - } - - private void TestDestructorWithChildrenForGC2(YogaNode parent, int instanceCount) - { - YogaNode child = new YogaNode(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - - parent.Insert(0, child); - child = null; - } - -#if YOGA_ENABLE_GC_TEST - [Test] - public void TestParentDestructor() - { - ForceGC(); - 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, YogaNode.GetInstanceCount()); - } - - private void TestParentDestructorForGC(YogaNode child, int instanceCount) - { - YogaNode parent = new YogaNode(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - parent.Insert(0, child); - } -#endif - - [Test] - public void TestClearWithChildDestructor() - { - ForceGC(); - int instanceCount = YogaNode.GetInstanceCount(); - YogaNode node = new YogaNode(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - TestClearWithChildDestructorForGC(node, instanceCount + 1); - ForceGC(); - Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount()); - node.Clear(); - Assert.AreEqual(0, node.Count); - ForceGC(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - } - - private void TestClearWithChildDestructorForGC(YogaNode parent, int instanceCount) - { - YogaNode child = new YogaNode(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - parent.Insert(0, child); - } - - [Test] - public void TestMeasureFuncWithDestructor() - { - ForceGC(); - int instanceCount = YogaNode.GetInstanceCount(); - YogaNode parent = new YogaNode(); - Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); - TestMeasureFuncWithDestructorForGC(parent); - ForceGC(); - Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount()); - parent.CalculateLayout(); - Assert.AreEqual(120, (int)parent.LayoutWidth); - Assert.AreEqual(130, (int)parent.LayoutHeight); - } - - private void TestMeasureFuncWithDestructorForGC(YogaNode parent) - { - YogaNode child = new YogaNode(); - parent.Insert(0, child); - child.SetMeasureFunction((_, width, widthMode, height, heightMode) => { - return MeasureOutput.Make(120, 130); - }); - } -#endif - - [Test] - public void TestLayoutMargin() { - YogaNode node = new YogaNode(); - node.Width = 100; - node.Height = 100; - node.MarginStart = 1; - node.MarginEnd = 2; - node.MarginTop = 3; - node.MarginBottom = 4; - node.CalculateLayout(); - - Assert.AreEqual(1, node.LayoutMarginLeft); - Assert.AreEqual(2, node.LayoutMarginRight); - Assert.AreEqual(3, node.LayoutMarginTop); - Assert.AreEqual(4, node.LayoutMarginBottom); - } - - [Test] - public void TestLayoutPadding() { - YogaNode node = new YogaNode(); - node.Width = 100; - node.Height = 100; - node.PaddingStart = 1; - node.PaddingEnd = 2; - node.PaddingTop = 3; - node.PaddingBottom = 4; - node.CalculateLayout(); - - Assert.AreEqual(1, node.LayoutPaddingLeft); - Assert.AreEqual(2, node.LayoutPaddingRight); - Assert.AreEqual(3, node.LayoutPaddingTop); - Assert.AreEqual(4, node.LayoutPaddingBottom); - } - } -} diff --git a/csharp/tests/Facebook.Yoga/test_macos.sh b/csharp/tests/Facebook.Yoga/test_macos.sh deleted file mode 100755 index 544b6ccab8..0000000000 --- a/csharp/tests/Facebook.Yoga/test_macos.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -if mcs --version >/dev/null 2>&1 && mono --version >/dev/null 2>&1; then true; else - echo "ERROR: Need to install Mono (brew install mono, or http://www.mono-project.com/download/)" - exit 1 -fi - -cd "$( dirname "$0" )" - -NUNIT=NUnit-2.6.4/bin -if [ -d $NUNIT \ - -a -f $NUNIT/nunit-console.exe \ - -a -f $NUNIT/lib/nunit-console-runner.dll \ - -a -f $NUNIT/lib/nunit.core.dll \ - -a -f $NUNIT/lib/nunit.core.interfaces.dll \ - -a -f $NUNIT/lib/nunit.util.dll ]; then true; else - curl -L -O https://github.com/nunit/nunitv2/releases/download/2.6.4/NUnit-2.6.4.zip - unzip -qq NUnit-2.6.4.zip - rm NUnit-2.6.4.zip -fi - -TARGET=//csharp:yoganet#default,shared -buck build $TARGET -ROOT=`buck root|tail -1` -DYLIB=`buck targets --show-output $TARGET|tail -1|awk '{print $2}'` -cp $ROOT/$DYLIB . - -mcs -debug -d:YOGA_ENABLE_GC_TEST -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 diff --git a/csharp/tests/Facebook.YogaKit.Shared.Tests/Facebook.YogaKit.Shared.Tests.projitems b/csharp/tests/Facebook.YogaKit.Shared.Tests/Facebook.YogaKit.Shared.Tests.projitems deleted file mode 100644 index 04cc273913..0000000000 --- a/csharp/tests/Facebook.YogaKit.Shared.Tests/Facebook.YogaKit.Shared.Tests.projitems +++ /dev/null @@ -1,14 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - {63AB08F4-4F7C-42B7-A20F-D84204D0D3CE} - - - Facebook.YogaKit.Shared.Tests - - - - - \ No newline at end of file diff --git a/csharp/tests/Facebook.YogaKit.Shared.Tests/Facebook.YogaKit.Shared.Tests.shproj b/csharp/tests/Facebook.YogaKit.Shared.Tests/Facebook.YogaKit.Shared.Tests.shproj deleted file mode 100644 index 4039eea4e2..0000000000 --- a/csharp/tests/Facebook.YogaKit.Shared.Tests/Facebook.YogaKit.Shared.Tests.shproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - {63AB08F4-4F7C-42B7-A20F-D84204D0D3CE} - - - - - - - \ No newline at end of file diff --git a/csharp/tests/Facebook.YogaKit.Shared.Tests/YogaKitTest.cs b/csharp/tests/Facebook.YogaKit.Shared.Tests/YogaKitTest.cs deleted file mode 100644 index 42ad5c64c8..0000000000 --- a/csharp/tests/Facebook.YogaKit.Shared.Tests/YogaKitTest.cs +++ /dev/null @@ -1,376 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -using System.Drawing; -using Facebook.Yoga; -using NUnit.Framework; -using System; -#if __IOS__ -using NativeView = UIKit.UIView; -using CoreGraphics; -#endif - -namespace Facebook.YogaKit -{ - [TestFixture] - public class YogaKitTest - { - [Test] - public void TestUsesYoga() - { - var view = new NativeView(); - Assert.False(view.Yoga().IsEnabled); - view.Yoga().IsEnabled = true; - Assert.True(view.Yoga().IsEnabled); - view.Yoga().IsEnabled = false; - Assert.False(view.Yoga().IsEnabled); - } - - [Test] - public void TestSizeThatFitsAsserts() - { - var view = new NativeView(); - Assert.Ignore("Not implemented yet"); - // dispatch_sync(dispatch_queue_create("com.facebook.Yoga.testing", DISPATCH_QUEUE_SERIAL), ^(void){ - // XCTAssertThrows(view.yoga.intrinsicSize); - // }); - } - - [Test] - public void TestSizeThatFitsSmoke() - { - var container = new NativeView(); - container.Yoga().IsEnabled = true; - container.Yoga().FlexDirection = YogaFlexDirection.Row; - container.Yoga().AlignItems = YogaAlign.FlexStart; - - var longTextLabel = new UIKit.UILabel(); - longTextLabel.Text = @"This is a very very very very very very very very long piece of text."; - longTextLabel.LineBreakMode = UIKit.UILineBreakMode.TailTruncation; - longTextLabel.Lines = 1; - longTextLabel.Yoga().IsEnabled = true; - longTextLabel.Yoga().FlexShrink = 1; - container.AddSubview(longTextLabel); - - var textBadgeView = new NativeView(); - textBadgeView.Yoga().IsEnabled = true; - textBadgeView.Yoga().MarginLeft = 3.0f; - textBadgeView.Yoga().Width = 10; - textBadgeView.Yoga().Height = 10; - container.AddSubview(textBadgeView); - - var containerSize = container.Yoga().IntrinsicSize; - Assert.True(new SizeF(514, 21) == containerSize, $"Size is actually {containerSize})"); - } - - [Test] - public void TestThatMarkingLeafsAsDirtyWillTriggerASizeRecalculation() - { - var container = new NativeView(new CGRect(0, 0, 500, 500)); - container.Yoga().IsEnabled = true; - container.Yoga().FlexDirection = YogaFlexDirection.Row; - container.Yoga().AlignItems = YogaAlign.FlexStart; - - var label = new UIKit.UILabel(); - label.Text = @"This is a short text."; - label.Lines = 1; - label.Yoga().IsEnabled = true; - container.AddSubview(label); - - container.Yoga().ApplyLayout(); - Assert.True(new SizeF(146, 21) == label.Bounds.Size, $"Size is actually {label.Bounds.Size})"); - - label.Text = @"This is a slightly longer text."; - label.Yoga().MarkDirty(); - - container.Yoga().ApplyLayout(); - Assert.True(new SizeF(213, 21) == label.Bounds.Size, $"Size is actually {label.Bounds.Size})"); - } - - [Test] - public void TestFrameAndOriginPlacement() - { - var containerSize = new SizeF(320, 50); - - var container = new NativeView(new CGRect(0, 0, containerSize.Width, containerSize.Height)); - container.Yoga().IsEnabled = true; - container.Yoga().FlexDirection = YogaFlexDirection.Row; - - for (int i = 0; i < 3; i++) - { - var subview = new NativeView(); - subview.Yoga().IsEnabled = true; - subview.Yoga().FlexGrow = 1; - container.AddSubview(subview); - } - container.Yoga().ApplyLayout(); - - Assert.False(CGRect.Intersect(container.Subviews[0].Frame, container.Subviews[1].Frame) == CGRect.Empty); - Assert.False(CGRect.Intersect(container.Subviews[1].Frame, container.Subviews[2].Frame) == CGRect.Empty); - Assert.False(CGRect.Intersect(container.Subviews[0].Frame, container.Subviews[2].Frame) == CGRect.Empty); - - float totalWidth = 0; - foreach (var view in container.Subviews) - totalWidth += (float)view.Bounds.Size.Width; - - Assert.AreEqual(containerSize.Width, totalWidth, $"The container's width is {containerSize.Width}, the subviews take up {totalWidth}"); - } - - - [Test] - public void TestThatLayoutIsCorrectWhenWeSwapViewOrder() - { - var containerSize = new SizeF(300, 50); - - var container = new NativeView(new CGRect(0, 0, containerSize.Width, containerSize.Height)); - container.Yoga().IsEnabled = true; - container.Yoga().FlexDirection = YogaFlexDirection.Row; - - var subview1 = new NativeView(); - subview1.Yoga().IsEnabled = true; - subview1.Yoga().FlexGrow = 1; - container.AddSubview(subview1); - - var subview2 = new NativeView(); - subview2.Yoga().IsEnabled = true; - subview2.Yoga().FlexGrow = 1; - container.AddSubview(subview2); - - var subview3 = new NativeView(); - subview3.Yoga().IsEnabled = true; - subview3.Yoga().FlexGrow = 1; - container.AddSubview(subview3); - - container.Yoga().ApplyLayout(); - - Assert.True(subview1.Frame == new CGRect(0, 0, 100, 50)); - Assert.True(subview2.Frame == new CGRect(100, 0, 100, 50), $"It's actually {subview2.Frame}"); - Assert.True(subview3.Frame == new CGRect(200, 0, 100, 50)); - - container.ExchangeSubview(2, 0); - subview2.Yoga().IsIncludeInLayout = false; - container.Yoga().ApplyLayout(); - - Assert.True(subview3.Frame == new CGRect(0, 0, 150, 50)); - Assert.True(subview1.Frame == new CGRect(150, 0, 150, 50)); - //// this frame shouldn't have been modified since last time. - Assert.True(subview2.Frame == new CGRect(100, 0, 100, 50)); - } - - [Test] - public void TestThatWeRespectIncludeInLayoutFlag() - { - var containerSize = new SizeF(300, 50); - - var container = new NativeView(new CGRect(0, 0, containerSize.Width, containerSize.Height)); - container.Yoga().IsEnabled = true; - container.Yoga().FlexDirection = YogaFlexDirection.Row; - - var subview1 = new NativeView(); - subview1.Yoga().IsEnabled = true; - subview1.Yoga().FlexGrow = 1; - container.AddSubview(subview1); - - var subview2 = new NativeView(); - subview2.Yoga().IsEnabled = true; - subview2.Yoga().FlexGrow = 1; - container.AddSubview(subview2); - - var subview3 = new NativeView(); - subview3.Yoga().IsEnabled = true; - subview3.Yoga().FlexGrow = 1; - container.AddSubview(subview3); - - container.Yoga().ApplyLayout(); - - foreach (var view in container.Subviews) - { - Assert.True(new CGSize(100, 50) == view.Bounds.Size, $"Actual size is {view.Bounds.Size}"); - } - - subview3.Yoga().IsIncludeInLayout = false; - container.Yoga().ApplyLayout(); - Assert.True(subview1.Frame.Size == new CGSize(150, 50), $"Actual size is {subview1.Frame.Size}"); - Assert.True(subview2.Frame.Size == new CGSize(150, 50), $"Actual size is {subview2.Frame.Size}"); - //// We don't set the frame to zero, so, it should be set to what it was previously at. - Assert.True(subview3.Frame.Size == new CGSize(100, 50), $"Actual size is {subview3.Frame.Size}"); - } - - [Test] - public void TestThatNumberOfChildrenIsCorrectWhenWeIgnoreSubviews() - { - var container = new NativeView(); - container.Yoga().IsEnabled = true; - container.Yoga().FlexDirection = YogaFlexDirection.Row; - - var subview1 = new NativeView(); - subview1.Yoga().IsEnabled = true; - subview1.Yoga().IsIncludeInLayout = false; - container.AddSubview(subview1); - - var subview2 = new NativeView(); - subview2.Yoga().IsEnabled = true; - subview2.Yoga().IsIncludeInLayout = false; - container.AddSubview(subview2); - - var subview3 = new NativeView(); - subview3.Yoga().IsEnabled = true; - subview3.Yoga().IsIncludeInLayout = true; - container.AddSubview(subview3); - - container.Yoga().ApplyLayout(); - Assert.AreEqual(1, container.Yoga().NumberOfChildren); - - subview2.Yoga().IsIncludeInLayout = true; - container.Yoga().ApplyLayout(); - Assert.AreEqual(2, container.Yoga().NumberOfChildren); - } - - [Test] - public void TestThatViewNotIncludedInFirstLayoutPassAreIncludedInSecond() - { - var containerSize = new SizeF(300, 50); - - var container = new NativeView(new CGRect(0, 0, containerSize.Width, containerSize.Height)); - container.Yoga().IsEnabled = true; - container.Yoga().FlexDirection = YogaFlexDirection.Row; - - var subview1 = new NativeView(); - subview1.Yoga().IsEnabled = true; - subview1.Yoga().FlexGrow = 1; - container.AddSubview(subview1); - - var subview2 = new NativeView(); - subview2.Yoga().IsEnabled = true; - subview2.Yoga().FlexGrow = 1; - container.AddSubview(subview2); - - var subview3 = new NativeView(); - subview3.Yoga().IsEnabled = true; - subview3.Yoga().FlexGrow = 1; - subview3.Yoga().IsIncludeInLayout = false; - container.AddSubview(subview3); - - container.Yoga().ApplyLayout(); - - Assert.True(subview1.Frame.Size == new CGSize(150, 50), $"Actual size is {subview1.Frame.Size}"); - Assert.True(subview2.Frame.Size == new CGSize(150, 50), $"Actual size is {subview2.Frame.Size}"); - Assert.True(subview3.Frame.Size == CGSize.Empty, $"Actual size is {subview3.Frame.Size}"); - - subview3.Yoga().IsIncludeInLayout = true; - container.Yoga().ApplyLayout(); - - foreach (var view in container.Subviews) - { - Assert.True(new CGSize(100, 50) == view.Bounds.Size, $"Actual size is {view.Bounds.Size}"); - } - } - - [Test] - public void TestYogaIsLeafFlag() - { - var view = new NativeView(); - Assert.True(view.Yoga().IsLeaf); - - for (int i = 0; i < 10; i++) - { - var subView = new NativeView(); - view.AddSubview(subView); - } - Assert.True(view.Yoga().IsLeaf); - view.Yoga().IsEnabled = true; - view.Yoga().Width = 50.0f; - Assert.True(view.Yoga().IsLeaf); - - var subView1 = view.Subviews[0]; - subView1.Yoga().IsEnabled = true; - subView1.Yoga().Width = 50.0f; - Assert.False(view.Yoga().IsLeaf); - } - - [Test] - public void TestThatWeCorrectlyAttachNestedViews() - { - var containerSize = new SizeF(300, 50); - - var container = new NativeView(new CGRect(0, 0, containerSize.Width, containerSize.Height)); - container.Yoga().IsEnabled = true; - container.Yoga().FlexDirection = YogaFlexDirection.Column; - - var subview1 = new NativeView(); - subview1.Yoga().IsEnabled = true; - subview1.Yoga().Width = 100; - subview1.Yoga().FlexGrow = 1; - subview1.Yoga().FlexDirection = YogaFlexDirection.Column; - container.AddSubview(subview1); - - var subview2 = new NativeView(); - subview2.Yoga().IsEnabled = true; - subview2.Yoga().Width = 150; - subview2.Yoga().FlexGrow = 1; - subview2.Yoga().FlexDirection = YogaFlexDirection.Column; - container.AddSubview(subview2); - - foreach (var view in new NativeView[] { subview1, subview2 }) - { - var someView = new NativeView(); - someView.Yoga().IsEnabled = true; - someView.Yoga().FlexGrow = 1; - view.AddSubview(someView); - } - container.Yoga().ApplyLayout(); - - // Add the same amount of new views, reapply layout. - foreach (var view in new NativeView[] { subview1, subview2 }) - { - var someView = new NativeView(); - someView.Yoga().IsEnabled = true; - someView.Yoga().FlexGrow = 1; - view.AddSubview(someView); - } - container.Yoga().ApplyLayout(); - - Assert.True(new CGSize(100, 25) == subview1.Bounds.Size, $"Actual size is {subview1.Bounds.Size}"); - foreach (var subview in subview1.Subviews) - { - var subviewSize = subview.Bounds.Size; - Assert.False(subviewSize.IsEmpty); - Assert.False(nfloat.IsNaN(subviewSize.Height)); - Assert.False(nfloat.IsNaN(subviewSize.Width)); - } - - Assert.True(new CGSize(150, 25) == subview2.Bounds.Size, $"Actual size is {subview2.Bounds.Size}"); - foreach (var subview in subview2.Subviews) - { - var subviewSize = subview.Bounds.Size; - Assert.False(subviewSize.IsEmpty); - Assert.False(nfloat.IsNaN(subviewSize.Height)); - Assert.False(nfloat.IsNaN(subviewSize.Width)); - } - } - - [Test] - public void TestThatANonLeafNodeCanBecomeALeafNode() - { - var containerSize = new SizeF(300, 50); - - var container = new NativeView(new CGRect(0, 0, containerSize.Width, containerSize.Height)); - container.Yoga().IsEnabled = true; - - var subview1 = new NativeView(); - subview1.Yoga().IsEnabled = true; - container.AddSubview(subview1); - - var subview2 = new NativeView(); - subview2.Yoga().IsEnabled = true; - container.AddSubview(subview2); - container.Yoga().ApplyLayout(); - subview2.RemoveFromSuperview(); - container.Yoga().ApplyLayout(); - } - } -} diff --git a/enums.py b/enums.py index 883daf25d1..3d69acb03e 100755 --- a/enums.py +++ b/enums.py @@ -222,22 +222,6 @@ def to_hyphenated_lower(symbol): f.write(" }\n") f.write("}\n") -# write out csharp files -for name, values in sorted(ENUMS.items()): - with open(root + "/csharp/Facebook.Yoga/Yoga%s.cs" % name, "w") as f: - f.write(get_license("cs")) - f.write("namespace Facebook.Yoga\n{\n") - if isinstance(next(iter(values or []), None), tuple): - f.write(" [System.Flags]\n") - f.write(" public enum Yoga%s\n {\n" % name) - for value in values: - if isinstance(value, tuple): - f.write(" %s = %d,\n" % (value[0], value[1])) - else: - f.write(" %s,\n" % value) - f.write(" }\n") - f.write("}\n") - # write out TypeScript file with open(root + "/javascript/src/generated/YGEnums.ts", "w") as f: f.write(get_license("js")) diff --git a/gentest/gentest-cs.js b/gentest/gentest-cs.js deleted file mode 100644 index f6eb3f327f..0000000000 --- a/gentest/gentest-cs.js +++ /dev/null @@ -1,265 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function toValueCs(value) { - var n = value.toString().replace('px','').replace('%',''); - return n + (Number(n) == n && n % 1 !== 0 ? 'f' : ''); -} - -function toCsUnitValue(value) { - var methodName = ''; - if (value.indexOf('%') >= 0){ - methodName = '.Percent()'; - } - if(value.indexOf('Auto') >= 0){ - return 'YogaValue.Auto()'; - } - return toValueCs(value) + methodName; -} - -var CSEmitter = function() { - Emitter.call(this, 'cs', ' '); -}; - -CSEmitter.prototype = Object.create(Emitter.prototype, { - constructor:{value:CSEmitter}, - - emitPrologue:{value:function() { - this.push([ - 'using System;', - 'using NUnit.Framework;', - '', - 'namespace Facebook.Yoga', - '{', - ]); - this.pushIndent(); - this.push([ - '[TestFixture]', - 'public class YogaTest', - '{', - ]); - this.pushIndent(); - }}, - - emitTestPrologue:{value:function(name, experiments, disabled) { - this.push('[Test]'); - if (disabled) { - this.push('[Ignore]'); - } - this.push('public void Test_' + name + '()'); - this.push('{'); - this.pushIndent(); - - this.push('YogaConfig config = new YogaConfig();') - for (var i in experiments) { - this.push('config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.' + experiments[i] +', true);'); - } - this.push(''); - }}, - - emitTestTreePrologue:{value:function(nodeName) { - this.push('YogaNode ' + nodeName + ' = new YogaNode(config);'); - }}, - - emitTestEpilogue:{value:function(experiments) { - - this.popIndent(); - this.push([ - '}', - '', - ]); - }}, - - emitEpilogue:{value:function(lines) { - this.popIndent(); - this.push('}'); - this.popIndent(); - this.push([ - '}', - '', - ]); - }}, - - AssertEQ:{value:function(v0, v1) { - this.push('Assert.AreEqual(' + v0 + 'f, ' + v1 + ');'); - }}, - - YGAlignAuto:{value:'YogaAlign.Auto'}, - YGAlignCenter:{value:'YogaAlign.Center'}, - YGAlignFlexEnd:{value:'YogaAlign.FlexEnd'}, - YGAlignFlexStart:{value:'YogaAlign.FlexStart'}, - YGAlignStretch:{value:'YogaAlign.Stretch'}, - YGAlignSpaceBetween:{value:'YogaAlign.SpaceBetween'}, - YGAlignSpaceAround:{value:'YogaAlign.SpaceAround'}, - YGAlignBaseline:{value:'YogaAlign.Baseline'}, - - YGDirectionInherit:{value:'YogaDirection.Inherit'}, - YGDirectionLTR:{value:'YogaDirection.LTR'}, - YGDirectionRTL:{value:'YogaDirection.RTL'}, - - YGEdgeBottom:{value:'Bottom'}, - YGEdgeEnd:{value:'End'}, - YGEdgeLeft:{value:'Left'}, - YGEdgeRight:{value:'Right'}, - YGEdgeStart:{value:'Start'}, - YGEdgeTop:{value:'Top'}, - - YGGutterAll:{value:''}, - YGGutterColumn:{value:'Column'}, - YGGutterRow:{value:'Row'}, - - YGFlexDirectionColumn:{value:'YogaFlexDirection.Column'}, - YGFlexDirectionColumnReverse:{value:'YogaFlexDirection.ColumnReverse'}, - YGFlexDirectionRow:{value:'YogaFlexDirection.Row'}, - YGFlexDirectionRowReverse:{value:'YogaFlexDirection.RowReverse'}, - - YGJustifyCenter:{value:'YogaJustify.Center'}, - YGJustifyFlexEnd:{value:'YogaJustify.FlexEnd'}, - YGJustifyFlexStart:{value:'YogaJustify.FlexStart'}, - YGJustifySpaceAround:{value:'YogaJustify.SpaceAround'}, - YGJustifySpaceBetween:{value:'YogaJustify.SpaceBetween'}, - YGJustifySpaceEvenly:{value:'YogaJustify.SpaceEvenly'}, - - YGOverflowHidden:{value:'YogaOverflow.Hidden'}, - YGOverflowVisible:{value:'YogaOverflow.Visible'}, - - YGPositionTypeAbsolute:{value:'YogaPositionType.Static'}, - YGPositionTypeRelative:{value:'YogaPositionType.Relative'}, - YGPositionTypeAbsolute:{value:'YogaPositionType.Absolute'}, - - YGUndefined:{value:'YogaConstants.Undefined'}, - - YGAuto:{value:'YogaConstants.Auto'}, - - YGDisplayFlex:{value:'YogaDisplay.Flex'}, - YGDisplayNone:{value:'YogaDisplay.None'}, - - YGWrapNoWrap:{value:'YogaWrap.NoWrap'}, - YGWrapWrap:{value:'YogaWrap.Wrap'}, - YGWrapWrapReverse:{value: 'YogaWrap.WrapReverse'}, - - YGNodeCalculateLayout:{value:function(node, dir, experiments) { - this.push(node + '.StyleDirection = ' + dir + ';'); - this.push(node + '.CalculateLayout();'); - }}, - - YGNodeInsertChild:{value:function(parentName, nodeName, index) { - this.push(parentName + '.Insert(' + index + ', ' + nodeName + ');'); - }}, - - YGNodeLayoutGetLeft:{value:function(nodeName) { - return nodeName + '.LayoutX'; - }}, - - YGNodeLayoutGetTop:{value:function(nodeName) { - return nodeName + '.LayoutY'; - }}, - - YGNodeLayoutGetWidth:{value:function(nodeName) { - return nodeName + '.LayoutWidth'; - }}, - - YGNodeLayoutGetHeight:{value:function(nodeName) { - return nodeName + '.LayoutHeight'; - }}, - - YGNodeStyleSetAlignContent:{value:function(nodeName, value) { - this.push(nodeName + '.AlignContent = ' + toValueCs(value) + ';'); - }}, - - YGNodeStyleSetAlignItems:{value:function(nodeName, value) { - this.push(nodeName + '.AlignItems = ' + toValueCs(value) + ';'); - }}, - - YGNodeStyleSetAlignSelf:{value:function(nodeName, value) { - this.push(nodeName + '.AlignSelf = ' + toValueCs(value) + ';'); - }}, - - YGNodeStyleSetBorder:{value:function(nodeName, edge, value) { - this.push(nodeName + '.Border' + edge + 'Width = ' + toValueCs(value) + ';'); - }}, - - YGNodeStyleSetDirection:{value:function(nodeName, value) { - this.push(nodeName + '.StyleDirection = ' + toValueCs(value) + ';'); - }}, - - YGNodeStyleSetDisplay:{value:function(nodeName, value) { - this.push(nodeName + '.Display = ' + toValueCs(value) + ';'); - }}, - - YGNodeStyleSetFlexBasis:{value:function(nodeName, value) { - this.push(nodeName + '.FlexBasis = ' + toCsUnitValue(value) + ';'); - }}, - - YGNodeStyleSetFlexDirection:{value:function(nodeName, value) { - this.push(nodeName + '.FlexDirection = ' + toValueCs(value) + ';'); - }}, - - YGNodeStyleSetFlexGrow:{value:function(nodeName, value) { - this.push(nodeName + '.FlexGrow = ' + toValueCs(value) + ';'); - }}, - - YGNodeStyleSetFlexShrink:{value:function(nodeName, value) { - this.push(nodeName + '.FlexShrink = ' + toValueCs(value) + ';'); - }}, - - YGNodeStyleSetFlexWrap:{value:function(nodeName, value) { - this.push(nodeName + '.Wrap = ' + toValueCs(value) + ';'); - }}, - - YGNodeStyleSetHeight:{value:function(nodeName, value) { - this.push(nodeName + '.Height = ' + toCsUnitValue(value) + ';'); - }}, - - YGNodeStyleSetJustifyContent:{value:function(nodeName, value) { - this.push(nodeName + '.JustifyContent = ' + toValueCs(value) + ';'); - }}, - - YGNodeStyleSetMargin:{value:function(nodeName, edge, value) { - this.push(nodeName + '.Margin' + edge + ' = ' + toCsUnitValue(value) + ';'); - }}, - - YGNodeStyleSetMaxHeight:{value:function(nodeName, value) { - this.push(nodeName + '.MaxHeight = ' + toCsUnitValue(value) + ';'); - }}, - - YGNodeStyleSetMaxWidth:{value:function(nodeName, value) { - this.push(nodeName + '.MaxWidth = ' + toCsUnitValue(value) + ';'); - }}, - - YGNodeStyleSetMinHeight:{value:function(nodeName, value) { - this.push(nodeName + '.MinHeight = ' + toCsUnitValue(value) + ';'); - }}, - - YGNodeStyleSetMinWidth:{value:function(nodeName, value) { - this.push(nodeName + '.MinWidth = ' + toCsUnitValue(value) + ';'); - }}, - - YGNodeStyleSetOverflow:{value:function(nodeName, value) { - this.push(nodeName + '.Overflow = ' + toValueCs(value) + ';'); - }}, - - YGNodeStyleSetPadding:{value:function(nodeName, edge, value) { - this.push(nodeName + '.Padding' + edge + ' = ' + toCsUnitValue(value) + ';'); - }}, - - YGNodeStyleSetPosition:{value:function(nodeName, edge, value) { - this.push(nodeName + '.' + edge + ' = ' + toCsUnitValue(value) + ';'); - }}, - - YGNodeStyleSetPositionType:{value:function(nodeName, value) { - this.push(nodeName + '.PositionType = ' + toValueCs(value) + ';'); - }}, - - YGNodeStyleSetWidth:{value:function(nodeName, value) { - this.push(nodeName + '.Width = ' + toCsUnitValue(value) + ';'); - }}, - - YGNodeStyleSetGap:{value:function(nodeName, gap, value) { - this.push(nodeName + '.' + gap + 'Gap' + ' = ' + toCsUnitValue(value) + ';'); - }}, -}); diff --git a/gentest/gentest.js b/gentest/gentest.js index 255735b1ec..1d7efbae0a 100755 --- a/gentest/gentest.js +++ b/gentest/gentest.js @@ -27,13 +27,6 @@ window.onload = function() { document.body.children[1], document.body.children[2]); - printTest( - new CSEmitter(), - 'cs', - document.body.children[0], - document.body.children[1], - document.body.children[2]); - printTest( new JavascriptEmitter(), 'js', diff --git a/gentest/gentest.rb b/gentest/gentest.rb index 4cc7f301fa..597853fafb 100644 --- a/gentest/gentest.rb +++ b/gentest/gentest.rb @@ -50,14 +50,10 @@ f.write eval(logs[1].message.sub(/^[^"]*/, '')).sub('YogaTest', name) f.close - f = File.open("../csharp/tests/Facebook.Yoga/#{name}.cs", 'w') - f.write eval(logs[2].message.sub(/^[^"]*/, '')).sub('YogaTest', name) - f.close - - print logs[4] + print logs[3] f = File.open("../javascript/tests/generated/#{name}.test.ts", 'w') - f.write eval(logs[3].message.sub(/^[^"]*/, '')).sub('YogaTest', name) + f.write eval(logs[2].message.sub(/^[^"]*/, '')).sub('YogaTest', name) f.close end File.delete('test.html') diff --git a/gentest/test-template.html b/gentest/test-template.html index cb01b8c4cf..cab620beb2 100644 --- a/gentest/test-template.html +++ b/gentest/test-template.html @@ -6,7 +6,6 @@ -