diff --git a/Package.swift b/Package.swift
index 80a3b1f139..d278bd7867 100644
--- a/Package.swift
+++ b/Package.swift
@@ -1,5 +1,12 @@
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
+/*
+ * 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.
+ */
+
import PackageDescription
@@ -31,9 +38,9 @@ let package = Package(
name: "YogaKitSwift",
dependencies: ["YogaKit", "Yoga"],
path: ".",
- exclude: ["yoga/include/Yoga.modulemap"],
sources: ["YogaKit/YogaKit.Swift"],
cSettings: [
+ .headerSearchPath("."),
.headerSearchPath("yoga")
]),
.target(
@@ -49,13 +56,12 @@ let package = Package(
.target(
name: "Yoga",
path: ".",
+ exclude: ["yoga/Yoga.h"],
sources: ["yoga"],
publicHeadersPath: "yoga/include",
cSettings: [
.headerSearchPath(".")
])
],
- swiftLanguageVersions: [.v5],
- cLanguageStandard: .gnu11,
- cxxLanguageStandard: .gnucxx14
+ cxxLanguageStandard: CXXLanguageStandard(rawValue: "c++20")
)
diff --git a/README.md b/README.md
index 527879ff51..83fa6459bd 100644
--- a/README.md
+++ b/README.md
@@ -1,74 +1,35 @@
-# Yoga [![CocoaPods](https://img.shields.io/cocoapods/v/YogaKit.svg)](http://cocoapods.org/pods/YogaKit) [![npm](https://img.shields.io/npm/v/yoga-layout.svg)](https://www.npmjs.com/package/yoga-layout) [![bintray](https://img.shields.io/bintray/v/facebook/maven/com.facebook.yoga:yoga.svg)](https://bintray.com/facebook/maven/com.facebook.yoga%3Ayoga/_latestVersion) [![NuGet](https://img.shields.io/nuget/v/Facebook.Yoga.svg)](https://www.nuget.org/packages/Facebook.Yoga)
+# Yoga [![CocoaPods](https://img.shields.io/cocoapods/v/Yoga.svg)](http://cocoapods.org/pods/Yoga) [![npm](https://img.shields.io/npm/v/yoga-layout.svg)](https://www.npmjs.com/package/yoga-layout) [![Maven Central](https://img.shields.io/maven-central/v/com.facebook.yoga/yoga)](https://search.maven.org/artifact/com.facebook.yoga/yoga) ![SPM](https://img.shields.io/badge/SPM-Supported-blue.svg)
-## Building
-Yoga builds with [buck](https://buckbuild.com). Make sure you install buck before contributing to Yoga. Yoga's main implementation is in C++, with bindings to supported languages and frameworks. When making changes to Yoga please ensure the changes are also propagated to these bindings when applicable.
-
-## Testing
-For testing we rely on [gtest](https://github.com/google/googletest) as a submodule. After cloning Yoga run `git submodule init` followed by `git submodule update`.
+Yoga is an embeddable and performant flexbox layout engine with bindings for multiple languages.
-For any changes you make you should ensure that all the tests are passing. In case you make any fixes or additions to the library please also add tests for that change to ensure we don't break anything in the future. Tests are located in the `tests` directory. Run the tests by executing `buck test //:yoga`.
+## Building
-Instead of manually writing a test which ensures parity with web implementations of Flexbox you can run `gentest/gentest.rb` to generate a test for you. You can write html which you want to verify in Yoga, in `gentest/fixtures` folder, such as the following.
+Yoga's main implementation targets C++ 20 with accompanying build logic in CMake. A wrapper is provided to build the main library and run unit tests.
-```html
-
+```sh
+./unit_tests
```
-Run `gentest/gentest.rb` to generate test code and re-run `buck test //:yoga` to validate the behavior. One test case will be generated for every root `div` in the input html.
+While not required, this script will use [ninja](https://ninja-build.org/) if it is installed for faster builds.
-You may need to install the latest watir-webdriver gem (`gem install watir-webdriver`) and [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/) to run `gentest/gentest.rb` Ruby script.
+Yoga is additionally part of the [vcpkg](https://github.com/Microsoft/vcpkg/) collection of ports maintained by Microsoft and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
-### .NET
-.NET testing is not integrated in buck yet, you might need to set up .NET testing environment. We have a script which to launch C# test on macOS, `csharp/tests/Facebook.Yoga/test_macos.sh`.
+## Adding Tests
-## Benchmarks
-Benchmarks are located in `benchmark/YGBenchmark.c` and can be run with `buck run //benchmark:benchmark`. If you think your change has affected performance please run this before and after your change to validate that nothing has regressed. Benchmarks are run on every commit in CI.
+Many of Yoga's tests are automatically generated, using HTML fixtures describing node structure. These are rendered in Chrome to generate an expected layout result for the tree. New fixtures can be added to `gentest/fixtures`.
-### JavaScript
-Installing through NPM
-```sh
-npm install yoga-layout
-```
-By default this will install the library and try to build for all platforms (node, browser asm, and standalone webpack). You may receive errors if you do not have the required platform development tools already installed. To preset the platform you'd like to build for you can set a .npmrc property first.
-```sh
-npm config set yoga-layout:platform standalone
+```html
+
```
-This will now only run the standalone webpack build upon install.
-
-## Build Platforms
-| name | description |
-|----------------|-------------------------------------------------|
-| all (default) | Builds all of these platforms. |
-| browser | Builds asm js browser version. |
-| node | Builds node js version. |
-| standalone | Runs webpack. |
-| none | Does nothing. You can use the prepackaged libs. |
+To generate new tests from added fixtures:
-## Maintainer Release Guide
+1. Ensure you have [yarn classic](https://classic.yarnpkg.com) installed.
+2. Run `yarn install` to install dependencies for the test generator.
+3. Run `yarn gentest` in the `yoga` directory.
-To publish a new release, follow these steps:
-
-1. Ensure you have your GPG key set up and your [OSS Sonatype](https://oss.sonatype.org/) credentials handy.
-2. Add the follow entries to either your local `gradle.properties` (don't forget to revert) or your global `~/.gradle/gradle.properties`:
-
-```
-# You get these from https://oss.sonatype.org/#profile;User%20Token
-mavenCentralRepositoryUsername=
-mavenCentralRepositoryPassword=
-
-# You can get the keyId (in GPG 1.4 format) by running `gpg1 --list-keys`.
-signing.secretKeyRingFile=
-signing.keyId=
-signing.password=
-```
+## Debugging
-3. Change the `VERSION_NAME` in `gradle.properties` to a non-SNAPSHOT release.
-4. Commit and land the version change.
-5. Run `./gradlew publishToMaven`.
-6. Run `./gradlew closeAndReleaseRepository`.
-7. Change the `VERSION_NAME` in `gradle.properties` back to a new SNAPSHOT release.
-8. Commit and land the version change.
-9. Celebrate! You've made a release!
+Yoga provides a VSCode "launch.json" configuration which allows debugging unit tests. Simply add your breakpoints, and run "Debug C++ Unit tests (lldb)" (or "Debug C++ Unit tests (vsdbg)" on Windows).
diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m
index d1d15dcfe7..494d1ddf96 100644
--- a/YogaKit/Source/YGLayout.m
+++ b/YogaKit/Source/YGLayout.m
@@ -387,7 +387,7 @@ - (void)configureLayoutWithBlock:(NS_NOESCAPE YGLayoutConfigurationBlock)block {
#pragma mark - Private
-static YGSize YGMeasureView(YGNodeRef node, double width, YGMeasureMode widthMode, double height, YGMeasureMode heightMode) {
+static YGSize YGMeasureView(YGNodeConstRef node, double width, YGMeasureMode widthMode, double height, YGMeasureMode heightMode) {
const CGFloat constrainedWidth = (widthMode == YGMeasureModeUndefined) ? CGFLOAT_MAX : width;
const CGFloat constrainedHeight = (heightMode == YGMeasureModeUndefined) ? CGFLOAT_MAX : height;
diff --git a/YogaKit/Tests/YogaKitTests.m b/YogaKit/Tests/YogaKitTests.m
index c78e509699..19fb35008e 100644
--- a/YogaKit/Tests/YogaKitTests.m
+++ b/YogaKit/Tests/YogaKitTests.m
@@ -279,11 +279,9 @@ - (void)testMarkingDirtyOnlyWorksOnLeafNodes {
subview.yoga.isIncludedInLayout = YES;
[container addSubview:subview];
- XCTAssertFalse(container.yoga.isDirty);
[container.yoga markDirty];
- XCTAssertFalse(container.yoga.isDirty);
+ XCTAssertTrue(container.yoga.isDirty);
- XCTAssertFalse(subview.yoga.isDirty);
[subview.yoga markDirty];
XCTAssertTrue(subview.yoga.isDirty);
}
diff --git a/YogaKit/YogaKit.xcodeproj/project.pbxproj b/YogaKit/YogaKit.xcodeproj/project.pbxproj
index dccc6d1e95..3e3e74238c 100644
--- a/YogaKit/YogaKit.xcodeproj/project.pbxproj
+++ b/YogaKit/YogaKit.xcodeproj/project.pbxproj
@@ -10,13 +10,87 @@
1511C08C251ED11900A2C621 /* Yoga.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15865FFE24E58BD800345BD7 /* Yoga.framework */; settings = {ATTRIBUTES = (Required, ); }; };
1511C0BB251F1BB600A2C621 /* YGLayoutProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1511C0BA251F1BB600A2C621 /* YGLayoutProperties.swift */; };
153098C22692ED29009B4135 /* YGValueExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 153098C12692ED29009B4135 /* YGValueExtensions.swift */; };
- 153098CA26930BAF009B4135 /* Yoga-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 153098C826930BAE009B4135 /* Yoga-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
153B526524E6AD8D008156D3 /* YogaKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 153B526324E6AD8D008156D3 /* YogaKitTests.m */; };
153B526B24E6ADFA008156D3 /* Yoga.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15865FFE24E58BD800345BD7 /* Yoga.framework */; };
153B526C24E6ADFA008156D3 /* YogaKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15865F5424E5834E00345BD7 /* YogaKit.framework */; };
153B526E24E6AECF008156D3 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 153B526D24E6AECF008156D3 /* libc++.tbd */; };
154A6EF524E6B1260091264C /* dummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 154A6EF424E6B1260091264C /* dummy.swift */; };
154D2C9A269362600027364F /* YogaKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15865F5424E5834E00345BD7 /* YogaKit.framework */; settings = {ATTRIBUTES = (Required, ); }; };
+ 157283692D4397EB00F20253 /* Node.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1572834C2D4397EB00F20253 /* Node.cpp */; };
+ 1572836A2D4397EB00F20253 /* Cache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1572831A2D4397EB00F20253 /* Cache.cpp */; };
+ 1572836B2D4397EB00F20253 /* YGEnums.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1572835B2D4397EB00F20253 /* YGEnums.cpp */; };
+ 1572836C2D4397EB00F20253 /* Baseline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 157283172D4397EB00F20253 /* Baseline.cpp */; };
+ 1572836D2D4397EB00F20253 /* event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 157283442D4397EB00F20253 /* event.cpp */; };
+ 1572836E2D4397EB00F20253 /* PixelGrid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 157283212D4397EB00F20253 /* PixelGrid.cpp */; };
+ 1572836F2D4397EB00F20253 /* Config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 157283272D4397EB00F20253 /* Config.cpp */; };
+ 157283702D4397EB00F20253 /* Log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1572832C2D4397EB00F20253 /* Log.cpp */; };
+ 157283712D4397EB00F20253 /* YGConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 157283592D4397EB00F20253 /* YGConfig.cpp */; };
+ 157283722D4397EB00F20253 /* YGPixelGrid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 157283642D4397EB00F20253 /* YGPixelGrid.cpp */; };
+ 157283732D4397EB00F20253 /* AbsoluteLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 157283142D4397EB00F20253 /* AbsoluteLayout.cpp */; };
+ 157283742D4397EB00F20253 /* AssertFatal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1572832A2D4397EB00F20253 /* AssertFatal.cpp */; };
+ 157283752D4397EB00F20253 /* YGNodeLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 157283602D4397EB00F20253 /* YGNodeLayout.cpp */; };
+ 157283762D4397EB00F20253 /* YGValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 157283662D4397EB00F20253 /* YGValue.cpp */; };
+ 157283772D4397EB00F20253 /* LayoutResults.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1572834A2D4397EB00F20253 /* LayoutResults.cpp */; };
+ 157283782D4397EB00F20253 /* YGNodeStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 157283622D4397EB00F20253 /* YGNodeStyle.cpp */; };
+ 157283792D4397EB00F20253 /* YGNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1572835E2D4397EB00F20253 /* YGNode.cpp */; };
+ 1572837A2D4397EB00F20253 /* FlexLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1572831F2D4397EB00F20253 /* FlexLine.cpp */; };
+ 1572837B2D4397EB00F20253 /* CalculateLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1572831C2D4397EB00F20253 /* CalculateLayout.cpp */; };
+ 1572837C2D4397EB00F20253 /* YGEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572835A2D4397EB00F20253 /* YGEnums.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 1572837D2D4397EB00F20253 /* Dimension.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283302D4397EB00F20253 /* Dimension.h */; };
+ 1572837E2D4397EB00F20253 /* FlexDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572831D2D4397EB00F20253 /* FlexDirection.h */; };
+ 1572837F2D4397EB00F20253 /* Gutter.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283372D4397EB00F20253 /* Gutter.h */; };
+ 157283802D4397EB00F20253 /* LayoutableChildren.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283482D4397EB00F20253 /* LayoutableChildren.h */; };
+ 157283812D4397EB00F20253 /* NodeType.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572833B2D4397EB00F20253 /* NodeType.h */; };
+ 157283822D4397EB00F20253 /* Wrap.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283402D4397EB00F20253 /* Wrap.h */; };
+ 157283832D4397EB00F20253 /* PixelGrid.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283202D4397EB00F20253 /* PixelGrid.h */; };
+ 157283842D4397EB00F20253 /* Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283672D4397EB00F20253 /* Yoga.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 157283852D4397EB00F20253 /* YGMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572835C2D4397EB00F20253 /* YGMacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 157283862D4397EB00F20253 /* Align.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283152D4397EB00F20253 /* Align.h */; };
+ 157283872D4397EB00F20253 /* Overflow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572833C2D4397EB00F20253 /* Overflow.h */; };
+ 157283882D4397EB00F20253 /* StyleValuePool.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283562D4397EB00F20253 /* StyleValuePool.h */; };
+ 157283892D4397EB00F20253 /* Justify.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283382D4397EB00F20253 /* Justify.h */; };
+ 1572838A2D4397EB00F20253 /* Log.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572832B2D4397EB00F20253 /* Log.h */; };
+ 1572838B2D4397EB00F20253 /* LayoutResults.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283492D4397EB00F20253 /* LayoutResults.h */; };
+ 1572838C2D4397EB00F20253 /* StyleSizeLength.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283542D4397EB00F20253 /* StyleSizeLength.h */; };
+ 1572838D2D4397EB00F20253 /* Config.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283262D4397EB00F20253 /* Config.h */; };
+ 1572838E2D4397EB00F20253 /* Direction.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283312D4397EB00F20253 /* Direction.h */; };
+ 1572838F2D4397EB00F20253 /* ExperimentalFeature.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283352D4397EB00F20253 /* ExperimentalFeature.h */; };
+ 157283902D4397EB00F20253 /* Display.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283322D4397EB00F20253 /* Display.h */; };
+ 157283912D4397EB00F20253 /* SizingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283222D4397EB00F20253 /* SizingMode.h */; };
+ 157283922D4397EB00F20253 /* YGPixelGrid.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283632D4397EB00F20253 /* YGPixelGrid.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 157283932D4397EB00F20253 /* MeasureMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572833A2D4397EB00F20253 /* MeasureMode.h */; };
+ 157283942D4397EB00F20253 /* TrailingPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283232D4397EB00F20253 /* TrailingPosition.h */; };
+ 157283952D4397EB00F20253 /* Align.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572832E2D4397EB00F20253 /* Align.h */; };
+ 157283962D4397EB00F20253 /* SmallValueBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283512D4397EB00F20253 /* SmallValueBuffer.h */; };
+ 157283972D4397EB00F20253 /* YGNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572835D2D4397EB00F20253 /* YGNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 157283982D4397EB00F20253 /* StyleLength.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283532D4397EB00F20253 /* StyleLength.h */; };
+ 157283992D4397EB00F20253 /* CalculateLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572831B2D4397EB00F20253 /* CalculateLayout.h */; };
+ 1572839A2D4397EB00F20253 /* FlexLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572831E2D4397EB00F20253 /* FlexLine.h */; };
+ 1572839B2D4397EB00F20253 /* BoundAxis.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283182D4397EB00F20253 /* BoundAxis.h */; };
+ 1572839C2D4397EB00F20253 /* AbsoluteLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283132D4397EB00F20253 /* AbsoluteLayout.h */; };
+ 1572839D2D4397EB00F20253 /* Edge.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283332D4397EB00F20253 /* Edge.h */; };
+ 1572839E2D4397EB00F20253 /* AssertFatal.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283292D4397EB00F20253 /* AssertFatal.h */; };
+ 1572839F2D4397EB00F20253 /* YGNodeStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283612D4397EB00F20253 /* YGNodeStyle.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 157283A02D4397EB00F20253 /* FlexDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283362D4397EB00F20253 /* FlexDirection.h */; };
+ 157283A12D4397EB00F20253 /* Comparison.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572834E2D4397EB00F20253 /* Comparison.h */; };
+ 157283A22D4397EB00F20253 /* Cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283192D4397EB00F20253 /* Cache.h */; };
+ 157283A32D4397EB00F20253 /* Baseline.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283162D4397EB00F20253 /* Baseline.h */; };
+ 157283A42D4397EB00F20253 /* Errata.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283342D4397EB00F20253 /* Errata.h */; };
+ 157283A52D4397EB00F20253 /* BoxSizing.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572832F2D4397EB00F20253 /* BoxSizing.h */; };
+ 157283A62D4397EB00F20253 /* PositionType.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572833E2D4397EB00F20253 /* PositionType.h */; };
+ 157283A72D4397EB00F20253 /* Unit.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572833F2D4397EB00F20253 /* Unit.h */; };
+ 157283A82D4397EB00F20253 /* YGNodeLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572835F2D4397EB00F20253 /* YGNodeLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 157283A92D4397EB00F20253 /* StyleValueHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283552D4397EB00F20253 /* StyleValueHandle.h */; };
+ 157283AA2D4397EB00F20253 /* YGValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283652D4397EB00F20253 /* YGValue.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 157283AB2D4397EB00F20253 /* LogLevel.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283392D4397EB00F20253 /* LogLevel.h */; };
+ 157283AC2D4397EB00F20253 /* YogaEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283412D4397EB00F20253 /* YogaEnums.h */; };
+ 157283AD2D4397EB00F20253 /* Style.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283522D4397EB00F20253 /* Style.h */; };
+ 157283AE2D4397EB00F20253 /* FloatOptional.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572834F2D4397EB00F20253 /* FloatOptional.h */; };
+ 157283AF2D4397EB00F20253 /* CachedMeasurement.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283472D4397EB00F20253 /* CachedMeasurement.h */; };
+ 157283B02D4397EB00F20253 /* PhysicalEdge.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572833D2D4397EB00F20253 /* PhysicalEdge.h */; };
+ 157283B12D4397EB00F20253 /* Node.h in Headers */ = {isa = PBXBuildFile; fileRef = 1572834B2D4397EB00F20253 /* Node.h */; };
+ 157283B22D4397EB00F20253 /* YGConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283582D4397EB00F20253 /* YGConfig.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 157283B32D4397EB00F20253 /* event.h in Headers */ = {isa = PBXBuildFile; fileRef = 157283432D4397EB00F20253 /* event.h */; };
15865F6624E583F000345BD7 /* YGLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 15865F5F24E583F000345BD7 /* YGLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
15865F6724E583F000345BD7 /* UIView+Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 15865F6024E583F000345BD7 /* UIView+Yoga.h */; settings = {ATTRIBUTES = (Public, ); }; };
15865F6824E583F000345BD7 /* YGLayout+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15865F6124E583F000345BD7 /* YGLayout+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -24,36 +98,6 @@
15865F6A24E583F000345BD7 /* UIView+Yoga.m in Sources */ = {isa = PBXBuildFile; fileRef = 15865F6324E583F000345BD7 /* UIView+Yoga.m */; };
15865F6C24E583F000345BD7 /* YogaKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 15865F6524E583F000345BD7 /* YogaKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
1586600824E58C0F00345BD7 /* Yoga.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15865FFE24E58BD800345BD7 /* Yoga.framework */; settings = {ATTRIBUTES = (Required, ); }; };
- 1586602924E58C3700345BD7 /* Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586600924E58C3600345BD7 /* Utils.cpp */; };
- 1586602A24E58C3700345BD7 /* experiments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586600B24E58C3600345BD7 /* experiments.cpp */; };
- 1586602B24E58C3700345BD7 /* experiments-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586600C24E58C3600345BD7 /* experiments-inl.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1586602C24E58C3700345BD7 /* experiments.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586600D24E58C3600345BD7 /* experiments.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1586602D24E58C3700345BD7 /* YGStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586600E24E58C3600345BD7 /* YGStyle.cpp */; };
- 1586602E24E58C3700345BD7 /* YGNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586600F24E58C3600345BD7 /* YGNode.cpp */; };
- 1586602F24E58C3700345BD7 /* YGConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586601024E58C3600345BD7 /* YGConfig.cpp */; };
- 1586603024E58C3700345BD7 /* Utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601124E58C3600345BD7 /* Utils.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1586603124E58C3700345BD7 /* BitUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601224E58C3600345BD7 /* BitUtils.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1586603224E58C3700345BD7 /* CompactValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601324E58C3600345BD7 /* CompactValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1586603324E58C3700345BD7 /* YGValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586601424E58C3700345BD7 /* YGValue.cpp */; };
- 1586603424E58C3700345BD7 /* YGLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586601524E58C3700345BD7 /* YGLayout.cpp */; };
- 1586603524E58C3700345BD7 /* log.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601624E58C3700345BD7 /* log.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1586603624E58C3700345BD7 /* YGNodePrint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586601724E58C3700345BD7 /* YGNodePrint.cpp */; };
- 1586603724E58C3700345BD7 /* event.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601924E58C3700345BD7 /* event.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1586603824E58C3700345BD7 /* event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586601A24E58C3700345BD7 /* event.cpp */; };
- 1586603924E58C3700345BD7 /* YGNodePrint.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601B24E58C3700345BD7 /* YGNodePrint.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1586603A24E58C3700345BD7 /* Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601C24E58C3700345BD7 /* Yoga.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 1586603B24E58C3700345BD7 /* YGFloatOptional.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601D24E58C3700345BD7 /* YGFloatOptional.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1586603C24E58C3700345BD7 /* YGConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601E24E58C3700345BD7 /* YGConfig.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1586603D24E58C3700345BD7 /* YGMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601F24E58C3700345BD7 /* YGMacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 1586603E24E58C3700345BD7 /* YGEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602024E58C3700345BD7 /* YGEnums.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 1586603F24E58C3700345BD7 /* log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586602124E58C3700345BD7 /* log.cpp */; };
- 1586604024E58C3700345BD7 /* YGStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602224E58C3700345BD7 /* YGStyle.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1586604124E58C3700345BD7 /* Yoga.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586602324E58C3700345BD7 /* Yoga.cpp */; };
- 1586604224E58C3700345BD7 /* Yoga-internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602424E58C3700345BD7 /* Yoga-internal.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1586604324E58C3700345BD7 /* YGValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602524E58C3700345BD7 /* YGValue.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 1586604424E58C3700345BD7 /* YGLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602624E58C3700345BD7 /* YGLayout.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1586604524E58C3700345BD7 /* YGNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602724E58C3700345BD7 /* YGNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1586604624E58C3700345BD7 /* YGEnums.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586602824E58C3700345BD7 /* YGEnums.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -98,7 +142,6 @@
1511C053251EBED100A2C621 /* YogaKitSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = YogaKitSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
1511C0BA251F1BB600A2C621 /* YGLayoutProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YGLayoutProperties.swift; sourceTree = ""; };
153098C12692ED29009B4135 /* YGValueExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YGValueExtensions.swift; sourceTree = ""; };
- 153098C826930BAE009B4135 /* Yoga-umbrella.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Yoga-umbrella.h"; sourceTree = ""; };
153B525B24E6AD6B008156D3 /* YogaKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YogaKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
153B526324E6AD8D008156D3 /* YogaKitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = YogaKitTests.m; path = Tests/YogaKitTests.m; sourceTree = SOURCE_ROOT; };
153B526424E6AD8D008156D3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; name = Info.plist; path = Tests/Info.plist; sourceTree = SOURCE_ROOT; };
@@ -106,6 +149,81 @@
153D326D24E6549A00EDDBEA /* Yoga.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = Yoga.modulemap; sourceTree = ""; };
153D326E24E6549A00EDDBEA /* Yoga-umbrella.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Yoga-umbrella.h"; sourceTree = ""; };
154A6EF424E6B1260091264C /* dummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = dummy.swift; path = Tests/dummy.swift; sourceTree = SOURCE_ROOT; };
+ 157283132D4397EB00F20253 /* AbsoluteLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AbsoluteLayout.h; sourceTree = ""; };
+ 157283142D4397EB00F20253 /* AbsoluteLayout.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AbsoluteLayout.cpp; sourceTree = ""; };
+ 157283152D4397EB00F20253 /* Align.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Align.h; sourceTree = ""; };
+ 157283162D4397EB00F20253 /* Baseline.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Baseline.h; sourceTree = ""; };
+ 157283172D4397EB00F20253 /* Baseline.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Baseline.cpp; sourceTree = ""; };
+ 157283182D4397EB00F20253 /* BoundAxis.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BoundAxis.h; sourceTree = ""; };
+ 157283192D4397EB00F20253 /* Cache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Cache.h; sourceTree = ""; };
+ 1572831A2D4397EB00F20253 /* Cache.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Cache.cpp; sourceTree = ""; };
+ 1572831B2D4397EB00F20253 /* CalculateLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CalculateLayout.h; sourceTree = ""; };
+ 1572831C2D4397EB00F20253 /* CalculateLayout.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CalculateLayout.cpp; sourceTree = ""; };
+ 1572831D2D4397EB00F20253 /* FlexDirection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FlexDirection.h; sourceTree = ""; };
+ 1572831E2D4397EB00F20253 /* FlexLine.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FlexLine.h; sourceTree = ""; };
+ 1572831F2D4397EB00F20253 /* FlexLine.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FlexLine.cpp; sourceTree = ""; };
+ 157283202D4397EB00F20253 /* PixelGrid.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PixelGrid.h; sourceTree = ""; };
+ 157283212D4397EB00F20253 /* PixelGrid.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PixelGrid.cpp; sourceTree = ""; };
+ 157283222D4397EB00F20253 /* SizingMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SizingMode.h; sourceTree = ""; };
+ 157283232D4397EB00F20253 /* TrailingPosition.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TrailingPosition.h; sourceTree = ""; };
+ 157283262D4397EB00F20253 /* Config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Config.h; sourceTree = ""; };
+ 157283272D4397EB00F20253 /* Config.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Config.cpp; sourceTree = ""; };
+ 157283292D4397EB00F20253 /* AssertFatal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AssertFatal.h; sourceTree = ""; };
+ 1572832A2D4397EB00F20253 /* AssertFatal.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AssertFatal.cpp; sourceTree = ""; };
+ 1572832B2D4397EB00F20253 /* Log.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Log.h; sourceTree = ""; };
+ 1572832C2D4397EB00F20253 /* Log.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Log.cpp; sourceTree = ""; };
+ 1572832E2D4397EB00F20253 /* Align.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Align.h; sourceTree = ""; };
+ 1572832F2D4397EB00F20253 /* BoxSizing.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BoxSizing.h; sourceTree = ""; };
+ 157283302D4397EB00F20253 /* Dimension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Dimension.h; sourceTree = ""; };
+ 157283312D4397EB00F20253 /* Direction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Direction.h; sourceTree = ""; };
+ 157283322D4397EB00F20253 /* Display.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Display.h; sourceTree = ""; };
+ 157283332D4397EB00F20253 /* Edge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Edge.h; sourceTree = ""; };
+ 157283342D4397EB00F20253 /* Errata.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Errata.h; sourceTree = ""; };
+ 157283352D4397EB00F20253 /* ExperimentalFeature.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExperimentalFeature.h; sourceTree = ""; };
+ 157283362D4397EB00F20253 /* FlexDirection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FlexDirection.h; sourceTree = ""; };
+ 157283372D4397EB00F20253 /* Gutter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Gutter.h; sourceTree = ""; };
+ 157283382D4397EB00F20253 /* Justify.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Justify.h; sourceTree = ""; };
+ 157283392D4397EB00F20253 /* LogLevel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LogLevel.h; sourceTree = ""; };
+ 1572833A2D4397EB00F20253 /* MeasureMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MeasureMode.h; sourceTree = ""; };
+ 1572833B2D4397EB00F20253 /* NodeType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NodeType.h; sourceTree = ""; };
+ 1572833C2D4397EB00F20253 /* Overflow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Overflow.h; sourceTree = ""; };
+ 1572833D2D4397EB00F20253 /* PhysicalEdge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PhysicalEdge.h; sourceTree = ""; };
+ 1572833E2D4397EB00F20253 /* PositionType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PositionType.h; sourceTree = ""; };
+ 1572833F2D4397EB00F20253 /* Unit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Unit.h; sourceTree = ""; };
+ 157283402D4397EB00F20253 /* Wrap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Wrap.h; sourceTree = ""; };
+ 157283412D4397EB00F20253 /* YogaEnums.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YogaEnums.h; sourceTree = ""; };
+ 157283432D4397EB00F20253 /* event.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = event.h; sourceTree = ""; };
+ 157283442D4397EB00F20253 /* event.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = event.cpp; sourceTree = ""; };
+ 157283472D4397EB00F20253 /* CachedMeasurement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CachedMeasurement.h; sourceTree = ""; };
+ 157283482D4397EB00F20253 /* LayoutableChildren.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutableChildren.h; sourceTree = ""; };
+ 157283492D4397EB00F20253 /* LayoutResults.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutResults.h; sourceTree = ""; };
+ 1572834A2D4397EB00F20253 /* LayoutResults.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutResults.cpp; sourceTree = ""; };
+ 1572834B2D4397EB00F20253 /* Node.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Node.h; sourceTree = ""; };
+ 1572834C2D4397EB00F20253 /* Node.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Node.cpp; sourceTree = ""; };
+ 1572834E2D4397EB00F20253 /* Comparison.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Comparison.h; sourceTree = ""; };
+ 1572834F2D4397EB00F20253 /* FloatOptional.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FloatOptional.h; sourceTree = ""; };
+ 157283512D4397EB00F20253 /* SmallValueBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SmallValueBuffer.h; sourceTree = ""; };
+ 157283522D4397EB00F20253 /* Style.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Style.h; sourceTree = ""; };
+ 157283532D4397EB00F20253 /* StyleLength.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StyleLength.h; sourceTree = ""; };
+ 157283542D4397EB00F20253 /* StyleSizeLength.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StyleSizeLength.h; sourceTree = ""; };
+ 157283552D4397EB00F20253 /* StyleValueHandle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StyleValueHandle.h; sourceTree = ""; };
+ 157283562D4397EB00F20253 /* StyleValuePool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StyleValuePool.h; sourceTree = ""; };
+ 157283582D4397EB00F20253 /* YGConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGConfig.h; sourceTree = ""; };
+ 157283592D4397EB00F20253 /* YGConfig.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = YGConfig.cpp; sourceTree = ""; };
+ 1572835A2D4397EB00F20253 /* YGEnums.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGEnums.h; sourceTree = ""; };
+ 1572835B2D4397EB00F20253 /* YGEnums.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = YGEnums.cpp; sourceTree = ""; };
+ 1572835C2D4397EB00F20253 /* YGMacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGMacros.h; sourceTree = ""; };
+ 1572835D2D4397EB00F20253 /* YGNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGNode.h; sourceTree = ""; };
+ 1572835E2D4397EB00F20253 /* YGNode.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = YGNode.cpp; sourceTree = ""; };
+ 1572835F2D4397EB00F20253 /* YGNodeLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGNodeLayout.h; sourceTree = ""; };
+ 157283602D4397EB00F20253 /* YGNodeLayout.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = YGNodeLayout.cpp; sourceTree = ""; };
+ 157283612D4397EB00F20253 /* YGNodeStyle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGNodeStyle.h; sourceTree = ""; };
+ 157283622D4397EB00F20253 /* YGNodeStyle.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = YGNodeStyle.cpp; sourceTree = ""; };
+ 157283632D4397EB00F20253 /* YGPixelGrid.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGPixelGrid.h; sourceTree = ""; };
+ 157283642D4397EB00F20253 /* YGPixelGrid.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = YGPixelGrid.cpp; sourceTree = ""; };
+ 157283652D4397EB00F20253 /* YGValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGValue.h; sourceTree = ""; };
+ 157283662D4397EB00F20253 /* YGValue.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = YGValue.cpp; sourceTree = ""; };
+ 157283672D4397EB00F20253 /* Yoga.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Yoga.h; sourceTree = ""; };
15865F5424E5834E00345BD7 /* YogaKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = YogaKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
15865F5F24E583F000345BD7 /* YGLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGLayout.h; sourceTree = ""; };
15865F6024E583F000345BD7 /* UIView+Yoga.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Yoga.h"; sourceTree = ""; };
@@ -114,36 +232,6 @@
15865F6324E583F000345BD7 /* UIView+Yoga.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Yoga.m"; sourceTree = ""; };
15865F6524E583F000345BD7 /* YogaKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YogaKit.h; sourceTree = ""; };
15865FFE24E58BD800345BD7 /* Yoga.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Yoga.framework; sourceTree = BUILT_PRODUCTS_DIR; };
- 1586600924E58C3600345BD7 /* Utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Utils.cpp; sourceTree = ""; };
- 1586600B24E58C3600345BD7 /* experiments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = experiments.cpp; sourceTree = ""; };
- 1586600C24E58C3600345BD7 /* experiments-inl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "experiments-inl.h"; sourceTree = ""; };
- 1586600D24E58C3600345BD7 /* experiments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = experiments.h; sourceTree = ""; };
- 1586600E24E58C3600345BD7 /* YGStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGStyle.cpp; sourceTree = ""; };
- 1586600F24E58C3600345BD7 /* YGNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGNode.cpp; sourceTree = ""; };
- 1586601024E58C3600345BD7 /* YGConfig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGConfig.cpp; sourceTree = ""; };
- 1586601124E58C3600345BD7 /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utils.h; sourceTree = ""; };
- 1586601224E58C3600345BD7 /* BitUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BitUtils.h; sourceTree = ""; };
- 1586601324E58C3600345BD7 /* CompactValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompactValue.h; sourceTree = ""; };
- 1586601424E58C3700345BD7 /* YGValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGValue.cpp; sourceTree = ""; };
- 1586601524E58C3700345BD7 /* YGLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGLayout.cpp; sourceTree = ""; };
- 1586601624E58C3700345BD7 /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = ""; };
- 1586601724E58C3700345BD7 /* YGNodePrint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGNodePrint.cpp; sourceTree = ""; };
- 1586601924E58C3700345BD7 /* event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = event.h; sourceTree = ""; };
- 1586601A24E58C3700345BD7 /* event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = event.cpp; sourceTree = ""; };
- 1586601B24E58C3700345BD7 /* YGNodePrint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGNodePrint.h; sourceTree = ""; };
- 1586601C24E58C3700345BD7 /* Yoga.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Yoga.h; sourceTree = ""; };
- 1586601D24E58C3700345BD7 /* YGFloatOptional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGFloatOptional.h; sourceTree = ""; };
- 1586601E24E58C3700345BD7 /* YGConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGConfig.h; sourceTree = ""; };
- 1586601F24E58C3700345BD7 /* YGMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGMacros.h; sourceTree = ""; };
- 1586602024E58C3700345BD7 /* YGEnums.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGEnums.h; sourceTree = ""; };
- 1586602124E58C3700345BD7 /* log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = log.cpp; sourceTree = ""; };
- 1586602224E58C3700345BD7 /* YGStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGStyle.h; sourceTree = ""; };
- 1586602324E58C3700345BD7 /* Yoga.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Yoga.cpp; sourceTree = ""; };
- 1586602424E58C3700345BD7 /* Yoga-internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Yoga-internal.h"; sourceTree = ""; };
- 1586602524E58C3700345BD7 /* YGValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGValue.h; sourceTree = ""; };
- 1586602624E58C3700345BD7 /* YGLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGLayout.h; sourceTree = ""; };
- 1586602724E58C3700345BD7 /* YGNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGNode.h; sourceTree = ""; };
- 1586602824E58C3700345BD7 /* YGEnums.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGEnums.cpp; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -193,14 +281,6 @@
path = YogaKit.Swift;
sourceTree = "";
};
- 153098C726930BAE009B4135 /* include */ = {
- isa = PBXGroup;
- children = (
- 153098C826930BAE009B4135 /* Yoga-umbrella.h */,
- );
- path = include;
- sourceTree = "";
- };
153B525C24E6AD6B008156D3 /* YogaKitTests */ = {
isa = PBXGroup;
children = (
@@ -221,6 +301,121 @@
name = "Supporting Files";
sourceTree = "";
};
+ 157283242D4397EB00F20253 /* algorithm */ = {
+ isa = PBXGroup;
+ children = (
+ 157283132D4397EB00F20253 /* AbsoluteLayout.h */,
+ 157283142D4397EB00F20253 /* AbsoluteLayout.cpp */,
+ 157283152D4397EB00F20253 /* Align.h */,
+ 157283162D4397EB00F20253 /* Baseline.h */,
+ 157283172D4397EB00F20253 /* Baseline.cpp */,
+ 157283182D4397EB00F20253 /* BoundAxis.h */,
+ 157283192D4397EB00F20253 /* Cache.h */,
+ 1572831A2D4397EB00F20253 /* Cache.cpp */,
+ 1572831B2D4397EB00F20253 /* CalculateLayout.h */,
+ 1572831C2D4397EB00F20253 /* CalculateLayout.cpp */,
+ 1572831D2D4397EB00F20253 /* FlexDirection.h */,
+ 1572831E2D4397EB00F20253 /* FlexLine.h */,
+ 1572831F2D4397EB00F20253 /* FlexLine.cpp */,
+ 157283202D4397EB00F20253 /* PixelGrid.h */,
+ 157283212D4397EB00F20253 /* PixelGrid.cpp */,
+ 157283222D4397EB00F20253 /* SizingMode.h */,
+ 157283232D4397EB00F20253 /* TrailingPosition.h */,
+ );
+ path = algorithm;
+ sourceTree = "";
+ };
+ 157283282D4397EB00F20253 /* config */ = {
+ isa = PBXGroup;
+ children = (
+ 157283262D4397EB00F20253 /* Config.h */,
+ 157283272D4397EB00F20253 /* Config.cpp */,
+ );
+ path = config;
+ sourceTree = "";
+ };
+ 1572832D2D4397EB00F20253 /* debug */ = {
+ isa = PBXGroup;
+ children = (
+ 157283292D4397EB00F20253 /* AssertFatal.h */,
+ 1572832A2D4397EB00F20253 /* AssertFatal.cpp */,
+ 1572832B2D4397EB00F20253 /* Log.h */,
+ 1572832C2D4397EB00F20253 /* Log.cpp */,
+ );
+ path = debug;
+ sourceTree = "";
+ };
+ 157283422D4397EB00F20253 /* enums */ = {
+ isa = PBXGroup;
+ children = (
+ 1572832E2D4397EB00F20253 /* Align.h */,
+ 1572832F2D4397EB00F20253 /* BoxSizing.h */,
+ 157283302D4397EB00F20253 /* Dimension.h */,
+ 157283312D4397EB00F20253 /* Direction.h */,
+ 157283322D4397EB00F20253 /* Display.h */,
+ 157283332D4397EB00F20253 /* Edge.h */,
+ 157283342D4397EB00F20253 /* Errata.h */,
+ 157283352D4397EB00F20253 /* ExperimentalFeature.h */,
+ 157283362D4397EB00F20253 /* FlexDirection.h */,
+ 157283372D4397EB00F20253 /* Gutter.h */,
+ 157283382D4397EB00F20253 /* Justify.h */,
+ 157283392D4397EB00F20253 /* LogLevel.h */,
+ 1572833A2D4397EB00F20253 /* MeasureMode.h */,
+ 1572833B2D4397EB00F20253 /* NodeType.h */,
+ 1572833C2D4397EB00F20253 /* Overflow.h */,
+ 1572833D2D4397EB00F20253 /* PhysicalEdge.h */,
+ 1572833E2D4397EB00F20253 /* PositionType.h */,
+ 1572833F2D4397EB00F20253 /* Unit.h */,
+ 157283402D4397EB00F20253 /* Wrap.h */,
+ 157283412D4397EB00F20253 /* YogaEnums.h */,
+ );
+ path = enums;
+ sourceTree = "";
+ };
+ 157283452D4397EB00F20253 /* event */ = {
+ isa = PBXGroup;
+ children = (
+ 157283432D4397EB00F20253 /* event.h */,
+ 157283442D4397EB00F20253 /* event.cpp */,
+ );
+ path = event;
+ sourceTree = "";
+ };
+ 1572834D2D4397EB00F20253 /* node */ = {
+ isa = PBXGroup;
+ children = (
+ 157283472D4397EB00F20253 /* CachedMeasurement.h */,
+ 157283482D4397EB00F20253 /* LayoutableChildren.h */,
+ 157283492D4397EB00F20253 /* LayoutResults.h */,
+ 1572834A2D4397EB00F20253 /* LayoutResults.cpp */,
+ 1572834B2D4397EB00F20253 /* Node.h */,
+ 1572834C2D4397EB00F20253 /* Node.cpp */,
+ );
+ path = node;
+ sourceTree = "";
+ };
+ 157283502D4397EB00F20253 /* numeric */ = {
+ isa = PBXGroup;
+ children = (
+ 1572834E2D4397EB00F20253 /* Comparison.h */,
+ 1572834F2D4397EB00F20253 /* FloatOptional.h */,
+ );
+ path = numeric;
+ sourceTree = "";
+ };
+ 157283572D4397EB00F20253 /* style */ = {
+ isa = PBXGroup;
+ children = (
+ 157283512D4397EB00F20253 /* SmallValueBuffer.h */,
+ 157283522D4397EB00F20253 /* Style.h */,
+ 157283532D4397EB00F20253 /* StyleLength.h */,
+ 157283542D4397EB00F20253 /* StyleSizeLength.h */,
+ 157283552D4397EB00F20253 /* StyleValueHandle.h */,
+ 157283562D4397EB00F20253 /* StyleValuePool.h */,
+ );
+ path = style;
+ sourceTree = "";
+ };
15865F4A24E5834E00345BD7 = {
isa = PBXGroup;
children = (
@@ -270,58 +465,35 @@
15865FFF24E58BD800345BD7 /* Yoga */ = {
isa = PBXGroup;
children = (
- 153098C726930BAE009B4135 /* include */,
- 1586601824E58C3700345BD7 /* event */,
- 1586600A24E58C3600345BD7 /* internal */,
- 1586601224E58C3600345BD7 /* BitUtils.h */,
- 1586601324E58C3600345BD7 /* CompactValue.h */,
- 1586602124E58C3700345BD7 /* log.cpp */,
- 1586601624E58C3700345BD7 /* log.h */,
- 1586600924E58C3600345BD7 /* Utils.cpp */,
- 1586601124E58C3600345BD7 /* Utils.h */,
- 1586601024E58C3600345BD7 /* YGConfig.cpp */,
- 1586601E24E58C3700345BD7 /* YGConfig.h */,
- 1586602824E58C3700345BD7 /* YGEnums.cpp */,
- 1586602024E58C3700345BD7 /* YGEnums.h */,
- 1586601D24E58C3700345BD7 /* YGFloatOptional.h */,
- 1586601524E58C3700345BD7 /* YGLayout.cpp */,
- 1586602624E58C3700345BD7 /* YGLayout.h */,
- 1586601F24E58C3700345BD7 /* YGMacros.h */,
- 1586600F24E58C3600345BD7 /* YGNode.cpp */,
- 1586602724E58C3700345BD7 /* YGNode.h */,
- 1586601724E58C3700345BD7 /* YGNodePrint.cpp */,
- 1586601B24E58C3700345BD7 /* YGNodePrint.h */,
- 1586600E24E58C3600345BD7 /* YGStyle.cpp */,
- 1586602224E58C3700345BD7 /* YGStyle.h */,
- 1586601424E58C3700345BD7 /* YGValue.cpp */,
- 1586602524E58C3700345BD7 /* YGValue.h */,
- 1586602424E58C3700345BD7 /* Yoga-internal.h */,
- 1586602324E58C3700345BD7 /* Yoga.cpp */,
- 1586601C24E58C3700345BD7 /* Yoga.h */,
+ 157283242D4397EB00F20253 /* algorithm */,
+ 157283282D4397EB00F20253 /* config */,
+ 1572832D2D4397EB00F20253 /* debug */,
+ 157283422D4397EB00F20253 /* enums */,
+ 157283452D4397EB00F20253 /* event */,
+ 1572834D2D4397EB00F20253 /* node */,
+ 157283502D4397EB00F20253 /* numeric */,
+ 157283572D4397EB00F20253 /* style */,
+ 157283582D4397EB00F20253 /* YGConfig.h */,
+ 157283592D4397EB00F20253 /* YGConfig.cpp */,
+ 1572835A2D4397EB00F20253 /* YGEnums.h */,
+ 1572835B2D4397EB00F20253 /* YGEnums.cpp */,
+ 1572835C2D4397EB00F20253 /* YGMacros.h */,
+ 1572835D2D4397EB00F20253 /* YGNode.h */,
+ 1572835E2D4397EB00F20253 /* YGNode.cpp */,
+ 1572835F2D4397EB00F20253 /* YGNodeLayout.h */,
+ 157283602D4397EB00F20253 /* YGNodeLayout.cpp */,
+ 157283612D4397EB00F20253 /* YGNodeStyle.h */,
+ 157283622D4397EB00F20253 /* YGNodeStyle.cpp */,
+ 157283632D4397EB00F20253 /* YGPixelGrid.h */,
+ 157283642D4397EB00F20253 /* YGPixelGrid.cpp */,
+ 157283652D4397EB00F20253 /* YGValue.h */,
+ 157283662D4397EB00F20253 /* YGValue.cpp */,
+ 157283672D4397EB00F20253 /* Yoga.h */,
);
name = Yoga;
path = ../yoga;
sourceTree = "";
};
- 1586600A24E58C3600345BD7 /* internal */ = {
- isa = PBXGroup;
- children = (
- 1586600B24E58C3600345BD7 /* experiments.cpp */,
- 1586600C24E58C3600345BD7 /* experiments-inl.h */,
- 1586600D24E58C3600345BD7 /* experiments.h */,
- );
- path = internal;
- sourceTree = "";
- };
- 1586601824E58C3700345BD7 /* event */ = {
- isa = PBXGroup;
- children = (
- 1586601924E58C3700345BD7 /* event.h */,
- 1586601A24E58C3700345BD7 /* event.cpp */,
- );
- path = event;
- sourceTree = "";
- };
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@@ -347,25 +519,62 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
- 1586603E24E58C3700345BD7 /* YGEnums.h in Headers */,
- 1586603A24E58C3700345BD7 /* Yoga.h in Headers */,
- 1586603D24E58C3700345BD7 /* YGMacros.h in Headers */,
- 1586604324E58C3700345BD7 /* YGValue.h in Headers */,
- 153098CA26930BAF009B4135 /* Yoga-umbrella.h in Headers */,
- 1586604524E58C3700345BD7 /* YGNode.h in Headers */,
- 1586604024E58C3700345BD7 /* YGStyle.h in Headers */,
- 1586603124E58C3700345BD7 /* BitUtils.h in Headers */,
- 1586603024E58C3700345BD7 /* Utils.h in Headers */,
- 1586602B24E58C3700345BD7 /* experiments-inl.h in Headers */,
- 1586603724E58C3700345BD7 /* event.h in Headers */,
- 1586603524E58C3700345BD7 /* log.h in Headers */,
- 1586603224E58C3700345BD7 /* CompactValue.h in Headers */,
- 1586603924E58C3700345BD7 /* YGNodePrint.h in Headers */,
- 1586604224E58C3700345BD7 /* Yoga-internal.h in Headers */,
- 1586603C24E58C3700345BD7 /* YGConfig.h in Headers */,
- 1586604424E58C3700345BD7 /* YGLayout.h in Headers */,
- 1586602C24E58C3700345BD7 /* experiments.h in Headers */,
- 1586603B24E58C3700345BD7 /* YGFloatOptional.h in Headers */,
+ 157283AA2D4397EB00F20253 /* YGValue.h in Headers */,
+ 157283922D4397EB00F20253 /* YGPixelGrid.h in Headers */,
+ 1572839F2D4397EB00F20253 /* YGNodeStyle.h in Headers */,
+ 157283A82D4397EB00F20253 /* YGNodeLayout.h in Headers */,
+ 157283972D4397EB00F20253 /* YGNode.h in Headers */,
+ 157283852D4397EB00F20253 /* YGMacros.h in Headers */,
+ 1572837C2D4397EB00F20253 /* YGEnums.h in Headers */,
+ 157283B22D4397EB00F20253 /* YGConfig.h in Headers */,
+ 157283842D4397EB00F20253 /* Yoga.h in Headers */,
+ 1572837D2D4397EB00F20253 /* Dimension.h in Headers */,
+ 1572837E2D4397EB00F20253 /* FlexDirection.h in Headers */,
+ 1572837F2D4397EB00F20253 /* Gutter.h in Headers */,
+ 157283802D4397EB00F20253 /* LayoutableChildren.h in Headers */,
+ 157283812D4397EB00F20253 /* NodeType.h in Headers */,
+ 157283822D4397EB00F20253 /* Wrap.h in Headers */,
+ 157283832D4397EB00F20253 /* PixelGrid.h in Headers */,
+ 157283862D4397EB00F20253 /* Align.h in Headers */,
+ 157283872D4397EB00F20253 /* Overflow.h in Headers */,
+ 157283882D4397EB00F20253 /* StyleValuePool.h in Headers */,
+ 157283892D4397EB00F20253 /* Justify.h in Headers */,
+ 1572838A2D4397EB00F20253 /* Log.h in Headers */,
+ 1572838B2D4397EB00F20253 /* LayoutResults.h in Headers */,
+ 1572838C2D4397EB00F20253 /* StyleSizeLength.h in Headers */,
+ 1572838D2D4397EB00F20253 /* Config.h in Headers */,
+ 1572838E2D4397EB00F20253 /* Direction.h in Headers */,
+ 1572838F2D4397EB00F20253 /* ExperimentalFeature.h in Headers */,
+ 157283902D4397EB00F20253 /* Display.h in Headers */,
+ 157283912D4397EB00F20253 /* SizingMode.h in Headers */,
+ 157283932D4397EB00F20253 /* MeasureMode.h in Headers */,
+ 157283942D4397EB00F20253 /* TrailingPosition.h in Headers */,
+ 157283952D4397EB00F20253 /* Align.h in Headers */,
+ 157283962D4397EB00F20253 /* SmallValueBuffer.h in Headers */,
+ 157283982D4397EB00F20253 /* StyleLength.h in Headers */,
+ 157283992D4397EB00F20253 /* CalculateLayout.h in Headers */,
+ 1572839A2D4397EB00F20253 /* FlexLine.h in Headers */,
+ 1572839B2D4397EB00F20253 /* BoundAxis.h in Headers */,
+ 1572839C2D4397EB00F20253 /* AbsoluteLayout.h in Headers */,
+ 1572839D2D4397EB00F20253 /* Edge.h in Headers */,
+ 1572839E2D4397EB00F20253 /* AssertFatal.h in Headers */,
+ 157283A02D4397EB00F20253 /* FlexDirection.h in Headers */,
+ 157283A12D4397EB00F20253 /* Comparison.h in Headers */,
+ 157283A22D4397EB00F20253 /* Cache.h in Headers */,
+ 157283A32D4397EB00F20253 /* Baseline.h in Headers */,
+ 157283A42D4397EB00F20253 /* Errata.h in Headers */,
+ 157283A52D4397EB00F20253 /* BoxSizing.h in Headers */,
+ 157283A62D4397EB00F20253 /* PositionType.h in Headers */,
+ 157283A72D4397EB00F20253 /* Unit.h in Headers */,
+ 157283A92D4397EB00F20253 /* StyleValueHandle.h in Headers */,
+ 157283AB2D4397EB00F20253 /* LogLevel.h in Headers */,
+ 157283AC2D4397EB00F20253 /* YogaEnums.h in Headers */,
+ 157283AD2D4397EB00F20253 /* Style.h in Headers */,
+ 157283AE2D4397EB00F20253 /* FloatOptional.h in Headers */,
+ 157283AF2D4397EB00F20253 /* CachedMeasurement.h in Headers */,
+ 157283B02D4397EB00F20253 /* PhysicalEdge.h in Headers */,
+ 157283B12D4397EB00F20253 /* Node.h in Headers */,
+ 157283B32D4397EB00F20253 /* event.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -558,18 +767,25 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 1586602A24E58C3700345BD7 /* experiments.cpp in Sources */,
- 1586602F24E58C3700345BD7 /* YGConfig.cpp in Sources */,
- 1586602E24E58C3700345BD7 /* YGNode.cpp in Sources */,
- 1586603624E58C3700345BD7 /* YGNodePrint.cpp in Sources */,
- 1586604624E58C3700345BD7 /* YGEnums.cpp in Sources */,
- 1586602D24E58C3700345BD7 /* YGStyle.cpp in Sources */,
- 1586604124E58C3700345BD7 /* Yoga.cpp in Sources */,
- 1586602924E58C3700345BD7 /* Utils.cpp in Sources */,
- 1586603424E58C3700345BD7 /* YGLayout.cpp in Sources */,
- 1586603824E58C3700345BD7 /* event.cpp in Sources */,
- 1586603F24E58C3700345BD7 /* log.cpp in Sources */,
- 1586603324E58C3700345BD7 /* YGValue.cpp in Sources */,
+ 157283692D4397EB00F20253 /* Node.cpp in Sources */,
+ 1572836A2D4397EB00F20253 /* Cache.cpp in Sources */,
+ 1572836B2D4397EB00F20253 /* YGEnums.cpp in Sources */,
+ 1572836C2D4397EB00F20253 /* Baseline.cpp in Sources */,
+ 1572836D2D4397EB00F20253 /* event.cpp in Sources */,
+ 1572836E2D4397EB00F20253 /* PixelGrid.cpp in Sources */,
+ 1572836F2D4397EB00F20253 /* Config.cpp in Sources */,
+ 157283702D4397EB00F20253 /* Log.cpp in Sources */,
+ 157283712D4397EB00F20253 /* YGConfig.cpp in Sources */,
+ 157283722D4397EB00F20253 /* YGPixelGrid.cpp in Sources */,
+ 157283732D4397EB00F20253 /* AbsoluteLayout.cpp in Sources */,
+ 157283742D4397EB00F20253 /* AssertFatal.cpp in Sources */,
+ 157283752D4397EB00F20253 /* YGNodeLayout.cpp in Sources */,
+ 157283762D4397EB00F20253 /* YGValue.cpp in Sources */,
+ 157283772D4397EB00F20253 /* LayoutResults.cpp in Sources */,
+ 157283782D4397EB00F20253 /* YGNodeStyle.cpp in Sources */,
+ 157283792D4397EB00F20253 /* YGNode.cpp in Sources */,
+ 1572837A2D4397EB00F20253 /* FlexLine.cpp in Sources */,
+ 1572837B2D4397EB00F20253 /* CalculateLayout.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -695,7 +911,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -765,7 +981,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -879,6 +1095,7 @@
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_INPUT_FILETYPE = sourcecode.cpp.cpp;
+ HEADER_SEARCH_PATHS = "${SRCROOT}/..";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@@ -886,7 +1103,6 @@
"@loader_path/Frameworks",
);
MACH_O_TYPE = staticlib;
- MODULEMAP_FILE = "${SRCROOT}/../yoga/include/Yoga.modulemap";
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.Yoga;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
@@ -906,6 +1122,7 @@
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_INPUT_FILETYPE = sourcecode.cpp.cpp;
+ HEADER_SEARCH_PATHS = "${SRCROOT}/..";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@@ -913,7 +1130,6 @@
"@loader_path/Frameworks",
);
MACH_O_TYPE = staticlib;
- MODULEMAP_FILE = "${SRCROOT}/../yoga/include/Yoga.modulemap";
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.Yoga;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
diff --git a/tests/BitUtilsTest.cpp b/tests/BitUtilsTest.cpp
deleted file mode 100644
index d20ee3071b..0000000000
--- a/tests/BitUtilsTest.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#include
-
-#include
-#include
-
-namespace facebook {
-namespace yoga {
-
-TEST(BitUtils, one_boolean_defaults_to_false) {
- constexpr uint8_t flags = 0;
-
- ASSERT_EQ(detail::getBooleanData(flags, 0), false);
- static_assert(
- detail::getBooleanData(flags, 0) == false,
- "first boolean member must default to false");
-}
-
-TEST(BitUtils, one_boolean_can_be_initialized_to_true) {
- constexpr uint8_t flags = 1;
-
- ASSERT_EQ(detail::getBooleanData(flags, 0), true);
- static_assert(
- detail::getBooleanData(flags, 0) == true,
- "first boolean member must be initialized to true");
-}
-
-TEST(BitUtils, one_boolean_can_be_set_to_true) {
- uint8_t flags = 0;
-
- detail::setBooleanData(flags, 0, true);
- ASSERT_EQ(detail::getBooleanData(flags, 0), true);
-}
-
-TEST(BitUtils, second_boolean_defaults_to_false) {
- constexpr uint8_t flags = 0;
-
- ASSERT_EQ(detail::getBooleanData(flags, 1), false);
- static_assert(
- detail::getBooleanData(flags, 1) == false,
- "second boolean member must default to false");
-}
-
-TEST(BitUtils, second_boolean_can_be_initialized_to_true) {
- constexpr uint8_t flags = 2;
-
- ASSERT_EQ(detail::getBooleanData(flags, 0), false);
- ASSERT_EQ(detail::getBooleanData(flags, 1), true);
- static_assert(
- detail::getBooleanData(flags, 0) == false,
- "first boolean member must default to false");
- static_assert(
- detail::getBooleanData(flags, 1) == true,
- "second boolean member must be initialized to true");
-}
-
-TEST(BitUtils, second_boolean_can_be_set_to_true) {
- uint8_t flags = 0;
-
- detail::setBooleanData(flags, 1, true);
- ASSERT_EQ(detail::getBooleanData(flags, 0), false);
- ASSERT_EQ(detail::getBooleanData(flags, 1), true);
-}
-
-TEST(BitUtils, third_boolean_defaults_to_false) {
- constexpr uint8_t flags = 0;
-
- ASSERT_EQ(detail::getBooleanData(flags, 2), false);
- static_assert(
- detail::getBooleanData(flags, 2) == false,
- "second boolean member must default to false");
-}
-
-TEST(BitUtils, third_boolean_can_be_initialized_to_true) {
- constexpr uint8_t flags = 4;
-
- ASSERT_EQ(detail::getBooleanData(flags, 0), false);
- ASSERT_EQ(detail::getBooleanData(flags, 1), false);
- ASSERT_EQ(detail::getBooleanData(flags, 2), true);
- static_assert(
- detail::getBooleanData(flags, 0) == false,
- "first boolean member must default to false");
- static_assert(
- detail::getBooleanData(flags, 1) == false,
- "second boolean member must default to false");
- static_assert(
- detail::getBooleanData(flags, 2) == true,
- "second boolean member must be initialized to true");
-}
-
-TEST(BitUtils, third_boolean_can_be_set_to_true) {
- uint8_t flags = 0;
-
- detail::setBooleanData(flags, 2, true);
- ASSERT_EQ(detail::getBooleanData(flags, 0), false);
- ASSERT_EQ(detail::getBooleanData(flags, 1), false);
- ASSERT_EQ(detail::getBooleanData(flags, 2), true);
-}
-
-TEST(BitUtils, setting_boolean_values_does_not_spill_over) {
- uint8_t flags = 0;
-
- detail::setBooleanData(flags, 1, (bool) 7);
-
- ASSERT_EQ(detail::getBooleanData(flags, 0), false);
- ASSERT_EQ(detail::getBooleanData(flags, 1), true);
- ASSERT_EQ(detail::getBooleanData(flags, 2), false);
-}
-
-TEST(BitUtils, first_enum_defaults_to_0) {
- constexpr uint8_t flags = 0;
-
- ASSERT_EQ(detail::getEnumData(flags, 0), YGAlignAuto);
- static_assert(
- detail::getEnumData(flags, 0) == YGAlignAuto,
- "first enum member must default to 0");
-}
-
-TEST(BitUtils, first_enum_can_be_set) {
- uint8_t flags = 0;
-
- detail::setEnumData(flags, 0, YGAlignSpaceBetween);
-
- ASSERT_EQ(detail::getEnumData(flags, 0), YGAlignSpaceBetween);
-}
-
-TEST(BitUtils, second_enum_defaults_to_0) {
- constexpr uint8_t flags = 0;
- static constexpr size_t alignOffset = 0;
- static constexpr size_t edgeOffset = 3;
-
- ASSERT_EQ(detail::getEnumData(flags, alignOffset), YGAlignAuto);
- ASSERT_EQ(detail::getEnumData(flags, edgeOffset), YGEdgeLeft);
- static_assert(
- detail::getEnumData(flags, alignOffset) == YGAlignAuto,
- "first enum member must default to 0");
- static_assert(
- detail::getEnumData(flags, edgeOffset) == YGEdgeLeft,
- "second enum member must default to 0");
-}
-
-TEST(BitUtils, second_enum_can_be_set) {
- uint8_t flags = 0;
- static constexpr size_t alignOffset = 0;
- static constexpr size_t edgeOffset = 3;
-
- detail::setEnumData(flags, edgeOffset, YGEdgeAll);
-
- ASSERT_EQ(detail::getEnumData(flags, alignOffset), YGAlignAuto);
- ASSERT_EQ(detail::getEnumData(flags, edgeOffset), YGEdgeAll);
-}
-
-TEST(BitUtils, third_enum_defaults_to_0) {
- constexpr uint8_t flags = 0;
- static constexpr size_t alignOffset = 0;
- static constexpr size_t boolOffset = 3;
- static constexpr size_t edgesOffset = 4;
-
- ASSERT_EQ(detail::getEnumData(flags, alignOffset), YGAlignAuto);
- ASSERT_EQ(detail::getBooleanData(flags, boolOffset), false);
- ASSERT_EQ(detail::getEnumData(flags, edgesOffset), YGEdgeLeft);
- static_assert(
- detail::getEnumData(flags, alignOffset) == YGAlignAuto,
- "first enum member must default to 0");
- static_assert(
- detail::getBooleanData(flags, boolOffset) == false,
- "middle boolean member must default to false");
- static_assert(
- detail::getEnumData(flags, edgesOffset) == YGEdgeLeft,
- "last enum member must default to 0");
-}
-
-TEST(BitUtils, third_enum_can_be_set) {
- uint8_t flags = 0;
- static constexpr size_t alignOffset = 0;
- static constexpr size_t boolOffset = 3;
- static constexpr size_t edgesOffset = 4;
-
- detail::setEnumData(flags, edgesOffset, YGEdgeVertical);
-
- ASSERT_EQ(detail::getEnumData(flags, alignOffset), YGAlignAuto);
- ASSERT_EQ(detail::getBooleanData(flags, boolOffset), false);
- ASSERT_EQ(detail::getEnumData(flags, edgesOffset), YGEdgeVertical);
-}
-
-TEST(BitUtils, setting_values_does_not_spill_over) {
- uint8_t flags = 0;
- static constexpr size_t alignOffset = 0;
- static constexpr size_t edgesOffset = 3;
- static constexpr size_t boolOffset = 7;
-
- detail::setEnumData(flags, edgesOffset, (YGEdge) 0xffffff);
-
- ASSERT_EQ(detail::getEnumData(flags, alignOffset), 0);
- ASSERT_EQ(detail::getBooleanData(flags, boolOffset), false);
- ASSERT_EQ(detail::getEnumData(flags, edgesOffset), 0xf);
-}
-
-} // namespace yoga
-} // namespace facebook
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 0000000000..c48bfb9fb0
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,35 @@
+# 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.
+
+
+cmake_minimum_required(VERSION 3.13...3.26)
+project(tests)
+set(CMAKE_VERBOSE_MAKEFILE on)
+
+include(FetchContent)
+include(GoogleTest)
+
+set(YOGA_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/..)
+include(${YOGA_ROOT}/cmake/project-defaults.cmake)
+
+# Fetch GTest
+FetchContent_Declare(
+ googletest
+ URL https://github.com/google/googletest/archive/refs/tags/release-1.12.1.zip
+)
+FetchContent_MakeAvailable(googletest)
+
+add_subdirectory(${YOGA_ROOT}/yoga ${CMAKE_CURRENT_BINARY_DIR}/yoga)
+
+file(GLOB SOURCES CONFIGURE_DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/**/*.cpp)
+
+enable_testing()
+
+add_executable(yogatests ${SOURCES})
+target_link_libraries(yogatests yogacore GTest::gtest_main)
+
+gtest_discover_tests(yogatests)
diff --git a/tests/CompactValueTest.cpp b/tests/CompactValueTest.cpp
deleted file mode 100644
index a77d0e9261..0000000000
--- a/tests/CompactValueTest.cpp
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#define YOGA_COMPACT_VALUE_TEST
-
-#include
-#include
-#include
-
-using facebook::yoga::detail::CompactValue;
-
-const auto tooSmall = nextafter(CompactValue::LOWER_BOUND, -INFINITY);
-const auto tooLargePoints =
- nextafter(CompactValue::UPPER_BOUND_POINT, INFINITY);
-const auto tooLargePercent =
- nextafter(CompactValue::UPPER_BOUND_PERCENT, INFINITY);
-
-TEST(YogaTest, compact_value_can_represent_undefined) {
- auto c = CompactValue{YGValue{12.5, YGUnitUndefined}};
- YGValue v = c;
- ASSERT_EQ(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_NE(v, (YGValue{-1.25, YGUnitPoint}));
- ASSERT_NE(v, (YGValue{25, YGUnitPercent}));
- ASSERT_TRUE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(YogaTest, compact_value_manages_infinity_as_undefined) {
- auto c = CompactValue{
- YGValue{std::numeric_limits::infinity(), YGUnitUndefined}};
- YGValue v = c;
- ASSERT_EQ(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_NE(v, (YGValue{-1.25, YGUnitPoint}));
- ASSERT_NE(v, (YGValue{25, YGUnitPercent}));
- ASSERT_TRUE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(YogaTest, compact_value_can_represent_auto) {
- auto c = CompactValue{YGValue{0, YGUnitAuto}};
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_EQ(v, YGValueAuto);
- ASSERT_NE(v, (YGValue{-1.25, YGUnitPoint}));
- ASSERT_NE(v, (YGValue{25, YGUnitPercent}));
- ASSERT_FALSE(c.isUndefined());
- ASSERT_TRUE(c.isAuto());
-}
-
-TEST(YogaTest, compact_value_can_represent_zero_points) {
- auto c = CompactValue{YGValue{0, YGUnitPoint}};
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_EQ(v, (YGValue{0, YGUnitPoint}));
- ASSERT_NE(v, (YGValue{0, YGUnitPercent}));
- ASSERT_FALSE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(YogaTest, compact_value_can_represent_lower_bound_points) {
- auto c = CompactValue({YGValue{CompactValue::LOWER_BOUND, YGUnitPoint}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_EQ(v, (YGValue{CompactValue::LOWER_BOUND, YGUnitPoint}));
- ASSERT_NE(v, (YGValue{CompactValue::LOWER_BOUND, YGUnitPercent}));
- ASSERT_FALSE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(YogaTest, compact_value_can_represent_negative_lower_bound_points) {
- auto c = CompactValue({YGValue{-CompactValue::LOWER_BOUND, YGUnitPoint}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_EQ(v, (YGValue{-CompactValue::LOWER_BOUND, YGUnitPoint}));
- ASSERT_NE(v, (YGValue{-CompactValue::LOWER_BOUND, YGUnitPercent}));
- ASSERT_FALSE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(YogaTest, compact_value_clamps_smaller_than_lower_bound_points_to_zero) {
- auto c = CompactValue({YGValue{tooSmall, YGUnitPoint}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_EQ(v, (YGValue{0, YGUnitPoint}));
- ASSERT_NE(v, (YGValue{0, YGUnitPercent}));
-}
-
-TEST(
- YogaTest,
- compact_value_clamps_greater_than_negative_lower_bound_points_to_zero) {
- auto c = CompactValue({YGValue{-tooSmall, YGUnitPoint}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_EQ(v, (YGValue{0, YGUnitPoint}));
- ASSERT_NE(v, (YGValue{0, YGUnitPercent}));
-}
-
-TEST(YogaTest, compact_value_can_represent_upper_bound_points) {
- auto c =
- CompactValue({YGValue{CompactValue::UPPER_BOUND_POINT, YGUnitPoint}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_EQ(v, (YGValue{CompactValue::UPPER_BOUND_POINT, YGUnitPoint}));
- ASSERT_NE(v, (YGValue{CompactValue::UPPER_BOUND_POINT, YGUnitPercent}));
- ASSERT_FALSE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(YogaTest, compact_value_can_represent_negative_upper_bound_points) {
- auto c =
- CompactValue({YGValue{-CompactValue::UPPER_BOUND_POINT, YGUnitPoint}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_EQ(v, (YGValue{-CompactValue::UPPER_BOUND_POINT, YGUnitPoint}));
- ASSERT_NE(v, (YGValue{-CompactValue::UPPER_BOUND_POINT, YGUnitPercent}));
- ASSERT_FALSE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(
- YogaTest,
- compact_value_clamps_greater_than__upper_bound_points_to_upper_bound) {
- auto c = CompactValue({YGValue{tooLargePoints, YGUnitPoint}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_EQ(v, (YGValue{CompactValue::UPPER_BOUND_POINT, YGUnitPoint}));
- ASSERT_NE(v, (YGValue{CompactValue::UPPER_BOUND_POINT, YGUnitPercent}));
-}
-
-TEST(
- YogaTest,
- compact_value_clamps_smaller_than_negative_upper_bound_points_to_upper_bound) {
- auto c = CompactValue({YGValue{-tooLargePoints, YGUnitPoint}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_EQ(v, (YGValue{-CompactValue::UPPER_BOUND_POINT, YGUnitPoint}));
- ASSERT_NE(v, (YGValue{-CompactValue::UPPER_BOUND_POINT, YGUnitPercent}));
-}
-
-TEST(YogaTest, compact_value_can_represent_one_point) {
- auto c = CompactValue({YGValue{1, YGUnitPoint}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_EQ(v, (YGValue{1, YGUnitPoint}));
- ASSERT_NE(v, (YGValue{1, YGUnitPercent}));
- ASSERT_FALSE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(YogaTest, compact_value_can_represent_negative_one_point) {
- auto c = CompactValue({YGValue{-1, YGUnitPoint}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_EQ(v, (YGValue{-1, YGUnitPoint}));
- ASSERT_NE(v, (YGValue{-1, YGUnitPercent}));
- ASSERT_FALSE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(YogaTest, compact_value_can_represent_zero_percent) {
- auto c = CompactValue{YGValue{0, YGUnitPercent}};
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_NE(v, (YGValue{0, YGUnitPoint}));
- ASSERT_EQ(v, (YGValue{0, YGUnitPercent}));
- ASSERT_FALSE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(YogaTest, compact_value_can_represent_lower_bound_percent) {
- auto c = CompactValue({YGValue{CompactValue::LOWER_BOUND, YGUnitPercent}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_NE(v, (YGValue{CompactValue::LOWER_BOUND, YGUnitPoint}));
- ASSERT_EQ(v, (YGValue{CompactValue::LOWER_BOUND, YGUnitPercent}));
- ASSERT_FALSE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(YogaTest, compact_value_can_represent_negative_lower_bound_percent) {
- auto c = CompactValue({YGValue{-CompactValue::LOWER_BOUND, YGUnitPercent}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_NE(v, (YGValue{-CompactValue::LOWER_BOUND, YGUnitPoint}));
- ASSERT_EQ(v, (YGValue{-CompactValue::LOWER_BOUND, YGUnitPercent}));
- ASSERT_FALSE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(YogaTest, compact_value_clamps_smaller_than_lower_bound_percent_to_zero) {
- auto c = CompactValue({YGValue{tooSmall, YGUnitPercent}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_NE(v, (YGValue{0, YGUnitPoint}));
- ASSERT_EQ(v, (YGValue{0, YGUnitPercent}));
-}
-
-TEST(
- YogaTest,
- compact_value_clamps_greater_than_negative_lower_bound_percent_to_zero) {
- auto c = CompactValue({YGValue{-tooSmall, YGUnitPercent}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_NE(v, (YGValue{0, YGUnitPoint}));
- ASSERT_EQ(v, (YGValue{0, YGUnitPercent}));
-}
-
-TEST(YogaTest, compact_value_can_represent_upper_bound_percent) {
- auto c =
- CompactValue({YGValue{CompactValue::UPPER_BOUND_PERCENT, YGUnitPercent}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_NE(v, (YGValue{CompactValue::UPPER_BOUND_PERCENT, YGUnitPoint}));
- ASSERT_EQ(v, (YGValue{CompactValue::UPPER_BOUND_PERCENT, YGUnitPercent}));
- ASSERT_FALSE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(YogaTest, compact_value_can_represent_negative_upper_bound_percent) {
- auto c = CompactValue(
- {YGValue{-CompactValue::UPPER_BOUND_PERCENT, YGUnitPercent}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_NE(v, (YGValue{-CompactValue::UPPER_BOUND_PERCENT, YGUnitPoint}));
- ASSERT_EQ(v, (YGValue{-CompactValue::UPPER_BOUND_PERCENT, YGUnitPercent}));
- ASSERT_FALSE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(
- YogaTest,
- compact_value_clamps_greater_than_upper_bound_percent_to_upper_bound) {
- auto c = CompactValue({YGValue{tooLargePercent, YGUnitPercent}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_NE(v, (YGValue{CompactValue::UPPER_BOUND_PERCENT, YGUnitPoint}));
- ASSERT_EQ(v, (YGValue{CompactValue::UPPER_BOUND_PERCENT, YGUnitPercent}));
-}
-
-TEST(
- YogaTest,
- compact_value_clamps_smaller_than_negative_upper_bound_percent_to_upper_bound) {
- auto c = CompactValue({YGValue{-tooLargePercent, YGUnitPercent}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_NE(v, (YGValue{-CompactValue::UPPER_BOUND_PERCENT, YGUnitPoint}));
- ASSERT_EQ(v, (YGValue{-CompactValue::UPPER_BOUND_PERCENT, YGUnitPercent}));
-}
-
-TEST(YogaTest, compact_value_can_represent_one_percent) {
- auto c = CompactValue({YGValue{1, YGUnitPercent}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_NE(v, (YGValue{1, YGUnitPoint}));
- ASSERT_EQ(v, (YGValue{1, YGUnitPercent}));
- ASSERT_FALSE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(YogaTest, compact_value_can_represent_negative_one_percent) {
- auto c = CompactValue({YGValue{-1, YGUnitPercent}});
- YGValue v = c;
- ASSERT_NE(v, YGValueUndefined);
- ASSERT_NE(v, YGValueAuto);
- ASSERT_NE(v, (YGValue{-1, YGUnitPoint}));
- ASSERT_EQ(v, (YGValue{-1, YGUnitPercent}));
- ASSERT_FALSE(c.isUndefined());
- ASSERT_FALSE(c.isAuto());
-}
-
-TEST(YogaTest, dedicated_unit_factories) {
- ASSERT_EQ(CompactValue::ofUndefined(), CompactValue(YGValueUndefined));
- ASSERT_EQ(CompactValue::ofAuto(), CompactValue(YGValueAuto));
- ASSERT_EQ(
- CompactValue::of(-9876.5),
- CompactValue(YGValue{-9876.5, YGUnitPoint}));
- ASSERT_EQ(
- CompactValue::of(123.456),
- CompactValue(YGValue{123.456, YGUnitPercent}));
-}
-
-TEST(YogaTest, dedicated_unit_maybe_factories) {
- ASSERT_EQ(
- CompactValue::ofMaybe(-9876.5),
- CompactValue(YGValue{-9876.5, YGUnitPoint}));
- ASSERT_EQ(
- CompactValue::ofMaybe(YGUndefined),
- CompactValue(YGValueUndefined));
- ASSERT_EQ(
- CompactValue::ofMaybe(123.456),
- CompactValue(YGValue{123.456, YGUnitPercent}));
- ASSERT_EQ(
- CompactValue::ofMaybe(YGUndefined),
- CompactValue(YGValueUndefined));
-}
-
-TEST(YogaTest, can_be_assigned_from_YGValue) {
- CompactValue c{};
-
- YGValue v{2.0, YGUnitPercent};
- c = v;
- ASSERT_EQ((YGValue) c, v);
-
- c = YGValue{123, YGUnitPoint};
- ASSERT_EQ((YGValue) c, (YGValue{123, YGUnitPoint}));
-}
-
-TEST(YogaTest, compact_value_bound_representations) {
- ASSERT_EQ(
- CompactValue::of(CompactValue::LOWER_BOUND).repr(),
- uint64_t{0});
- ASSERT_EQ(
- CompactValue::of(CompactValue::UPPER_BOUND_POINT).repr(),
- uint64_t{0x3fffffffffffffff});
- ASSERT_EQ(
- CompactValue::of(CompactValue::LOWER_BOUND).repr(),
- uint64_t{0x4000000000000000});
- ASSERT_EQ(
- CompactValue::of(CompactValue::UPPER_BOUND_PERCENT).repr(),
- uint64_t{0x7f7fffffffffffff});
-
- ASSERT_EQ(
- CompactValue::of(-CompactValue::LOWER_BOUND).repr(),
- uint64_t{0x8000000000000000});
- ASSERT_EQ(
- CompactValue::of(-CompactValue::UPPER_BOUND_POINT).repr(),
- uint64_t{0xbfffffffffffffff});
- ASSERT_EQ(
- CompactValue::of(-CompactValue::LOWER_BOUND).repr(),
- uint64_t{0xc000000000000000});
- ASSERT_EQ(
- CompactValue::of(-CompactValue::UPPER_BOUND_PERCENT)
- .repr(),
- uint64_t{0xff7fffffffffffff});
-}
diff --git a/tests/EventsTest.cpp b/tests/EventsTest.cpp
index f67eb74245..f911b4b211 100644
--- a/tests/EventsTest.cpp
+++ b/tests/EventsTest.cpp
@@ -1,37 +1,34 @@
/*
- * Copyright (c) Facebook, Inc. and its affiliates.
+ * 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
+#include
#include
#include
-#include
-#include
#include
#include
#include
#include
-#include
-namespace facebook {
-namespace yoga {
-namespace test {
+#include "util/TestUtil.h"
+
+namespace facebook::yoga::test {
template
struct TypedEventTestData {};
template <>
struct TypedEventTestData {
- void* layoutContext;
LayoutData layoutData;
};
struct EventArgs {
- const YGNode* node;
+ const YGNodeConstRef node;
Event::Type type;
std::unique_ptr> dataPtr;
std::unique_ptr> eventTestDataPtr;
@@ -48,12 +45,17 @@ struct EventArgs {
};
class EventTest : public ::testing::Test {
- ScopedEventSubscription subscription = {&EventTest::listen};
- static void listen(const YGNode&, Event::Type, Event::Data);
+ ScopedEventSubscription subscription{&EventTest::listen};
+ static void listen(
+ YGNodeConstRef /*node*/,
+ Event::Type /*type*/,
+ Event::Data /*data*/);
-public:
+ public:
static std::vector events;
- static EventArgs& lastEvent() { return events.back(); }
+ static EventArgs& lastEvent() {
+ return events.back();
+ }
void TearDown() override;
};
@@ -231,9 +233,9 @@ TEST_F(EventTest, layout_events_has_max_measure_cache) {
YGNodeInsertChild(root, a, 0);
auto b = YGNodeNew();
YGNodeInsertChild(root, b, 1);
- YGNodeStyleSetFlexBasis(a, 10.0);
+ YGNodeStyleSetFlexBasis(a, 10.0f);
- for (auto s : {20, 30, 40}) {
+ for (auto s : {20.0f, 30.0f, 40.0f}) {
YGNodeCalculateLayout(root, s, s, YGDirectionLTR);
}
@@ -251,7 +253,7 @@ TEST_F(EventTest, layout_events_has_max_measure_cache) {
TEST_F(EventTest, measure_functions_get_wrapped) {
auto root = YGNodeNew();
YGNodeSetMeasureFunc(
- root, [](YGNodeRef, double, YGMeasureMode, double, YGMeasureMode) {
+ root, [](YGNodeConstRef, float, YGMeasureMode, float, YGMeasureMode) {
return YGSize{};
});
@@ -269,7 +271,8 @@ TEST_F(EventTest, baseline_functions_get_wrapped) {
auto child = YGNodeNew();
YGNodeInsertChild(root, child, 0);
- YGNodeSetBaselineFunc(child, [](YGNodeRef, double, double) { return 0.0; });
+ YGNodeSetBaselineFunc(
+ child, [](YGNodeConstRef, float, float) { return 0.0f; });
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignItems(root, YGAlignBaseline);
@@ -285,16 +288,16 @@ TEST_F(EventTest, baseline_functions_get_wrapped) {
namespace {
template
-EventArgs createArgs(const YGNode& node, const Event::Data data) {
+EventArgs createArgs(YGNodeConstRef node, const Event::Data data) {
using Data = Event::TypedData;
auto deleteData = [](void* x) { delete static_cast(x); };
- return {&node, E, {new Data{(data.get())}, deleteData}};
+ return {node, E, {new Data{(data.get())}, deleteData}, nullptr};
}
template
EventArgs createArgs(
- const YGNode& node,
+ YGNodeConstRef node,
const Event::Data data,
TypedEventTestData eventTestData) {
using EventTestData = TypedEventTestData;
@@ -310,7 +313,10 @@ EventArgs createArgs(
} // namespace
-void EventTest::listen(const YGNode& node, Event::Type type, Event::Data data) {
+void EventTest::listen(
+ YGNodeConstRef node,
+ Event::Type type,
+ Event::Data data) {
switch (type) {
case Event::NodeAllocation:
events.push_back(createArgs(node, data));
@@ -327,7 +333,7 @@ void EventTest::listen(const YGNode& node, Event::Type type, Event::Data data) {
case Event::LayoutPassEnd: {
auto& eventData = data.get();
events.push_back(createArgs(
- node, data, {eventData.layoutContext, *eventData.layoutData}));
+ node, data, {*eventData.layoutData}));
break;
}
@@ -352,6 +358,4 @@ void EventTest::TearDown() {
std::vector EventTest::events{};
-} // namespace test
-} // namespace yoga
-} // namespace facebook
+} // namespace facebook::yoga::test
diff --git a/tests/FlexGapTest.cpp b/tests/FlexGapTest.cpp
new file mode 100644
index 0000000000..e9cd392dfa
--- /dev/null
+++ b/tests/FlexGapTest.cpp
@@ -0,0 +1,93 @@
+/*
+ * 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
+#include
+
+// TODO: move this to a fixture based test once it supports parsing negative
+// values
+TEST(FlexGap, gap_negative_value) {
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetGap(root, YGGutterAll, -20);
+ YGNodeStyleSetHeight(root, 200);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 20);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child1, 20);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ YGNodeRef root_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child2, 20);
+ YGNodeInsertChild(root, root_child2, 2);
+
+ YGNodeRef root_child3 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child3, 20);
+ YGNodeInsertChild(root, root_child3, 3);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(80, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child2));
+
+ ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child3));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child3));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child3));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child3));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(80, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child2));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child3));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child3));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child3));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
diff --git a/tests/YGFloatOptionalTest.cpp b/tests/FloatOptionalTest.cpp
similarity index 64%
rename from tests/YGFloatOptionalTest.cpp
rename to tests/FloatOptionalTest.cpp
index 4bc34bfe69..2e1f37ce7d 100644
--- a/tests/YGFloatOptionalTest.cpp
+++ b/tests/FloatOptionalTest.cpp
@@ -1,28 +1,33 @@
/*
- * Copyright (c) Facebook, Inc. and its affiliates.
+ * 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
+
#include
-#include
-#include
#include
+#include
+#include
+
+using namespace facebook;
+using namespace facebook::yoga;
-constexpr auto empty = YGFloatOptional{};
-constexpr auto zero = YGFloatOptional{0.0};
-constexpr auto one = YGFloatOptional{1.0};
-constexpr auto positive = YGFloatOptional{1234.5};
-constexpr auto negative = YGFloatOptional{-9876.5};
+constexpr auto empty = FloatOptional{};
+constexpr auto zero = FloatOptional{0.0f};
+constexpr auto one = FloatOptional{1.0f};
+constexpr auto positive = FloatOptional{1234.5f};
+constexpr auto negative = FloatOptional{-9876.5f};
-TEST(YGFloatOptional, value) {
+TEST(FloatOptional, value) {
ASSERT_TRUE(YGFloatIsUndefined(empty.unwrap()));
- ASSERT_EQ(zero.unwrap(), 0.0);
- ASSERT_EQ(one.unwrap(), 1.0);
- ASSERT_EQ(positive.unwrap(), 1234.5);
- ASSERT_EQ(negative.unwrap(), -9876.5);
+ ASSERT_EQ(zero.unwrap(), 0.0f);
+ ASSERT_EQ(one.unwrap(), 1.0f);
+ ASSERT_EQ(positive.unwrap(), 1234.5f);
+ ASSERT_EQ(negative.unwrap(), -9876.5f);
ASSERT_TRUE(empty.isUndefined());
ASSERT_FALSE(zero.isUndefined());
@@ -31,20 +36,20 @@ TEST(YGFloatOptional, value) {
ASSERT_FALSE(negative.isUndefined());
}
-TEST(YGFloatOptional, equality) {
+TEST(FloatOptional, equality) {
ASSERT_TRUE(empty == empty);
ASSERT_TRUE(empty == YGUndefined);
ASSERT_FALSE(empty == zero);
ASSERT_FALSE(empty == negative);
- ASSERT_FALSE(empty == 12.3);
+ ASSERT_FALSE(empty == 12.3f);
ASSERT_TRUE(zero == zero);
- ASSERT_TRUE(zero == 0.0);
+ ASSERT_TRUE(zero == 0.0f);
ASSERT_FALSE(zero == positive);
- ASSERT_FALSE(zero == -5555.5);
+ ASSERT_FALSE(zero == -5555.5f);
ASSERT_TRUE(one == one);
- ASSERT_TRUE(one == 1.0);
+ ASSERT_TRUE(one == 1.0f);
ASSERT_FALSE(one == positive);
ASSERT_TRUE(positive == positive);
@@ -56,20 +61,20 @@ TEST(YGFloatOptional, equality) {
ASSERT_FALSE(negative == zero);
}
-TEST(YGFloatOptional, inequality) {
+TEST(FloatOptional, inequality) {
ASSERT_FALSE(empty != empty);
ASSERT_FALSE(empty != YGUndefined);
ASSERT_TRUE(empty != zero);
ASSERT_TRUE(empty != negative);
- ASSERT_TRUE(empty != 12.3);
+ ASSERT_TRUE(empty != 12.3f);
ASSERT_FALSE(zero != zero);
- ASSERT_FALSE(zero != 0.0);
+ ASSERT_FALSE(zero != 0.0f);
ASSERT_TRUE(zero != positive);
- ASSERT_TRUE(zero != -5555.5);
+ ASSERT_TRUE(zero != -5555.5f);
ASSERT_FALSE(one != one);
- ASSERT_FALSE(one != 1.0);
+ ASSERT_FALSE(one != 1.0f);
ASSERT_TRUE(one != positive);
ASSERT_FALSE(positive != positive);
@@ -81,7 +86,7 @@ TEST(YGFloatOptional, inequality) {
ASSERT_TRUE(negative != zero);
}
-TEST(YGFloatOptional, greater_than_with_undefined) {
+TEST(FloatOptional, greater_than_with_undefined) {
ASSERT_FALSE(empty > empty);
ASSERT_FALSE(empty > zero);
ASSERT_FALSE(empty > one);
@@ -93,7 +98,7 @@ TEST(YGFloatOptional, greater_than_with_undefined) {
ASSERT_FALSE(negative > empty);
}
-TEST(YGFloatOptional, greater_than) {
+TEST(FloatOptional, greater_than) {
ASSERT_TRUE(zero > negative);
ASSERT_FALSE(zero > zero);
ASSERT_FALSE(zero > positive);
@@ -103,10 +108,10 @@ TEST(YGFloatOptional, greater_than) {
ASSERT_TRUE(one > zero);
ASSERT_FALSE(one > positive);
- ASSERT_TRUE(negative > YGFloatOptional{-INFINITY});
+ ASSERT_TRUE(negative > FloatOptional{-INFINITY});
}
-TEST(YGFloatOptional, less_than_with_undefined) {
+TEST(FloatOptional, less_than_with_undefined) {
ASSERT_FALSE(empty < empty);
ASSERT_FALSE(zero < empty);
ASSERT_FALSE(one < empty);
@@ -118,7 +123,7 @@ TEST(YGFloatOptional, less_than_with_undefined) {
ASSERT_FALSE(empty < negative);
}
-TEST(YGFloatOptional, less_than) {
+TEST(FloatOptional, less_than) {
ASSERT_TRUE(negative < zero);
ASSERT_FALSE(zero < zero);
ASSERT_FALSE(positive < zero);
@@ -128,10 +133,10 @@ TEST(YGFloatOptional, less_than) {
ASSERT_TRUE(zero < one);
ASSERT_FALSE(positive < one);
- ASSERT_TRUE(YGFloatOptional{-INFINITY} < negative);
+ ASSERT_TRUE(FloatOptional{-INFINITY} < negative);
}
-TEST(YGFloatOptional, greater_than_equals_with_undefined) {
+TEST(FloatOptional, greater_than_equals_with_undefined) {
ASSERT_TRUE(empty >= empty);
ASSERT_FALSE(empty >= zero);
ASSERT_FALSE(empty >= one);
@@ -143,7 +148,7 @@ TEST(YGFloatOptional, greater_than_equals_with_undefined) {
ASSERT_FALSE(negative >= empty);
}
-TEST(YGFloatOptional, greater_than_equals) {
+TEST(FloatOptional, greater_than_equals) {
ASSERT_TRUE(zero >= negative);
ASSERT_TRUE(zero >= zero);
ASSERT_FALSE(zero >= positive);
@@ -153,10 +158,10 @@ TEST(YGFloatOptional, greater_than_equals) {
ASSERT_TRUE(one >= zero);
ASSERT_FALSE(one >= positive);
- ASSERT_TRUE(negative >= YGFloatOptional{-INFINITY});
+ ASSERT_TRUE(negative >= FloatOptional{-INFINITY});
}
-TEST(YGFloatOptional, less_than_equals_with_undefined) {
+TEST(FloatOptional, less_than_equals_with_undefined) {
ASSERT_TRUE(empty <= empty);
ASSERT_FALSE(zero <= empty);
ASSERT_FALSE(one <= empty);
@@ -168,7 +173,7 @@ TEST(YGFloatOptional, less_than_equals_with_undefined) {
ASSERT_FALSE(empty <= negative);
}
-TEST(YGFloatOptional, less_than_equals) {
+TEST(FloatOptional, less_than_equals) {
ASSERT_TRUE(negative <= zero);
ASSERT_TRUE(zero <= zero);
ASSERT_FALSE(positive <= zero);
@@ -178,32 +183,32 @@ TEST(YGFloatOptional, less_than_equals) {
ASSERT_TRUE(zero <= one);
ASSERT_FALSE(positive <= one);
- ASSERT_TRUE(YGFloatOptional{-INFINITY} <= negative);
+ ASSERT_TRUE(FloatOptional{-INFINITY} <= negative);
}
-TEST(YGFloatOptional, addition) {
+TEST(FloatOptional, addition) {
auto n = negative.unwrap();
auto p = positive.unwrap();
ASSERT_EQ(zero + one, one);
- ASSERT_EQ(negative + positive, YGFloatOptional{n + p});
+ ASSERT_EQ(negative + positive, FloatOptional{n + p});
ASSERT_EQ(empty + zero, empty);
ASSERT_EQ(empty + empty, empty);
ASSERT_EQ(negative + empty, empty);
}
-TEST(YGFloatOptionalTest, YGFloatOptionalMax) {
- ASSERT_EQ(YGFloatOptionalMax(empty, empty), empty);
- ASSERT_EQ(YGFloatOptionalMax(empty, positive), positive);
- ASSERT_EQ(YGFloatOptionalMax(negative, empty), negative);
- ASSERT_EQ(YGFloatOptionalMax(negative, YGFloatOptional{-INFINITY}), negative);
+TEST(YGFloatOptiona, maxOrDefined) {
+ ASSERT_EQ(yoga::maxOrDefined(empty, empty), empty);
+ ASSERT_EQ(yoga::maxOrDefined(empty, positive), positive);
+ ASSERT_EQ(yoga::maxOrDefined(negative, empty), negative);
+ ASSERT_EQ(yoga::maxOrDefined(negative, FloatOptional{-INFINITY}), negative);
ASSERT_EQ(
- YGFloatOptionalMax(YGFloatOptional{1.0}, YGFloatOptional{1.125}),
- YGFloatOptional{1.125});
+ yoga::maxOrDefined(FloatOptional{1.0f}, FloatOptional{1.125f}),
+ FloatOptional{1.125f});
}
-TEST(YGFloatOptionalTest, unwrap) {
+TEST(FloatOptional, unwrap) {
ASSERT_TRUE(YGFloatIsUndefined(empty.unwrap()));
- ASSERT_EQ(zero.unwrap(), 0.0);
- ASSERT_EQ(YGFloatOptional{123456.78}.unwrap(), 123456.78);
+ ASSERT_EQ(zero.unwrap(), 0.0f);
+ ASSERT_EQ(FloatOptional{123456.78f}.unwrap(), 123456.78f);
}
diff --git a/tests/InternalTest.cpp b/tests/InternalTest.cpp
deleted file mode 100644
index 9a789086f3..0000000000
--- a/tests/InternalTest.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#include
-#include
-
-using namespace facebook::yoga::internal;
-
-struct YogaInternalTest : public testing::Test {
- void SetUp() override;
-};
-
-TEST_F(YogaInternalTest, experiments_are_initially_disabled) {
- ASSERT_EQ(isEnabled(Experiment::kDoubleMeasureCallbacks), false);
-}
-
-TEST_F(YogaInternalTest, experiments_are_can_be_enabled) {
- enable(Experiment::kDoubleMeasureCallbacks);
- ASSERT_EQ(isEnabled(Experiment::kDoubleMeasureCallbacks), true);
-}
-
-TEST_F(YogaInternalTest, experiments_are_can_be_disabled) {
- enable(Experiment::kDoubleMeasureCallbacks);
- disable(Experiment::kDoubleMeasureCallbacks);
-
- ASSERT_EQ(isEnabled(Experiment::kDoubleMeasureCallbacks), false);
-}
-
-TEST_F(YogaInternalTest, experiments_are_can_be_toggled_on) {
- disable(Experiment::kDoubleMeasureCallbacks);
-
- ASSERT_EQ(toggle(Experiment::kDoubleMeasureCallbacks), false);
- ASSERT_EQ(isEnabled(Experiment::kDoubleMeasureCallbacks), true);
-}
-
-TEST_F(YogaInternalTest, experiments_are_can_be_toggled_off) {
- enable(Experiment::kDoubleMeasureCallbacks);
-
- ASSERT_EQ(toggle(Experiment::kDoubleMeasureCallbacks), true);
- ASSERT_EQ(isEnabled(Experiment::kDoubleMeasureCallbacks), false);
-}
-
-void YogaInternalTest::SetUp() {
- disableAllExperiments();
-}
diff --git a/tests/OrdinalsTest.cpp b/tests/OrdinalsTest.cpp
new file mode 100644
index 0000000000..8360b51351
--- /dev/null
+++ b/tests/OrdinalsTest.cpp
@@ -0,0 +1,35 @@
+/*
+ * 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
+
+#include
+#include
+
+namespace facebook::yoga {
+
+TEST(Ordinals, iteration) {
+ std::deque expectedEdges{
+ Edge::Left,
+ Edge::Top,
+ Edge::Right,
+ Edge::Bottom,
+ Edge::Start,
+ Edge::End,
+ Edge::Horizontal,
+ Edge::Vertical,
+ Edge::All};
+
+ for (auto edge : yoga::ordinals()) {
+ ASSERT_EQ(edge, expectedEdges.front());
+ expectedEdges.pop_front();
+ }
+
+ ASSERT_TRUE(expectedEdges.empty());
+}
+
+} // namespace facebook::yoga
diff --git a/tests/SmallValueBufferTest.cpp b/tests/SmallValueBufferTest.cpp
new file mode 100644
index 0000000000..21f897e33d
--- /dev/null
+++ b/tests/SmallValueBufferTest.cpp
@@ -0,0 +1,161 @@
+/*
+ * 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
+#include
+
+namespace facebook::yoga {
+
+constexpr size_t kBufferSize = 4;
+
+TEST(SmallValueBuffer, copy_assignment_with_overflow) {
+ std::array handles{};
+
+ SmallValueBuffer buffer1;
+ for (size_t i = 0; i < kBufferSize + 1; ++i) {
+ handles[i] = buffer1.push(static_cast(i));
+ }
+
+ SmallValueBuffer buffer2 = buffer1;
+ for (size_t i = 0; i < kBufferSize + 1; ++i) {
+ EXPECT_EQ(buffer2.get32(handles[i]), i);
+ }
+
+ auto handle = buffer1.push(42u);
+ EXPECT_EQ(buffer1.get32(handle), 42);
+
+ EXPECT_THROW({ buffer2.get32(handle); }, std::logic_error);
+}
+
+TEST(SmallValueBuffer, push_32) {
+ uint32_t magic = 88567114u;
+
+ SmallValueBuffer buffer;
+ auto handle = buffer.push(magic);
+ EXPECT_EQ(buffer.get32(handle), magic);
+}
+
+TEST(SmallValueBuffer, push_overflow) {
+ uint32_t magic1 = 88567114u;
+ uint32_t magic2 = 351012214u;
+ uint32_t magic3 = 146122128u;
+ uint32_t magic4 = 2171092154u;
+ uint32_t magic5 = 2269016953u;
+
+ SmallValueBuffer buffer;
+ EXPECT_EQ(buffer.get32(buffer.push(magic1)), magic1);
+ EXPECT_EQ(buffer.get32(buffer.push(magic2)), magic2);
+ EXPECT_EQ(buffer.get32(buffer.push(magic3)), magic3);
+ EXPECT_EQ(buffer.get32(buffer.push(magic4)), magic4);
+ EXPECT_EQ(buffer.get32(buffer.push(magic5)), magic5);
+}
+
+TEST(SmallValueBuffer, push_64) {
+ uint64_t magic = 118138934255546108ull;
+
+ SmallValueBuffer buffer;
+ auto handle = buffer.push(magic);
+ EXPECT_EQ(buffer.get64(handle), magic);
+}
+
+TEST(SmallValueBuffer, push_64_overflow) {
+ uint64_t magic1 = 1401612388342512ull;
+ uint64_t magic2 = 118712305386210ull;
+ uint64_t magic3 = 752431801563359011ull;
+ uint64_t magic4 = 118138934255546108ull;
+ uint64_t magic5 = 237115443124116111ull;
+
+ SmallValueBuffer buffer;
+ EXPECT_EQ(buffer.get64(buffer.push(magic1)), magic1);
+ EXPECT_EQ(buffer.get64(buffer.push(magic2)), magic2);
+ EXPECT_EQ(buffer.get64(buffer.push(magic3)), magic3);
+ EXPECT_EQ(buffer.get64(buffer.push(magic4)), magic4);
+ EXPECT_EQ(buffer.get64(buffer.push(magic5)), magic5);
+}
+
+TEST(SmallValueBuffer, push_64_after_32) {
+ uint32_t magic32 = 88567114u;
+ uint64_t magic64 = 118712305386210ull;
+
+ SmallValueBuffer buffer;
+ auto handle32 = buffer.push(magic32);
+ EXPECT_EQ(buffer.get32(handle32), magic32);
+
+ auto handle64 = buffer.push(magic64);
+ EXPECT_EQ(buffer.get64(handle64), magic64);
+}
+
+TEST(SmallValueBuffer, push_32_after_64) {
+ uint32_t magic32 = 88567114u;
+ uint64_t magic64 = 118712305386210ull;
+
+ SmallValueBuffer buffer;
+ auto handle64 = buffer.push(magic64);
+ EXPECT_EQ(buffer.get64(handle64), magic64);
+
+ auto handle32 = buffer.push(magic32);
+ EXPECT_EQ(buffer.get32(handle32), magic32);
+}
+
+TEST(SmallValueBuffer, replace_32_with_32) {
+ uint32_t magic1 = 88567114u;
+ uint32_t magic2 = 351012214u;
+
+ SmallValueBuffer buffer;
+ auto handle = buffer.push(magic1);
+
+ EXPECT_EQ(buffer.get32(buffer.replace(handle, magic2)), magic2);
+}
+
+TEST(SmallValueBuffer, replace_32_with_64) {
+ uint32_t magic32 = 88567114u;
+ uint64_t magic64 = 118712305386210ull;
+
+ SmallValueBuffer buffer;
+ auto handle = buffer.push(magic32);
+
+ EXPECT_EQ(buffer.get64(buffer.replace(handle, magic64)), magic64);
+}
+
+TEST(SmallValueBuffer, replace_32_with_64_causes_overflow) {
+ uint32_t magic1 = 88567114u;
+ uint32_t magic2 = 351012214u;
+ uint32_t magic3 = 146122128u;
+ uint32_t magic4 = 2171092154u;
+
+ uint64_t magic64 = 118712305386210ull;
+
+ SmallValueBuffer buffer;
+ auto handle1 = buffer.push(magic1);
+ buffer.push(magic2);
+ buffer.push(magic3);
+ buffer.push(magic4);
+
+ EXPECT_EQ(buffer.get64(buffer.replace(handle1, magic64)), magic64);
+}
+
+TEST(SmallValueBuffer, replace_64_with_32) {
+ uint32_t magic32 = 88567114u;
+ uint64_t magic64 = 118712305386210ull;
+
+ SmallValueBuffer buffer;
+ auto handle = buffer.push(magic64);
+
+ EXPECT_EQ(buffer.get32(buffer.replace(handle, magic32)), magic32);
+}
+
+TEST(SmallValueBuffer, replace_64_with_64) {
+ uint64_t magic1 = 1401612388342512ull;
+ uint64_t magic2 = 118712305386210ull;
+
+ SmallValueBuffer buffer;
+ auto handle = buffer.push(magic1);
+
+ EXPECT_EQ(buffer.get64(buffer.replace(handle, magic2)), magic2);
+}
+
+} // namespace facebook::yoga
diff --git a/tests/StyleTest.cpp b/tests/StyleTest.cpp
new file mode 100644
index 0000000000..d44b73d50f
--- /dev/null
+++ b/tests/StyleTest.cpp
@@ -0,0 +1,44 @@
+/*
+ * 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
+#include
+
+namespace facebook::yoga {
+
+TEST(Style, computed_padding_is_floored) {
+ yoga::Style style;
+ style.setPadding(Edge::All, StyleLength::points(-1.0f));
+ auto paddingStart = style.computeInlineStartPadding(
+ FlexDirection::Row, Direction::LTR, 0.0f /*widthSize*/);
+ ASSERT_EQ(paddingStart, 0.0f);
+}
+
+TEST(Style, computed_border_is_floored) {
+ yoga::Style style;
+ style.setBorder(Edge::All, StyleLength::points(-1.0f));
+ auto borderStart =
+ style.computeInlineStartBorder(FlexDirection::Row, Direction::LTR);
+ ASSERT_EQ(borderStart, 0.0f);
+}
+
+TEST(Style, computed_gap_is_floored) {
+ yoga::Style style;
+ style.setGap(Gutter::Column, StyleLength::points(-1.0f));
+ auto gapBetweenColumns = style.computeGapForAxis(FlexDirection::Row, 0.0);
+ ASSERT_EQ(gapBetweenColumns, 0.0f);
+}
+
+TEST(Style, computed_margin_is_not_floored) {
+ yoga::Style style;
+ style.setMargin(Edge::All, StyleLength::points(-1.0f));
+ auto marginStart = style.computeInlineStartMargin(
+ FlexDirection::Row, Direction::LTR, 0.0f /*widthSize*/);
+ ASSERT_EQ(marginStart, -1.0f);
+}
+
+} // namespace facebook::yoga
diff --git a/tests/StyleValuePoolTest.cpp b/tests/StyleValuePoolTest.cpp
new file mode 100644
index 0000000000..ff38acff36
--- /dev/null
+++ b/tests/StyleValuePoolTest.cpp
@@ -0,0 +1,146 @@
+/*
+ * 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
+#include
+
+namespace facebook::yoga {
+
+TEST(StyleValuePool, undefined_at_init) {
+ StyleValuePool pool;
+ StyleValueHandle handle;
+
+ EXPECT_TRUE(handle.isUndefined());
+ EXPECT_FALSE(handle.isDefined());
+ EXPECT_EQ(pool.getLength(handle), StyleLength::undefined());
+ EXPECT_EQ(pool.getNumber(handle), FloatOptional{});
+}
+
+TEST(StyleValuePool, auto_at_init) {
+ StyleValuePool pool;
+ auto handle = StyleValueHandle::ofAuto();
+
+ EXPECT_TRUE(handle.isAuto());
+ EXPECT_EQ(pool.getLength(handle), StyleLength::ofAuto());
+}
+
+TEST(StyleValuePool, store_small_int_points) {
+ StyleValuePool pool;
+ StyleValueHandle handle;
+
+ pool.store(handle, StyleLength::points(10));
+
+ EXPECT_EQ(pool.getLength(handle), StyleLength::points(10));
+}
+
+TEST(StyleValuePool, store_small_negative_int_points) {
+ StyleValuePool pool;
+ StyleValueHandle handle;
+
+ pool.store(handle, StyleLength::points(-10));
+
+ EXPECT_EQ(pool.getLength(handle), StyleLength::points(-10));
+}
+
+TEST(StyleValuePool, store_small_int_percent) {
+ StyleValuePool pool;
+ StyleValueHandle handle;
+
+ pool.store(handle, StyleLength::percent(10));
+
+ EXPECT_EQ(pool.getLength(handle), StyleLength::percent(10));
+}
+
+TEST(StyleValuePool, store_large_int_percent) {
+ StyleValuePool pool;
+ StyleValueHandle handle;
+
+ pool.store(handle, StyleLength::percent(262144));
+
+ EXPECT_EQ(pool.getLength(handle), StyleLength::percent(262144));
+}
+
+TEST(StyleValuePool, store_large_int_after_small_int) {
+ StyleValuePool pool;
+ StyleValueHandle handle;
+
+ pool.store(handle, StyleLength::percent(10));
+ pool.store(handle, StyleLength::percent(262144));
+
+ EXPECT_EQ(pool.getLength(handle), StyleLength::percent(262144));
+}
+
+TEST(StyleValuePool, store_small_int_after_large_int) {
+ StyleValuePool pool;
+ StyleValueHandle handle;
+
+ pool.store(handle, StyleLength::percent(262144));
+ pool.store(handle, StyleLength::percent(10));
+
+ EXPECT_EQ(pool.getLength(handle), StyleLength::percent(10));
+}
+
+TEST(StyleValuePool, store_small_int_number) {
+ StyleValuePool pool;
+ StyleValueHandle handle;
+
+ pool.store(handle, FloatOptional{10.0f});
+
+ EXPECT_EQ(pool.getNumber(handle), FloatOptional{10.0f});
+}
+
+TEST(StyleValuePool, store_undefined) {
+ StyleValuePool pool;
+ StyleValueHandle handle;
+
+ pool.store(handle, StyleLength::undefined());
+
+ EXPECT_TRUE(handle.isUndefined());
+ EXPECT_FALSE(handle.isDefined());
+ EXPECT_EQ(pool.getLength(handle), StyleLength::undefined());
+}
+
+TEST(StyleValuePool, store_undefined_after_small_int) {
+ StyleValuePool pool;
+ StyleValueHandle handle;
+
+ pool.store(handle, StyleLength::points(10));
+ pool.store(handle, StyleLength::undefined());
+
+ EXPECT_TRUE(handle.isUndefined());
+ EXPECT_FALSE(handle.isDefined());
+ EXPECT_EQ(pool.getLength(handle), StyleLength::undefined());
+}
+
+TEST(StyleValuePool, store_undefined_after_large_int) {
+ StyleValuePool pool;
+ StyleValueHandle handle;
+
+ pool.store(handle, StyleLength::points(262144));
+ pool.store(handle, StyleLength::undefined());
+
+ EXPECT_TRUE(handle.isUndefined());
+ EXPECT_FALSE(handle.isDefined());
+ EXPECT_EQ(pool.getLength(handle), StyleLength::undefined());
+}
+
+TEST(StyleValuePool, store_keywords) {
+ StyleValuePool pool;
+ StyleValueHandle handleMaxContent;
+ StyleValueHandle handleFitContent;
+ StyleValueHandle handleStretch;
+
+ pool.store(handleMaxContent, StyleSizeLength::ofMaxContent());
+ pool.store(handleFitContent, StyleSizeLength::ofFitContent());
+ pool.store(handleStretch, StyleSizeLength::ofStretch());
+
+ EXPECT_EQ(pool.getSize(handleMaxContent), StyleSizeLength::ofMaxContent());
+ EXPECT_EQ(pool.getSize(handleFitContent), StyleSizeLength::ofFitContent());
+ EXPECT_EQ(pool.getSize(handleStretch), StyleSizeLength::ofStretch());
+}
+
+} // namespace facebook::yoga
diff --git a/tests/YGAlignBaselineTest.cpp b/tests/YGAlignBaselineTest.cpp
index ffa652468c..e8c896ce39 100644
--- a/tests/YGAlignBaselineTest.cpp
+++ b/tests/YGAlignBaselineTest.cpp
@@ -1,43 +1,36 @@
/*
- * Copyright (c) Facebook, Inc. and its affiliates.
+ * 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
-#include
#include
-static double _baselineFunc(
- YGNodeRef node,
- const double width,
- const double height) {
+static float _baselineFunc(
+ YGNodeConstRef /*node*/,
+ const float /*width*/,
+ const float height) {
return height / 2;
}
static YGSize _measure1(
- YGNodeRef node,
- double width,
- YGMeasureMode widthMode,
- double height,
- YGMeasureMode heightMode) {
- return YGSize{
- .width = 42,
- .height = 50,
- };
+ YGNodeConstRef /*node*/,
+ float /*width*/,
+ YGMeasureMode /*widthMode*/,
+ float /*height*/,
+ YGMeasureMode /*heightMode*/) {
+ return YGSize{42, 50};
}
static YGSize _measure2(
- YGNodeRef node,
- double width,
- YGMeasureMode widthMode,
- double height,
- YGMeasureMode heightMode) {
- return YGSize{
- .width = 279,
- .height = 126,
- };
+ YGNodeConstRef /*node*/,
+ float /*width*/,
+ YGMeasureMode /*widthMode*/,
+ float /*height*/,
+ YGMeasureMode /*heightMode*/) {
+ return YGSize{279, 126};
}
static YGNodeRef createYGNode(
@@ -46,13 +39,13 @@ static YGNodeRef createYGNode(
int width,
int height,
bool alignBaseline) {
- const YGNodeRef node = YGNodeNewWithConfig(config);
+ YGNodeRef node = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(node, direction);
if (alignBaseline) {
YGNodeStyleSetAlignItems(node, YGAlignBaseline);
}
- YGNodeStyleSetWidth(node, width);
- YGNodeStyleSetHeight(node, height);
+ YGNodeStyleSetWidth(node, (float)width);
+ YGNodeStyleSetHeight(node, (float)height);
return node;
}
@@ -60,7 +53,7 @@ static YGNodeRef createYGNode(
TEST(YogaTest, align_baseline_parent_ht_not_specified) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignContent(root, YGAlignStretch);
YGNodeStyleSetAlignItems(root, YGAlignBaseline);
@@ -68,13 +61,13 @@ TEST(YogaTest, align_baseline_parent_ht_not_specified) {
YGNodeStyleSetMaxHeight(root, 170);
YGNodeStyleSetMinHeight(root, 0);
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexGrow(root_child0, 0);
YGNodeStyleSetFlexShrink(root_child0, 1);
YGNodeSetMeasureFunc(root_child0, _measure1);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexGrow(root_child1, 0);
YGNodeStyleSetFlexShrink(root_child1, 1);
YGNodeSetMeasureFunc(root_child1, _measure2);
@@ -105,17 +98,17 @@ TEST(YogaTest, align_baseline_parent_ht_not_specified) {
TEST(YogaTest, align_baseline_with_no_parent_ht) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignItems(root, YGAlignBaseline);
YGNodeStyleSetWidth(root, 150);
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child0, 50);
YGNodeStyleSetHeight(root_child0, 50);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child1, 50);
YGNodeStyleSetHeight(root_child1, 40);
YGNodeSetBaselineFunc(root_child1, _baselineFunc);
@@ -146,17 +139,17 @@ TEST(YogaTest, align_baseline_with_no_parent_ht) {
TEST(YogaTest, align_baseline_with_no_baseline_func_and_no_parent_ht) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignItems(root, YGAlignBaseline);
YGNodeStyleSetWidth(root, 150);
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child0, 50);
YGNodeStyleSetHeight(root_child0, 80);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child1, 50);
YGNodeStyleSetHeight(root_child1, 50);
YGNodeInsertChild(root, root_child1, 1);
@@ -186,24 +179,23 @@ TEST(YogaTest, align_baseline_with_no_baseline_func_and_no_parent_ht) {
TEST(YogaTest, align_baseline_parent_using_child_in_column_as_reference) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root =
- createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
+ YGNodeRef root = createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
- const YGNodeRef root_child0 =
+ YGNodeRef root_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 600, false);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 =
+ YGNodeRef root_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 800, false);
YGNodeInsertChild(root, root_child1, 1);
- const YGNodeRef root_child1_child0 =
+ YGNodeRef root_child1_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 300, false);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
- const YGNodeRef root_child1_child1 =
+ YGNodeRef root_child1_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 400, false);
- root_child1_child1->setBaselineFunc(_baselineFunc);
+ YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc);
YGNodeSetIsReferenceBaseline(root_child1_child1, true);
YGNodeInsertChild(root_child1, root_child1_child1, 1);
@@ -231,24 +223,23 @@ TEST(
align_baseline_parent_using_child_with_padding_in_column_as_reference) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root =
- createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
+ YGNodeRef root = createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
- const YGNodeRef root_child0 =
+ YGNodeRef root_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 600, false);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 =
+ YGNodeRef root_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 800, false);
YGNodeInsertChild(root, root_child1, 1);
- const YGNodeRef root_child1_child0 =
+ YGNodeRef root_child1_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 300, false);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
- const YGNodeRef root_child1_child1 =
+ YGNodeRef root_child1_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 400, false);
- root_child1_child1->setBaselineFunc(_baselineFunc);
+ YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc);
YGNodeSetIsReferenceBaseline(root_child1_child1, true);
YGNodeStyleSetPadding(root_child1_child1, YGEdgeLeft, 100);
YGNodeStyleSetPadding(root_child1_child1, YGEdgeRight, 100);
@@ -280,14 +271,13 @@ TEST(
align_baseline_parent_with_padding_using_child_in_column_as_reference) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root =
- createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
+ YGNodeRef root = createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
- const YGNodeRef root_child0 =
+ YGNodeRef root_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 600, false);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 =
+ YGNodeRef root_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 800, false);
YGNodeStyleSetPadding(root_child1, YGEdgeLeft, 100);
YGNodeStyleSetPadding(root_child1, YGEdgeRight, 100);
@@ -295,13 +285,13 @@ TEST(
YGNodeStyleSetPadding(root_child1, YGEdgeBottom, 100);
YGNodeInsertChild(root, root_child1, 1);
- const YGNodeRef root_child1_child0 =
+ YGNodeRef root_child1_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 300, false);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
- const YGNodeRef root_child1_child1 =
+ YGNodeRef root_child1_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 400, false);
- root_child1_child1->setBaselineFunc(_baselineFunc);
+ YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc);
YGNodeSetIsReferenceBaseline(root_child1_child1, true);
YGNodeInsertChild(root_child1, root_child1_child1, 1);
@@ -329,14 +319,13 @@ TEST(
align_baseline_parent_with_margin_using_child_in_column_as_reference) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root =
- createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
+ YGNodeRef root = createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
- const YGNodeRef root_child0 =
+ YGNodeRef root_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 600, false);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 =
+ YGNodeRef root_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 800, false);
YGNodeStyleSetMargin(root_child1, YGEdgeLeft, 100);
YGNodeStyleSetMargin(root_child1, YGEdgeRight, 100);
@@ -344,13 +333,13 @@ TEST(
YGNodeStyleSetMargin(root_child1, YGEdgeBottom, 100);
YGNodeInsertChild(root, root_child1, 1);
- const YGNodeRef root_child1_child0 =
+ YGNodeRef root_child1_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 300, false);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
- const YGNodeRef root_child1_child1 =
+ YGNodeRef root_child1_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 400, false);
- root_child1_child1->setBaselineFunc(_baselineFunc);
+ YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc);
YGNodeSetIsReferenceBaseline(root_child1_child1, true);
YGNodeInsertChild(root_child1, root_child1_child1, 1);
@@ -378,24 +367,23 @@ TEST(
align_baseline_parent_using_child_with_margin_in_column_as_reference) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root =
- createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
+ YGNodeRef root = createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
- const YGNodeRef root_child0 =
+ YGNodeRef root_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 600, false);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 =
+ YGNodeRef root_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 800, false);
YGNodeInsertChild(root, root_child1, 1);
- const YGNodeRef root_child1_child0 =
+ YGNodeRef root_child1_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 300, false);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
- const YGNodeRef root_child1_child1 =
+ YGNodeRef root_child1_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 400, false);
- root_child1_child1->setBaselineFunc(_baselineFunc);
+ YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc);
YGNodeSetIsReferenceBaseline(root_child1_child1, true);
YGNodeStyleSetMargin(root_child1_child1, YGEdgeLeft, 100);
YGNodeStyleSetMargin(root_child1_child1, YGEdgeRight, 100);
@@ -425,24 +413,23 @@ TEST(
TEST(YogaTest, align_baseline_parent_using_child_in_row_as_reference) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root =
- createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
+ YGNodeRef root = createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
- const YGNodeRef root_child0 =
+ YGNodeRef root_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 600, false);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 =
+ YGNodeRef root_child1 =
createYGNode(config, YGFlexDirectionRow, 500, 800, true);
YGNodeInsertChild(root, root_child1, 1);
- const YGNodeRef root_child1_child0 =
+ YGNodeRef root_child1_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 500, false);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
- const YGNodeRef root_child1_child1 =
+ YGNodeRef root_child1_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 400, false);
- root_child1_child1->setBaselineFunc(_baselineFunc);
+ YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc);
YGNodeSetIsReferenceBaseline(root_child1_child1, true);
YGNodeInsertChild(root_child1, root_child1_child1, 1);
@@ -470,24 +457,23 @@ TEST(
align_baseline_parent_using_child_with_padding_in_row_as_reference) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root =
- createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
+ YGNodeRef root = createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
- const YGNodeRef root_child0 =
+ YGNodeRef root_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 600, false);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 =
+ YGNodeRef root_child1 =
createYGNode(config, YGFlexDirectionRow, 500, 800, true);
YGNodeInsertChild(root, root_child1, 1);
- const YGNodeRef root_child1_child0 =
+ YGNodeRef root_child1_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 500, false);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
- const YGNodeRef root_child1_child1 =
+ YGNodeRef root_child1_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 400, false);
- root_child1_child1->setBaselineFunc(_baselineFunc);
+ YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc);
YGNodeSetIsReferenceBaseline(root_child1_child1, true);
YGNodeStyleSetPadding(root_child1_child1, YGEdgeLeft, 100);
YGNodeStyleSetPadding(root_child1_child1, YGEdgeRight, 100);
@@ -519,24 +505,23 @@ TEST(
align_baseline_parent_using_child_with_margin_in_row_as_reference) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root =
- createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
+ YGNodeRef root = createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
- const YGNodeRef root_child0 =
+ YGNodeRef root_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 600, false);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 =
+ YGNodeRef root_child1 =
createYGNode(config, YGFlexDirectionRow, 500, 800, true);
YGNodeInsertChild(root, root_child1, 1);
- const YGNodeRef root_child1_child0 =
+ YGNodeRef root_child1_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 500, false);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
- const YGNodeRef root_child1_child1 =
+ YGNodeRef root_child1_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 400, false);
- root_child1_child1->setBaselineFunc(_baselineFunc);
+ YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc);
YGNodeSetIsReferenceBaseline(root_child1_child1, true);
YGNodeStyleSetMargin(root_child1_child1, YGEdgeLeft, 100);
YGNodeStyleSetMargin(root_child1_child1, YGEdgeRight, 100);
@@ -568,22 +553,21 @@ TEST(
align_baseline_parent_using_child_in_column_as_reference_with_no_baseline_func) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root =
- createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
+ YGNodeRef root = createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
- const YGNodeRef root_child0 =
+ YGNodeRef root_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 600, false);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 =
+ YGNodeRef root_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 800, false);
YGNodeInsertChild(root, root_child1, 1);
- const YGNodeRef root_child1_child0 =
+ YGNodeRef root_child1_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 300, false);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
- const YGNodeRef root_child1_child1 =
+ YGNodeRef root_child1_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 400, false);
YGNodeSetIsReferenceBaseline(root_child1_child1, true);
YGNodeInsertChild(root_child1, root_child1_child1, 1);
@@ -612,22 +596,21 @@ TEST(
align_baseline_parent_using_child_in_row_as_reference_with_no_baseline_func) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root =
- createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
+ YGNodeRef root = createYGNode(config, YGFlexDirectionRow, 1000, 1000, true);
- const YGNodeRef root_child0 =
+ YGNodeRef root_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 600, false);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 =
+ YGNodeRef root_child1 =
createYGNode(config, YGFlexDirectionRow, 500, 800, true);
YGNodeInsertChild(root, root_child1, 1);
- const YGNodeRef root_child1_child0 =
+ YGNodeRef root_child1_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 500, false);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
- const YGNodeRef root_child1_child1 =
+ YGNodeRef root_child1_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 400, false);
YGNodeSetIsReferenceBaseline(root_child1_child1, true);
YGNodeInsertChild(root_child1, root_child1_child1, 1);
@@ -656,27 +639,27 @@ TEST(
align_baseline_parent_using_child_in_column_as_reference_with_height_not_specified) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignItems(root, YGAlignBaseline);
YGNodeStyleSetWidth(root, 1000);
- const YGNodeRef root_child0 =
+ YGNodeRef root_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 600, false);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root_child1, YGFlexDirectionColumn);
YGNodeStyleSetWidth(root_child1, 500);
YGNodeInsertChild(root, root_child1, 1);
- const YGNodeRef root_child1_child0 =
+ YGNodeRef root_child1_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 300, false);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
- const YGNodeRef root_child1_child1 =
+ YGNodeRef root_child1_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 400, false);
- root_child1_child1->setBaselineFunc(_baselineFunc);
+ YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc);
YGNodeSetIsReferenceBaseline(root_child1_child1, true);
YGNodeInsertChild(root_child1, root_child1_child1, 1);
@@ -707,27 +690,27 @@ TEST(
align_baseline_parent_using_child_in_row_as_reference_with_height_not_specified) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignItems(root, YGAlignBaseline);
YGNodeStyleSetWidth(root, 1000);
- const YGNodeRef root_child0 =
+ YGNodeRef root_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 600, false);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root_child1, YGFlexDirectionRow);
YGNodeStyleSetWidth(root_child1, 500);
YGNodeInsertChild(root, root_child1, 1);
- const YGNodeRef root_child1_child0 =
+ YGNodeRef root_child1_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 500, false);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
- const YGNodeRef root_child1_child1 =
+ YGNodeRef root_child1_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 400, false);
- root_child1_child1->setBaselineFunc(_baselineFunc);
+ YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc);
YGNodeSetIsReferenceBaseline(root_child1_child1, true);
YGNodeInsertChild(root_child1, root_child1_child1, 1);
@@ -758,25 +741,25 @@ TEST(
align_baseline_parent_using_child_in_column_as_reference_with_no_baseline_func_and_height_not_specified) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignItems(root, YGAlignBaseline);
YGNodeStyleSetWidth(root, 1000);
- const YGNodeRef root_child0 =
+ YGNodeRef root_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 600, false);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root_child1, YGFlexDirectionColumn);
YGNodeStyleSetWidth(root_child1, 500);
YGNodeInsertChild(root, root_child1, 1);
- const YGNodeRef root_child1_child0 =
+ YGNodeRef root_child1_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 300, false);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
- const YGNodeRef root_child1_child1 =
+ YGNodeRef root_child1_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 400, false);
YGNodeSetIsReferenceBaseline(root_child1_child1, true);
YGNodeInsertChild(root_child1, root_child1_child1, 1);
@@ -808,25 +791,25 @@ TEST(
align_baseline_parent_using_child_in_row_as_reference_with_no_baseline_func_and_height_not_specified) {
YGConfigRef config = YGConfigNew();
- const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignItems(root, YGAlignBaseline);
YGNodeStyleSetWidth(root, 1000);
- const YGNodeRef root_child0 =
+ YGNodeRef root_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 600, false);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root_child1, YGFlexDirectionRow);
YGNodeStyleSetWidth(root_child1, 500);
YGNodeInsertChild(root, root_child1, 1);
- const YGNodeRef root_child1_child0 =
+ YGNodeRef root_child1_child0 =
createYGNode(config, YGFlexDirectionColumn, 500, 500, false);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
- const YGNodeRef root_child1_child1 =
+ YGNodeRef root_child1_child1 =
createYGNode(config, YGFlexDirectionColumn, 500, 400, false);
YGNodeSetIsReferenceBaseline(root_child1_child1, true);
YGNodeInsertChild(root_child1, root_child1_child1, 1);
diff --git a/tests/YGAlignContentTest.cpp b/tests/YGAlignContentTest.cpp
deleted file mode 100644
index 1bb3dce5ba..0000000000
--- a/tests/YGAlignContentTest.cpp
+++ /dev/null
@@ -1,1878 +0,0 @@
-/*
- * Copyright (c) Facebook, Inc. and its 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
-
-#include
-#include
-
-TEST(YogaTest, align_content_flex_start) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 130);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeStyleSetHeight(root_child0, 10);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 10);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeStyleSetHeight(root_child2, 10);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeStyleSetHeight(root_child3, 10);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeStyleSetHeight(root_child4, 10);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(130, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(130, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_flex_start_without_height_on_children) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 10);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeStyleSetHeight(root_child3, 10);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_flex_start_with_flex) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 120);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexGrow(root_child0, 1);
- YGNodeStyleSetFlexBasisPercent(root_child0, 0);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexGrow(root_child1, 1);
- YGNodeStyleSetFlexBasisPercent(root_child1, 0);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 10);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexGrow(root_child3, 1);
- YGNodeStyleSetFlexShrink(root_child3, 1);
- YGNodeStyleSetFlexBasisPercent(root_child3, 0);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(120, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(120, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(120, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(120, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_flex_end) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetAlignContent(root, YGAlignFlexEnd);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeStyleSetHeight(root_child0, 10);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 10);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeStyleSetHeight(root_child2, 10);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeStyleSetHeight(root_child3, 10);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeStyleSetHeight(root_child4, 10);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_stretch) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetAlignContent(root, YGAlignStretch);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 150);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_spacebetween) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(root, YGAlignSpaceBetween);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 130);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeStyleSetHeight(root_child0, 10);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 10);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeStyleSetHeight(root_child2, 10);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeStyleSetHeight(root_child3, 10);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeStyleSetHeight(root_child4, 10);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(130, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(130, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_spacearound) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(root, YGAlignSpaceAround);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 140);
- YGNodeStyleSetHeight(root, 120);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeStyleSetHeight(root_child0, 10);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 10);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeStyleSetHeight(root_child2, 10);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeStyleSetHeight(root_child3, 10);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeStyleSetHeight(root_child4, 10);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(140, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(120, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(15, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(15, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(55, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(55, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(95, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(140, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(120, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(15, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(15, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(55, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(55, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(95, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_stretch_row) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(root, YGAlignStretch);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 150);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_stretch_row_with_children) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(root, YGAlignStretch);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 150);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexGrow(root_child0_child0, 1);
- YGNodeStyleSetFlexShrink(root_child0_child0, 1);
- YGNodeStyleSetFlexBasisPercent(root_child0_child0, 0);
- YGNodeInsertChild(root_child0, root_child0_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_stretch_row_with_flex) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(root, YGAlignStretch);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 150);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexGrow(root_child1, 1);
- YGNodeStyleSetFlexShrink(root_child1, 1);
- YGNodeStyleSetFlexBasisPercent(root_child1, 0);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexGrow(root_child3, 1);
- YGNodeStyleSetFlexShrink(root_child3, 1);
- YGNodeStyleSetFlexBasisPercent(root_child3, 0);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_stretch_row_with_flex_no_shrink) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(root, YGAlignStretch);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 150);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexGrow(root_child1, 1);
- YGNodeStyleSetFlexShrink(root_child1, 1);
- YGNodeStyleSetFlexBasisPercent(root_child1, 0);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexGrow(root_child3, 1);
- YGNodeStyleSetFlexBasisPercent(root_child3, 0);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_stretch_row_with_margin) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(root, YGAlignStretch);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 150);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetMargin(root_child1, YGEdgeLeft, 10);
- YGNodeStyleSetMargin(root_child1, YGEdgeTop, 10);
- YGNodeStyleSetMargin(root_child1, YGEdgeRight, 10);
- YGNodeStyleSetMargin(root_child1, YGEdgeBottom, 10);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetMargin(root_child3, YGEdgeLeft, 10);
- YGNodeStyleSetMargin(root_child3, YGEdgeTop, 10);
- YGNodeStyleSetMargin(root_child3, YGEdgeRight, 10);
- YGNodeStyleSetMargin(root_child3, YGEdgeBottom, 10);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_stretch_row_with_padding) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(root, YGAlignStretch);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 150);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetPadding(root_child1, YGEdgeLeft, 10);
- YGNodeStyleSetPadding(root_child1, YGEdgeTop, 10);
- YGNodeStyleSetPadding(root_child1, YGEdgeRight, 10);
- YGNodeStyleSetPadding(root_child1, YGEdgeBottom, 10);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetPadding(root_child3, YGEdgeLeft, 10);
- YGNodeStyleSetPadding(root_child3, YGEdgeTop, 10);
- YGNodeStyleSetPadding(root_child3, YGEdgeRight, 10);
- YGNodeStyleSetPadding(root_child3, YGEdgeBottom, 10);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_stretch_row_with_single_row) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(root, YGAlignStretch);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 150);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeInsertChild(root, root_child1, 1);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_stretch_row_with_fixed_height) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(root, YGAlignStretch);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 150);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 60);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_stretch_row_with_max_height) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(root, YGAlignStretch);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 150);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetMaxHeight(root_child1, 20);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_stretch_row_with_min_height) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(root, YGAlignStretch);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 150);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetMinHeight(root_child1, 80);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetWidth(root_child4, 50);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_stretch_column) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetAlignContent(root, YGAlignStretch);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 150);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetHeight(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexGrow(root_child0_child0, 1);
- YGNodeStyleSetFlexShrink(root_child0_child0, 1);
- YGNodeStyleSetFlexBasisPercent(root_child0_child0, 0);
- YGNodeInsertChild(root_child0, root_child0_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexGrow(root_child1, 1);
- YGNodeStyleSetFlexShrink(root_child1, 1);
- YGNodeStyleSetFlexBasisPercent(root_child1, 0);
- YGNodeStyleSetHeight(root_child1, 50);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
- YGNodeStyleSetHeight(root_child2, 50);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
- YGNodeStyleSetHeight(root_child3, 50);
- YGNodeInsertChild(root, root_child3, 3);
-
- const YGNodeRef root_child4 = YGNodeNewWithConfig(config);
- YGNodeStyleSetHeight(root_child4, 50);
- YGNodeInsertChild(root, root_child4, 4);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child3));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
-
-TEST(YogaTest, align_content_stretch_is_not_overriding_align_items) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetAlignContent(root, YGAlignStretch);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(root_child0, YGAlignStretch);
- YGNodeStyleSetAlignItems(root_child0, YGAlignCenter);
- YGNodeStyleSetWidth(root_child0, 100);
- YGNodeStyleSetHeight(root_child0, 100);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetAlignContent(root_child0_child0, YGAlignStretch);
- YGNodeStyleSetWidth(root_child0_child0, 10);
- YGNodeStyleSetHeight(root_child0_child0, 10);
- YGNodeInsertChild(root_child0, root_child0_child0, 0);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
- ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child0_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0_child0));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child0));
- ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child0_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0_child0));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
diff --git a/tests/YGAndroidNewsFeed.cpp b/tests/YGAndroidNewsFeed.cpp
deleted file mode 100644
index bb4125df9d..0000000000
--- a/tests/YGAndroidNewsFeed.cpp
+++ /dev/null
@@ -1,444 +0,0 @@
-/*
- * Copyright (c) Facebook, Inc. and its 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
-
-#include
-#include
-
-TEST(YogaTest, android_news_feed) {
- const YGConfigRef config = YGConfigNew();
-
- const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetAlignContent(root, YGAlignStretch);
- YGNodeStyleSetWidth(root, 1080);
-
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetAlignContent(root_child0_child0, YGAlignStretch);
- YGNodeInsertChild(root_child0, root_child0_child0, 0);
-
- const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
- YGNodeStyleSetAlignContent(root_child0_child0_child0, YGAlignStretch);
- YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
-
- const YGNodeRef root_child0_child0_child0_child0 =
- YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(
- root_child0_child0_child0_child0, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(root_child0_child0_child0_child0, YGAlignStretch);
- YGNodeStyleSetAlignItems(root_child0_child0_child0_child0, YGAlignFlexStart);
- YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeStart, 36);
- YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeTop, 24);
- YGNodeInsertChild(
- root_child0_child0_child0, root_child0_child0_child0_child0, 0);
-
- const YGNodeRef root_child0_child0_child0_child0_child0 =
- YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(
- root_child0_child0_child0_child0_child0, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(
- root_child0_child0_child0_child0_child0, YGAlignStretch);
- YGNodeInsertChild(
- root_child0_child0_child0_child0,
- root_child0_child0_child0_child0_child0,
- 0);
-
- const YGNodeRef root_child0_child0_child0_child0_child0_child0 =
- YGNodeNewWithConfig(config);
- YGNodeStyleSetAlignContent(
- root_child0_child0_child0_child0_child0_child0, YGAlignStretch);
- YGNodeStyleSetWidth(root_child0_child0_child0_child0_child0_child0, 120);
- YGNodeStyleSetHeight(root_child0_child0_child0_child0_child0_child0, 120);
- YGNodeInsertChild(
- root_child0_child0_child0_child0_child0,
- root_child0_child0_child0_child0_child0_child0,
- 0);
-
- const YGNodeRef root_child0_child0_child0_child0_child1 =
- YGNodeNewWithConfig(config);
- YGNodeStyleSetAlignContent(
- root_child0_child0_child0_child0_child1, YGAlignStretch);
- YGNodeStyleSetFlexShrink(root_child0_child0_child0_child0_child1, 1);
- YGNodeStyleSetMargin(
- root_child0_child0_child0_child0_child1, YGEdgeRight, 36);
- YGNodeStyleSetPadding(
- root_child0_child0_child0_child0_child1, YGEdgeLeft, 36);
- YGNodeStyleSetPadding(root_child0_child0_child0_child0_child1, YGEdgeTop, 21);
- YGNodeStyleSetPadding(
- root_child0_child0_child0_child0_child1, YGEdgeRight, 36);
- YGNodeStyleSetPadding(
- root_child0_child0_child0_child0_child1, YGEdgeBottom, 18);
- YGNodeInsertChild(
- root_child0_child0_child0_child0,
- root_child0_child0_child0_child0_child1,
- 1);
-
- const YGNodeRef root_child0_child0_child0_child0_child1_child0 =
- YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(
- root_child0_child0_child0_child0_child1_child0, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(
- root_child0_child0_child0_child0_child1_child0, YGAlignStretch);
- YGNodeStyleSetFlexShrink(root_child0_child0_child0_child0_child1_child0, 1);
- YGNodeInsertChild(
- root_child0_child0_child0_child0_child1,
- root_child0_child0_child0_child0_child1_child0,
- 0);
-
- const YGNodeRef root_child0_child0_child0_child0_child1_child1 =
- YGNodeNewWithConfig(config);
- YGNodeStyleSetAlignContent(
- root_child0_child0_child0_child0_child1_child1, YGAlignStretch);
- YGNodeStyleSetFlexShrink(root_child0_child0_child0_child0_child1_child1, 1);
- YGNodeInsertChild(
- root_child0_child0_child0_child0_child1,
- root_child0_child0_child0_child0_child1_child1,
- 1);
-
- const YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config);
- YGNodeStyleSetAlignContent(root_child0_child0_child1, YGAlignStretch);
- YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1);
-
- const YGNodeRef root_child0_child0_child1_child0 =
- YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(
- root_child0_child0_child1_child0, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(root_child0_child0_child1_child0, YGAlignStretch);
- YGNodeStyleSetAlignItems(root_child0_child0_child1_child0, YGAlignFlexStart);
- YGNodeStyleSetMargin(root_child0_child0_child1_child0, YGEdgeStart, 174);
- YGNodeStyleSetMargin(root_child0_child0_child1_child0, YGEdgeTop, 24);
- YGNodeInsertChild(
- root_child0_child0_child1, root_child0_child0_child1_child0, 0);
-
- const YGNodeRef root_child0_child0_child1_child0_child0 =
- YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(
- root_child0_child0_child1_child0_child0, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(
- root_child0_child0_child1_child0_child0, YGAlignStretch);
- YGNodeInsertChild(
- root_child0_child0_child1_child0,
- root_child0_child0_child1_child0_child0,
- 0);
-
- const YGNodeRef root_child0_child0_child1_child0_child0_child0 =
- YGNodeNewWithConfig(config);
- YGNodeStyleSetAlignContent(
- root_child0_child0_child1_child0_child0_child0, YGAlignStretch);
- YGNodeStyleSetWidth(root_child0_child0_child1_child0_child0_child0, 72);
- YGNodeStyleSetHeight(root_child0_child0_child1_child0_child0_child0, 72);
- YGNodeInsertChild(
- root_child0_child0_child1_child0_child0,
- root_child0_child0_child1_child0_child0_child0,
- 0);
-
- const YGNodeRef root_child0_child0_child1_child0_child1 =
- YGNodeNewWithConfig(config);
- YGNodeStyleSetAlignContent(
- root_child0_child0_child1_child0_child1, YGAlignStretch);
- YGNodeStyleSetFlexShrink(root_child0_child0_child1_child0_child1, 1);
- YGNodeStyleSetMargin(
- root_child0_child0_child1_child0_child1, YGEdgeRight, 36);
- YGNodeStyleSetPadding(
- root_child0_child0_child1_child0_child1, YGEdgeLeft, 36);
- YGNodeStyleSetPadding(root_child0_child0_child1_child0_child1, YGEdgeTop, 21);
- YGNodeStyleSetPadding(
- root_child0_child0_child1_child0_child1, YGEdgeRight, 36);
- YGNodeStyleSetPadding(
- root_child0_child0_child1_child0_child1, YGEdgeBottom, 18);
- YGNodeInsertChild(
- root_child0_child0_child1_child0,
- root_child0_child0_child1_child0_child1,
- 1);
-
- const YGNodeRef root_child0_child0_child1_child0_child1_child0 =
- YGNodeNewWithConfig(config);
- YGNodeStyleSetFlexDirection(
- root_child0_child0_child1_child0_child1_child0, YGFlexDirectionRow);
- YGNodeStyleSetAlignContent(
- root_child0_child0_child1_child0_child1_child0, YGAlignStretch);
- YGNodeStyleSetFlexShrink(root_child0_child0_child1_child0_child1_child0, 1);
- YGNodeInsertChild(
- root_child0_child0_child1_child0_child1,
- root_child0_child0_child1_child0_child1_child0,
- 0);
-
- const YGNodeRef root_child0_child0_child1_child0_child1_child1 =
- YGNodeNewWithConfig(config);
- YGNodeStyleSetAlignContent(
- root_child0_child0_child1_child0_child1_child1, YGAlignStretch);
- YGNodeStyleSetFlexShrink(root_child0_child0_child1_child0_child1_child1, 1);
- YGNodeInsertChild(
- root_child0_child0_child1_child0_child1,
- root_child0_child0_child1_child0_child1_child1,
- 1);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(240, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(240, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
- ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0_child0));
- ASSERT_FLOAT_EQ(240, YGNodeLayoutGetHeight(root_child0_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
- ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0_child0_child0));
- ASSERT_FLOAT_EQ(144, YGNodeLayoutGetHeight(root_child0_child0_child0));
-
- ASSERT_FLOAT_EQ(36, YGNodeLayoutGetLeft(root_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(24, YGNodeLayoutGetTop(root_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(1044, YGNodeLayoutGetWidth(root_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(120, YGNodeLayoutGetHeight(root_child0_child0_child0_child0));
-
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 120, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 120, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child0));
-
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 120,
- YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 120,
- YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child0_child0));
-
- ASSERT_FLOAT_EQ(
- 120, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child1));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child1));
- ASSERT_FLOAT_EQ(
- 72, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child1));
- ASSERT_FLOAT_EQ(
- 39, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child1));
-
- ASSERT_FLOAT_EQ(
- 36, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child1_child0));
- ASSERT_FLOAT_EQ(
- 21, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child1_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child1_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child1_child0));
-
- ASSERT_FLOAT_EQ(
- 36, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child1_child1));
- ASSERT_FLOAT_EQ(
- 21, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child1_child1));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child1_child1));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child1_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1));
- ASSERT_FLOAT_EQ(144, YGNodeLayoutGetTop(root_child0_child0_child1));
- ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0_child0_child1));
- ASSERT_FLOAT_EQ(96, YGNodeLayoutGetHeight(root_child0_child0_child1));
-
- ASSERT_FLOAT_EQ(174, YGNodeLayoutGetLeft(root_child0_child0_child1_child0));
- ASSERT_FLOAT_EQ(24, YGNodeLayoutGetTop(root_child0_child0_child1_child0));
- ASSERT_FLOAT_EQ(906, YGNodeLayoutGetWidth(root_child0_child0_child1_child0));
- ASSERT_FLOAT_EQ(72, YGNodeLayoutGetHeight(root_child0_child0_child1_child0));
-
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child0));
- ASSERT_FLOAT_EQ(
- 72, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child0));
- ASSERT_FLOAT_EQ(
- 72, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child0));
-
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 72, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 72,
- YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child0_child0));
-
- ASSERT_FLOAT_EQ(
- 72, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child1));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child1));
- ASSERT_FLOAT_EQ(
- 72, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child1));
- ASSERT_FLOAT_EQ(
- 39, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child1));
-
- ASSERT_FLOAT_EQ(
- 36, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child1_child0));
- ASSERT_FLOAT_EQ(
- 21, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child1_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child1_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child1_child0));
-
- ASSERT_FLOAT_EQ(
- 36, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child1_child1));
- ASSERT_FLOAT_EQ(
- 21, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child1_child1));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child1_child1));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child1_child1));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(240, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(240, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
- ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0_child0));
- ASSERT_FLOAT_EQ(240, YGNodeLayoutGetHeight(root_child0_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
- ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0_child0_child0));
- ASSERT_FLOAT_EQ(144, YGNodeLayoutGetHeight(root_child0_child0_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(24, YGNodeLayoutGetTop(root_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(1044, YGNodeLayoutGetWidth(root_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(120, YGNodeLayoutGetHeight(root_child0_child0_child0_child0));
-
- ASSERT_FLOAT_EQ(
- 924, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 120, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 120, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child0));
-
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 120,
- YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 120,
- YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child0_child0));
-
- ASSERT_FLOAT_EQ(
- 816, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child1));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child1));
- ASSERT_FLOAT_EQ(
- 72, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child1));
- ASSERT_FLOAT_EQ(
- 39, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child1));
-
- ASSERT_FLOAT_EQ(
- 36, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child1_child0));
- ASSERT_FLOAT_EQ(
- 21, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child1_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child1_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child1_child0));
-
- ASSERT_FLOAT_EQ(
- 36, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child1_child1));
- ASSERT_FLOAT_EQ(
- 21, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child1_child1));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child1_child1));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child1_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1));
- ASSERT_FLOAT_EQ(144, YGNodeLayoutGetTop(root_child0_child0_child1));
- ASSERT_FLOAT_EQ(1080, YGNodeLayoutGetWidth(root_child0_child0_child1));
- ASSERT_FLOAT_EQ(96, YGNodeLayoutGetHeight(root_child0_child0_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1_child0));
- ASSERT_FLOAT_EQ(24, YGNodeLayoutGetTop(root_child0_child0_child1_child0));
- ASSERT_FLOAT_EQ(906, YGNodeLayoutGetWidth(root_child0_child0_child1_child0));
- ASSERT_FLOAT_EQ(72, YGNodeLayoutGetHeight(root_child0_child0_child1_child0));
-
- ASSERT_FLOAT_EQ(
- 834, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child0));
- ASSERT_FLOAT_EQ(
- 72, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child0));
- ASSERT_FLOAT_EQ(
- 72, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child0));
-
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 72, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child0_child0));
- ASSERT_FLOAT_EQ(
- 72,
- YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child0_child0));
-
- ASSERT_FLOAT_EQ(
- 726, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child1));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child1));
- ASSERT_FLOAT_EQ(
- 72, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child1));
- ASSERT_FLOAT_EQ(
- 39, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child1));
-
- ASSERT_FLOAT_EQ(
- 36, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child1_child0));
- ASSERT_FLOAT_EQ(
- 21, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child1_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child1_child0));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child1_child0));
-
- ASSERT_FLOAT_EQ(
- 36, YGNodeLayoutGetLeft(root_child0_child0_child1_child0_child1_child1));
- ASSERT_FLOAT_EQ(
- 21, YGNodeLayoutGetTop(root_child0_child0_child1_child0_child1_child1));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetWidth(root_child0_child0_child1_child0_child1_child1));
- ASSERT_FLOAT_EQ(
- 0, YGNodeLayoutGetHeight(root_child0_child0_child1_child0_child1_child1));
-
- YGNodeFreeRecursive(root);
-
- YGConfigFree(config);
-}
diff --git a/tests/YGAspectRatioTest.cpp b/tests/YGAspectRatioTest.cpp
index 7a81720e6c..28ecf3f65f 100644
--- a/tests/YGAspectRatioTest.cpp
+++ b/tests/YGAspectRatioTest.cpp
@@ -1,33 +1,32 @@
/*
- * Copyright (c) Facebook, Inc. and its affiliates.
+ * 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
-#include
#include
static YGSize _measure(
- YGNodeRef node,
- double width,
+ YGNodeConstRef /*node*/,
+ float width,
YGMeasureMode widthMode,
- double height,
+ float height,
YGMeasureMode heightMode) {
return YGSize{
- .width = widthMode == YGMeasureModeExactly ? width : 50,
- .height = heightMode == YGMeasureModeExactly ? height : 50,
+ widthMode == YGMeasureModeExactly ? width : 50,
+ heightMode == YGMeasureModeExactly ? height : 50,
};
}
TEST(YogaTest, aspect_ratio_cross_defined) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 50);
YGNodeStyleSetAspectRatio(root_child0, 1);
YGNodeInsertChild(root, root_child0, 0);
@@ -43,12 +42,12 @@ TEST(YogaTest, aspect_ratio_cross_defined) {
}
TEST(YogaTest, aspect_ratio_main_defined) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeight(root_child0, 50);
YGNodeStyleSetAspectRatio(root_child0, 1);
YGNodeInsertChild(root, root_child0, 0);
@@ -64,13 +63,13 @@ TEST(YogaTest, aspect_ratio_main_defined) {
}
TEST(YogaTest, aspect_ratio_both_dimensions_defined_row) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 100);
YGNodeStyleSetHeight(root_child0, 50);
YGNodeStyleSetAspectRatio(root_child0, 1);
@@ -87,12 +86,12 @@ TEST(YogaTest, aspect_ratio_both_dimensions_defined_row) {
}
TEST(YogaTest, aspect_ratio_both_dimensions_defined_column) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 100);
YGNodeStyleSetHeight(root_child0, 50);
YGNodeStyleSetAspectRatio(root_child0, 1);
@@ -109,11 +108,11 @@ TEST(YogaTest, aspect_ratio_both_dimensions_defined_column) {
}
TEST(YogaTest, aspect_ratio_align_stretch) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetAspectRatio(root_child0, 1);
YGNodeInsertChild(root, root_child0, 0);
@@ -128,12 +127,12 @@ TEST(YogaTest, aspect_ratio_align_stretch) {
}
TEST(YogaTest, aspect_ratio_flex_grow) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeight(root_child0, 50);
YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetAspectRatio(root_child0, 1);
@@ -150,12 +149,12 @@ TEST(YogaTest, aspect_ratio_flex_grow) {
}
TEST(YogaTest, aspect_ratio_flex_shrink) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeight(root_child0, 150);
YGNodeStyleSetFlexShrink(root_child0, 1);
YGNodeStyleSetAspectRatio(root_child0, 1);
@@ -172,17 +171,17 @@ TEST(YogaTest, aspect_ratio_flex_shrink) {
}
TEST(YogaTest, aspect_ratio_flex_shrink_2) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeightPercent(root_child0, 100);
YGNodeStyleSetFlexShrink(root_child0, 1);
YGNodeStyleSetAspectRatio(root_child0, 1);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 = YGNodeNew();
+ YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetHeightPercent(root_child1, 100);
YGNodeStyleSetFlexShrink(root_child1, 1);
YGNodeStyleSetAspectRatio(root_child1, 1);
@@ -204,12 +203,12 @@ TEST(YogaTest, aspect_ratio_flex_shrink_2) {
}
TEST(YogaTest, aspect_ratio_basis) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexBasis(root_child0, 50);
YGNodeStyleSetAspectRatio(root_child0, 1);
YGNodeInsertChild(root, root_child0, 0);
@@ -225,11 +224,11 @@ TEST(YogaTest, aspect_ratio_basis) {
}
TEST(YogaTest, aspect_ratio_absolute_layout_width_defined) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
YGNodeStyleSetPosition(root_child0, YGEdgeLeft, 0);
YGNodeStyleSetPosition(root_child0, YGEdgeTop, 0);
@@ -248,11 +247,11 @@ TEST(YogaTest, aspect_ratio_absolute_layout_width_defined) {
}
TEST(YogaTest, aspect_ratio_absolute_layout_height_defined) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
YGNodeStyleSetPosition(root_child0, YGEdgeLeft, 0);
YGNodeStyleSetPosition(root_child0, YGEdgeTop, 0);
@@ -271,12 +270,12 @@ TEST(YogaTest, aspect_ratio_absolute_layout_height_defined) {
}
TEST(YogaTest, aspect_ratio_with_max_cross_defined) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeight(root_child0, 50);
YGNodeStyleSetMaxWidth(root_child0, 40);
YGNodeStyleSetAspectRatio(root_child0, 1);
@@ -293,12 +292,12 @@ TEST(YogaTest, aspect_ratio_with_max_cross_defined) {
}
TEST(YogaTest, aspect_ratio_with_max_main_defined) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 50);
YGNodeStyleSetMaxHeight(root_child0, 40);
YGNodeStyleSetAspectRatio(root_child0, 1);
@@ -315,12 +314,12 @@ TEST(YogaTest, aspect_ratio_with_max_main_defined) {
}
TEST(YogaTest, aspect_ratio_with_min_cross_defined) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeight(root_child0, 30);
YGNodeStyleSetMinWidth(root_child0, 40);
YGNodeStyleSetAspectRatio(root_child0, 1);
@@ -337,12 +336,12 @@ TEST(YogaTest, aspect_ratio_with_min_cross_defined) {
}
TEST(YogaTest, aspect_ratio_with_min_main_defined) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 30);
YGNodeStyleSetMinHeight(root_child0, 40);
YGNodeStyleSetAspectRatio(root_child0, 1);
@@ -359,12 +358,12 @@ TEST(YogaTest, aspect_ratio_with_min_main_defined) {
}
TEST(YogaTest, aspect_ratio_double_cross) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeight(root_child0, 50);
YGNodeStyleSetAspectRatio(root_child0, 2);
YGNodeInsertChild(root, root_child0, 0);
@@ -380,12 +379,12 @@ TEST(YogaTest, aspect_ratio_double_cross) {
}
TEST(YogaTest, aspect_ratio_half_cross) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeight(root_child0, 100);
YGNodeStyleSetAspectRatio(root_child0, 0.5);
YGNodeInsertChild(root, root_child0, 0);
@@ -401,12 +400,12 @@ TEST(YogaTest, aspect_ratio_half_cross) {
}
TEST(YogaTest, aspect_ratio_double_main) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 50);
YGNodeStyleSetAspectRatio(root_child0, 0.5);
YGNodeInsertChild(root, root_child0, 0);
@@ -422,12 +421,12 @@ TEST(YogaTest, aspect_ratio_double_main) {
}
TEST(YogaTest, aspect_ratio_half_main) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 100);
YGNodeStyleSetAspectRatio(root_child0, 2);
YGNodeInsertChild(root, root_child0, 0);
@@ -443,13 +442,13 @@ TEST(YogaTest, aspect_ratio_half_main) {
}
TEST(YogaTest, aspect_ratio_with_measure_func) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
- root_child0->setMeasureFunc(_measure);
+ YGNodeRef root_child0 = YGNodeNew();
+ YGNodeSetMeasureFunc(root_child0, _measure);
YGNodeStyleSetAspectRatio(root_child0, 1);
YGNodeInsertChild(root, root_child0, 0);
@@ -464,13 +463,13 @@ TEST(YogaTest, aspect_ratio_with_measure_func) {
}
TEST(YogaTest, aspect_ratio_width_height_flex_grow_row) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 200);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 50);
YGNodeStyleSetHeight(root_child0, 50);
YGNodeStyleSetFlexGrow(root_child0, 1);
@@ -488,12 +487,12 @@ TEST(YogaTest, aspect_ratio_width_height_flex_grow_row) {
}
TEST(YogaTest, aspect_ratio_width_height_flex_grow_column) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 200);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 50);
YGNodeStyleSetHeight(root_child0, 50);
YGNodeStyleSetFlexGrow(root_child0, 1);
@@ -511,19 +510,19 @@ TEST(YogaTest, aspect_ratio_width_height_flex_grow_column) {
}
TEST(YogaTest, aspect_ratio_height_as_flex_basis) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidth(root, 200);
YGNodeStyleSetHeight(root, 200);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeight(root_child0, 50);
YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetAspectRatio(root_child0, 1);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 = YGNodeNew();
+ YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetHeight(root_child1, 100);
YGNodeStyleSetFlexGrow(root_child1, 1);
YGNodeStyleSetAspectRatio(root_child1, 1);
@@ -545,18 +544,18 @@ TEST(YogaTest, aspect_ratio_height_as_flex_basis) {
}
TEST(YogaTest, aspect_ratio_width_as_flex_basis) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 200);
YGNodeStyleSetHeight(root, 200);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 50);
YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetAspectRatio(root_child0, 1);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 = YGNodeNew();
+ YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidth(root_child1, 100);
YGNodeStyleSetFlexGrow(root_child1, 1);
YGNodeStyleSetAspectRatio(root_child1, 1);
@@ -578,13 +577,13 @@ TEST(YogaTest, aspect_ratio_width_as_flex_basis) {
}
TEST(YogaTest, aspect_ratio_overrides_flex_grow_row) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 50);
YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetAspectRatio(root_child0, 0.5);
@@ -601,12 +600,12 @@ TEST(YogaTest, aspect_ratio_overrides_flex_grow_row) {
}
TEST(YogaTest, aspect_ratio_overrides_flex_grow_column) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeight(root_child0, 50);
YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeStyleSetAspectRatio(root_child0, 2);
@@ -623,11 +622,11 @@ TEST(YogaTest, aspect_ratio_overrides_flex_grow_column) {
}
TEST(YogaTest, aspect_ratio_left_right_absolute) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
YGNodeStyleSetPosition(root_child0, YGEdgeLeft, 10);
YGNodeStyleSetPosition(root_child0, YGEdgeTop, 10);
@@ -646,11 +645,11 @@ TEST(YogaTest, aspect_ratio_left_right_absolute) {
}
TEST(YogaTest, aspect_ratio_top_bottom_absolute) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
YGNodeStyleSetPosition(root_child0, YGEdgeLeft, 10);
YGNodeStyleSetPosition(root_child0, YGEdgeTop, 10);
@@ -669,12 +668,12 @@ TEST(YogaTest, aspect_ratio_top_bottom_absolute) {
}
TEST(YogaTest, aspect_ratio_width_overrides_align_stretch_row) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 50);
YGNodeStyleSetAspectRatio(root_child0, 1);
YGNodeInsertChild(root, root_child0, 0);
@@ -690,11 +689,11 @@ TEST(YogaTest, aspect_ratio_width_overrides_align_stretch_row) {
}
TEST(YogaTest, aspect_ratio_height_overrides_align_stretch_column) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeight(root_child0, 50);
YGNodeStyleSetAspectRatio(root_child0, 1);
YGNodeInsertChild(root, root_child0, 0);
@@ -710,11 +709,11 @@ TEST(YogaTest, aspect_ratio_height_overrides_align_stretch_column) {
}
TEST(YogaTest, aspect_ratio_allow_child_overflow_parent_size) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetWidth(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeight(root_child0, 50);
YGNodeStyleSetAspectRatio(root_child0, 4);
YGNodeInsertChild(root, root_child0, 0);
@@ -731,13 +730,13 @@ TEST(YogaTest, aspect_ratio_allow_child_overflow_parent_size) {
}
TEST(YogaTest, aspect_ratio_defined_main_with_margin) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignCenter);
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetHeight(root_child0, 50);
YGNodeStyleSetAspectRatio(root_child0, 1);
YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 10);
@@ -756,13 +755,13 @@ TEST(YogaTest, aspect_ratio_defined_main_with_margin) {
}
TEST(YogaTest, aspect_ratio_defined_cross_with_margin) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignCenter);
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 50);
YGNodeStyleSetAspectRatio(root_child0, 1);
YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 10);
@@ -781,13 +780,13 @@ TEST(YogaTest, aspect_ratio_defined_cross_with_margin) {
}
TEST(YogaTest, aspect_ratio_defined_cross_with_main_margin) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetAlignItems(root, YGAlignCenter);
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 50);
YGNodeStyleSetAspectRatio(root_child0, 1);
YGNodeStyleSetMargin(root_child0, YGEdgeTop, 10);
@@ -806,17 +805,17 @@ TEST(YogaTest, aspect_ratio_defined_cross_with_main_margin) {
}
TEST(YogaTest, aspect_ratio_should_prefer_explicit_height) {
- const YGConfigRef config = YGConfigNew();
+ YGConfigRef config = YGConfigNew();
YGConfigSetUseWebDefaults(config, true);
- const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumn);
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionColumn);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionColumn);
YGNodeStyleSetHeight(root_child0_child0, 100);
YGNodeStyleSetAspectRatio(root_child0_child0, 2);
@@ -837,17 +836,17 @@ TEST(YogaTest, aspect_ratio_should_prefer_explicit_height) {
}
TEST(YogaTest, aspect_ratio_should_prefer_explicit_width) {
- const YGConfigRef config = YGConfigNew();
+ YGConfigRef config = YGConfigNew();
YGConfigSetUseWebDefaults(config, true);
- const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow);
YGNodeStyleSetWidth(root_child0_child0, 100);
YGNodeStyleSetAspectRatio(root_child0_child0, 0.5);
@@ -868,18 +867,18 @@ TEST(YogaTest, aspect_ratio_should_prefer_explicit_width) {
}
TEST(YogaTest, aspect_ratio_should_prefer_flexed_dimension) {
- const YGConfigRef config = YGConfigNew();
+ YGConfigRef config = YGConfigNew();
YGConfigSetUseWebDefaults(config, true);
- const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeRef root = YGNodeNewWithConfig(config);
- const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionColumn);
YGNodeStyleSetAspectRatio(root_child0, 2);
YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetAspectRatio(root_child0_child0, 4);
YGNodeStyleSetFlexGrow(root_child0_child0, 1);
YGNodeInsertChild(root_child0, root_child0_child0, 0);
diff --git a/tests/YGBaselineFuncTest.cpp b/tests/YGBaselineFuncTest.cpp
index adfc07da8e..c2d9b08772 100644
--- a/tests/YGBaselineFuncTest.cpp
+++ b/tests/YGBaselineFuncTest.cpp
@@ -1,41 +1,41 @@
/*
- * Copyright (c) Facebook, Inc. and its affiliates.
+ * 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
-#include
#include
-static double _baseline(YGNodeRef node, const double width, const double height) {
- double* baseline = (double*) node->getContext();
+static float
+_baseline(YGNodeConstRef node, const float /*width*/, const float /*height*/) {
+ auto* baseline = (float*)YGNodeGetContext(node);
return *baseline;
}
TEST(YogaTest, align_baseline_customer_func) {
- const YGNodeRef root = YGNodeNew();
+ YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignItems(root, YGAlignBaseline);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
- const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 50);
YGNodeStyleSetHeight(root_child0, 50);
YGNodeInsertChild(root, root_child0, 0);
- const YGNodeRef root_child1 = YGNodeNew();
+ YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidth(root_child1, 50);
YGNodeStyleSetHeight(root_child1, 20);
YGNodeInsertChild(root, root_child1, 1);
- double baselineValue = 10;
- const YGNodeRef root_child1_child0 = YGNodeNew();
- root_child1_child0->setContext(&baselineValue);
+ float baselineValue = 10;
+ YGNodeRef root_child1_child0 = YGNodeNew();
+ YGNodeSetContext(root_child1_child0, &baselineValue);
YGNodeStyleSetWidth(root_child1_child0, 50);
- root_child1_child0->setBaselineFunc(_baseline);
+ YGNodeSetBaselineFunc(root_child1_child0, _baseline);
YGNodeStyleSetHeight(root_child1_child0, 20);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
diff --git a/tests/YGCloneNodeTest.cpp b/tests/YGCloneNodeTest.cpp
new file mode 100644
index 0000000000..d029fbe027
--- /dev/null
+++ b/tests/YGCloneNodeTest.cpp
@@ -0,0 +1,89 @@
+/*
+ * 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
+#include