From fd180de774824b9b639ddb7fb43d87e983a7c248 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Thu, 29 Sep 2022 22:25:24 -0700 Subject: [PATCH] Fix Generation of Tests from Fixtures Summary: https://github.com/facebook/yoga/pull/1116 added a change to the test generator "gentests.rb" to support a newer version of chromedriver, along with a change to the enum generator (not touched in this diff) to produce code consistent with the current tests, which seem to have been manually edited since last generation. I had trouble running the test generator locally, because it relies on unversioned third-party dependencies, whose APIs change. Looking at source history, it seems like each time someone wants to run the script, they end up updating its syntax to match whatever versions they pull in. This change adds a Gemfile and lock so that that the version of "watir" is locked, and so that we will also automatically pull in a consistent "chomedriver" version via the "webdrivers" gem. It includes the updates from the PR to be consistent with already output tests, and I have also updated the copyright header generation to no longer create lint warnings on newly generated tests (some of the previous ones were fixed manually it looks like). The test generator would still produce bodies which would fail clang-format, and were manually edited (causing generation to emit new lint warnings), so I updated the generator to suppress clang-format in the body of the generated files. Three tests, around the interaction of minimum dimensions and flexible children produce different results in Chrome now compared to when the tests were added, so running `gentests.rb` creates tests which break UTs. This doesn't seem like any sort of rounding, or device specific difference, so I have disabled these tests for now. While digging around, it does look like Chrome periodically will fix bugs in its own layout implementation which cause differences, like https://bugs.chromium.org/p/chromium/issues/detail?id=927066 Reviewed By: rozele, Andrey-Mishanin Differential Revision: D39907416 fbshipit-source-id: f88714ff038b42f935901783452df25eabb6ebb1 --- README.md | 2 +- .../Facebook.Yoga/YGAbsolutePositionTest.cs | 9 +- .../tests/Facebook.Yoga/YGAlignContentTest.cs | 9 +- .../tests/Facebook.Yoga/YGAlignItemsTest.cs | 9 +- csharp/tests/Facebook.Yoga/YGAlignSelfTest.cs | 9 +- .../tests/Facebook.Yoga/YGAndroidNewsFeed.cs | 9 +- csharp/tests/Facebook.Yoga/YGBorderTest.cs | 9 +- csharp/tests/Facebook.Yoga/YGDimensionTest.cs | 9 +- csharp/tests/Facebook.Yoga/YGDisplayTest.cs | 2 +- .../Facebook.Yoga/YGFlexDirectionTest.cs | 9 +- csharp/tests/Facebook.Yoga/YGFlexTest.cs | 9 +- csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs | 9 +- .../Facebook.Yoga/YGJustifyContentTest.cs | 9 +- csharp/tests/Facebook.Yoga/YGMarginTest.cs | 9 +- .../Facebook.Yoga/YGMinMaxDimensionTest.cs | 118 +---- csharp/tests/Facebook.Yoga/YGPaddingTest.cs | 9 +- .../tests/Facebook.Yoga/YGPercentageTest.cs | 64 +-- csharp/tests/Facebook.Yoga/YGRoundingTest.cs | 9 +- .../tests/Facebook.Yoga/YGSizeOverflowTest.cs | 9 +- gentest/Gemfile | 4 + gentest/Gemfile.lock | 35 ++ gentest/fixtures/YGMinMaxDimensionTest.html | 6 + gentest/fixtures/YGPercentageTest.html | 4 + gentest/gentest.js | 13 +- gentest/gentest.rb | 14 +- .../facebook/yoga/YGAbsolutePositionTest.java | 9 +- .../com/facebook/yoga/YGAlignContentTest.java | 9 +- .../com/facebook/yoga/YGAlignItemsTest.java | 9 +- .../com/facebook/yoga/YGAlignSelfTest.java | 9 +- .../com/facebook/yoga/YGAndroidNewsFeed.java | 9 +- .../tests/com/facebook/yoga/YGBorderTest.java | 9 +- .../com/facebook/yoga/YGDimensionTest.java | 9 +- .../com/facebook/yoga/YGDisplayTest.java | 2 +- .../facebook/yoga/YGFlexDirectionTest.java | 9 +- java/tests/com/facebook/yoga/YGFlexTest.java | 9 +- .../com/facebook/yoga/YGFlexWrapTest.java | 9 +- .../facebook/yoga/YGJustifyContentTest.java | 9 +- .../tests/com/facebook/yoga/YGMarginTest.java | 9 +- .../facebook/yoga/YGMinMaxDimensionTest.java | 116 +---- .../com/facebook/yoga/YGPaddingTest.java | 9 +- .../com/facebook/yoga/YGPercentageTest.java | 63 +-- .../com/facebook/yoga/YGRoundingTest.java | 9 +- .../com/facebook/yoga/YGSizeOverflowTest.java | 9 +- .../Facebook.Yoga/YGAbsolutePositionTest.js | 7 +- .../tests/Facebook.Yoga/YGAlignContentTest.js | 7 +- .../tests/Facebook.Yoga/YGAlignItemsTest.js | 7 +- .../tests/Facebook.Yoga/YGAlignSelfTest.js | 7 +- .../tests/Facebook.Yoga/YGAndroidNewsFeed.js | 7 +- .../tests/Facebook.Yoga/YGBorderTest.js | 7 +- .../tests/Facebook.Yoga/YGDimensionTest.js | 7 +- .../tests/Facebook.Yoga/YGDisplayTest.js | 2 +- .../Facebook.Yoga/YGFlexDirectionTest.js | 7 +- javascript/tests/Facebook.Yoga/YGFlexTest.js | 7 +- .../tests/Facebook.Yoga/YGFlexWrapTest.js | 7 +- .../Facebook.Yoga/YGJustifyContentTest.js | 7 +- .../tests/Facebook.Yoga/YGMarginTest.js | 7 +- .../Facebook.Yoga/YGMinMaxDimensionTest.js | 122 +---- .../tests/Facebook.Yoga/YGPaddingTest.js | 7 +- .../tests/Facebook.Yoga/YGPercentageTest.js | 65 +-- .../tests/Facebook.Yoga/YGRoundingTest.js | 7 +- .../tests/Facebook.Yoga/YGSizeOverflowTest.js | 7 +- tests/YGAbsolutePositionTest.cpp | 31 +- tests/YGAlignContentTest.cpp | 11 +- tests/YGAlignItemsTest.cpp | 8 +- tests/YGAlignSelfTest.cpp | 8 +- tests/YGAndroidNewsFeed.cpp | 418 ++++++------------ tests/YGBorderTest.cpp | 8 +- tests/YGDimensionTest.cpp | 8 +- tests/YGDisplayTest.cpp | 3 +- tests/YGFlexDirectionTest.cpp | 11 +- tests/YGFlexTest.cpp | 126 +----- tests/YGFlexWrapTest.cpp | 8 +- tests/YGJustifyContentTest.cpp | 19 +- tests/YGMarginTest.cpp | 8 +- tests/YGMinMaxDimensionTest.cpp | 199 +-------- tests/YGPaddingTest.cpp | 8 +- tests/YGPercentageTest.cpp | 145 +----- tests/YGRoundingTest.cpp | 8 +- tests/YGSizeOverflowTest.cpp | 11 +- website/contents/contributing/testing.md | 10 +- 80 files changed, 540 insertions(+), 1515 deletions(-) create mode 100644 gentest/Gemfile create mode 100644 gentest/Gemfile.lock diff --git a/README.md b/README.md index 23c26c3b..e8d41231 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Instead of manually writing a test which ensures parity with web implementations 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. -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. +You should run `bundle install` in the `gentest` directory to install dependencies for the `gentest/gentest.rb` Ruby script. ### .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`. diff --git a/csharp/tests/Facebook.Yoga/YGAbsolutePositionTest.cs b/csharp/tests/Facebook.Yoga/YGAbsolutePositionTest.cs index bf5da18e..9b83ca9e 100644 --- a/csharp/tests/Facebook.Yoga/YGAbsolutePositionTest.cs +++ b/csharp/tests/Facebook.Yoga/YGAbsolutePositionTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html using System; diff --git a/csharp/tests/Facebook.Yoga/YGAlignContentTest.cs b/csharp/tests/Facebook.Yoga/YGAlignContentTest.cs index dda26398..383ac3f4 100644 --- a/csharp/tests/Facebook.Yoga/YGAlignContentTest.cs +++ b/csharp/tests/Facebook.Yoga/YGAlignContentTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html using System; diff --git a/csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs b/csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs index 3042b36b..ea1732dd 100644 --- a/csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs +++ b/csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html using System; diff --git a/csharp/tests/Facebook.Yoga/YGAlignSelfTest.cs b/csharp/tests/Facebook.Yoga/YGAlignSelfTest.cs index 0826fab6..88095a39 100644 --- a/csharp/tests/Facebook.Yoga/YGAlignSelfTest.cs +++ b/csharp/tests/Facebook.Yoga/YGAlignSelfTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html using System; diff --git a/csharp/tests/Facebook.Yoga/YGAndroidNewsFeed.cs b/csharp/tests/Facebook.Yoga/YGAndroidNewsFeed.cs index a55ca044..b3d97bf1 100644 --- a/csharp/tests/Facebook.Yoga/YGAndroidNewsFeed.cs +++ b/csharp/tests/Facebook.Yoga/YGAndroidNewsFeed.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGAndroidNewsFeed.html using System; diff --git a/csharp/tests/Facebook.Yoga/YGBorderTest.cs b/csharp/tests/Facebook.Yoga/YGBorderTest.cs index 2c091537..170ce686 100644 --- a/csharp/tests/Facebook.Yoga/YGBorderTest.cs +++ b/csharp/tests/Facebook.Yoga/YGBorderTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html using System; diff --git a/csharp/tests/Facebook.Yoga/YGDimensionTest.cs b/csharp/tests/Facebook.Yoga/YGDimensionTest.cs index 214cc712..bfc7df0d 100644 --- a/csharp/tests/Facebook.Yoga/YGDimensionTest.cs +++ b/csharp/tests/Facebook.Yoga/YGDimensionTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html using System; diff --git a/csharp/tests/Facebook.Yoga/YGDisplayTest.cs b/csharp/tests/Facebook.Yoga/YGDisplayTest.cs index 659cb37f..422d53e3 100644 --- a/csharp/tests/Facebook.Yoga/YGDisplayTest.cs +++ b/csharp/tests/Facebook.Yoga/YGDisplayTest.cs @@ -1,5 +1,5 @@ /* - * 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. diff --git a/csharp/tests/Facebook.Yoga/YGFlexDirectionTest.cs b/csharp/tests/Facebook.Yoga/YGFlexDirectionTest.cs index cf9b310a..125beba0 100644 --- a/csharp/tests/Facebook.Yoga/YGFlexDirectionTest.cs +++ b/csharp/tests/Facebook.Yoga/YGFlexDirectionTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html using System; diff --git a/csharp/tests/Facebook.Yoga/YGFlexTest.cs b/csharp/tests/Facebook.Yoga/YGFlexTest.cs index 5fc5410e..77819a8d 100644 --- a/csharp/tests/Facebook.Yoga/YGFlexTest.cs +++ b/csharp/tests/Facebook.Yoga/YGFlexTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html using System; diff --git a/csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs b/csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs index 5e3189d6..9fd72627 100644 --- a/csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs +++ b/csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexWrapTest.html using System; diff --git a/csharp/tests/Facebook.Yoga/YGJustifyContentTest.cs b/csharp/tests/Facebook.Yoga/YGJustifyContentTest.cs index 6f6a48b5..a73e9d34 100644 --- a/csharp/tests/Facebook.Yoga/YGJustifyContentTest.cs +++ b/csharp/tests/Facebook.Yoga/YGJustifyContentTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html using System; diff --git a/csharp/tests/Facebook.Yoga/YGMarginTest.cs b/csharp/tests/Facebook.Yoga/YGMarginTest.cs index 9a62a0a3..dbf28bd7 100644 --- a/csharp/tests/Facebook.Yoga/YGMarginTest.cs +++ b/csharp/tests/Facebook.Yoga/YGMarginTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html using System; diff --git a/csharp/tests/Facebook.Yoga/YGMinMaxDimensionTest.cs b/csharp/tests/Facebook.Yoga/YGMinMaxDimensionTest.cs index 0d9c78c2..044aa14e 100644 --- a/csharp/tests/Facebook.Yoga/YGMinMaxDimensionTest.cs +++ b/csharp/tests/Facebook.Yoga/YGMinMaxDimensionTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html using System; @@ -95,115 +96,6 @@ namespace Facebook.Yoga Assert.AreEqual(50f, root_child0.LayoutHeight); } - [Test] - public void Test_min_height() - { - YogaConfig config = new YogaConfig(); - - YogaNode root = new YogaNode(config); - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MinHeight = 60; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(80f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(100f, root_child0.LayoutWidth); - Assert.AreEqual(80f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(80f, root_child1.LayoutY); - Assert.AreEqual(100f, root_child1.LayoutWidth); - Assert.AreEqual(20f, root_child1.LayoutHeight); - } - - [Test] - public void Test_min_width() - { - YogaConfig config = new YogaConfig(); - - YogaNode root = new YogaNode(config); - root.FlexDirection = YogaFlexDirection.Row; - root.Width = 100; - root.Height = 100; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MinWidth = 60; - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 1; - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(80f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(80f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(100f, root.LayoutWidth); - Assert.AreEqual(100f, root.LayoutHeight); - - Assert.AreEqual(20f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(80f, root_child0.LayoutWidth); - Assert.AreEqual(100f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(0f, root_child1.LayoutY); - Assert.AreEqual(20f, root_child1.LayoutWidth); - Assert.AreEqual(100f, root_child1.LayoutHeight); - } - [Test] public void Test_justify_content_min_max() { diff --git a/csharp/tests/Facebook.Yoga/YGPaddingTest.cs b/csharp/tests/Facebook.Yoga/YGPaddingTest.cs index 9b6533cd..6a1cbfb7 100644 --- a/csharp/tests/Facebook.Yoga/YGPaddingTest.cs +++ b/csharp/tests/Facebook.Yoga/YGPaddingTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html using System; diff --git a/csharp/tests/Facebook.Yoga/YGPercentageTest.cs b/csharp/tests/Facebook.Yoga/YGPercentageTest.cs index 237186db..4a066902 100644 --- a/csharp/tests/Facebook.Yoga/YGPercentageTest.cs +++ b/csharp/tests/Facebook.Yoga/YGPercentageTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html using System; @@ -252,61 +253,6 @@ namespace Facebook.Yoga Assert.AreEqual(75f, root_child1.LayoutHeight); } - [Test] - public void Test_percentage_flex_basis_cross_min_height() - { - YogaConfig config = new YogaConfig(); - - YogaNode root = new YogaNode(config); - root.Width = 200; - root.Height = 200; - - YogaNode root_child0 = new YogaNode(config); - root_child0.FlexGrow = 1; - root_child0.MinHeight = 60.Percent(); - root.Insert(0, root_child0); - - YogaNode root_child1 = new YogaNode(config); - root_child1.FlexGrow = 2; - root_child1.MinHeight = 10.Percent(); - root.Insert(1, root_child1); - root.StyleDirection = YogaDirection.LTR; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(140f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(140f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(60f, root_child1.LayoutHeight); - - root.StyleDirection = YogaDirection.RTL; - root.CalculateLayout(); - - Assert.AreEqual(0f, root.LayoutX); - Assert.AreEqual(0f, root.LayoutY); - Assert.AreEqual(200f, root.LayoutWidth); - Assert.AreEqual(200f, root.LayoutHeight); - - Assert.AreEqual(0f, root_child0.LayoutX); - Assert.AreEqual(0f, root_child0.LayoutY); - Assert.AreEqual(200f, root_child0.LayoutWidth); - Assert.AreEqual(140f, root_child0.LayoutHeight); - - Assert.AreEqual(0f, root_child1.LayoutX); - Assert.AreEqual(140f, root_child1.LayoutY); - Assert.AreEqual(200f, root_child1.LayoutWidth); - Assert.AreEqual(60f, root_child1.LayoutHeight); - } - [Test] public void Test_percentage_flex_basis_main_max_height() { diff --git a/csharp/tests/Facebook.Yoga/YGRoundingTest.cs b/csharp/tests/Facebook.Yoga/YGRoundingTest.cs index 471d8ea4..cbf3d590 100644 --- a/csharp/tests/Facebook.Yoga/YGRoundingTest.cs +++ b/csharp/tests/Facebook.Yoga/YGRoundingTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html using System; diff --git a/csharp/tests/Facebook.Yoga/YGSizeOverflowTest.cs b/csharp/tests/Facebook.Yoga/YGSizeOverflowTest.cs index 1f9fae01..dadeb8f1 100644 --- a/csharp/tests/Facebook.Yoga/YGSizeOverflowTest.cs +++ b/csharp/tests/Facebook.Yoga/YGSizeOverflowTest.cs @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGSizeOverflowTest.html using System; diff --git a/gentest/Gemfile b/gentest/Gemfile new file mode 100644 index 00000000..8b3b5ba2 --- /dev/null +++ b/gentest/Gemfile @@ -0,0 +1,4 @@ +source "https://rubygems.org" + +gem 'watir', '~>6.19.0' +gem 'webdrivers', '~> 5.1.0' diff --git a/gentest/Gemfile.lock b/gentest/Gemfile.lock new file mode 100644 index 00000000..a1f1f5c5 --- /dev/null +++ b/gentest/Gemfile.lock @@ -0,0 +1,35 @@ +GEM + remote: https://rubygems.org/ + specs: + childprocess (4.1.0) + mini_portile2 (2.8.0) + nokogiri (1.13.8) + mini_portile2 (~> 2.8.0) + racc (~> 1.4) + racc (1.6.0) + regexp_parser (2.6.0) + rexml (3.2.5) + rubyzip (2.3.2) + selenium-webdriver (4.5.0) + childprocess (>= 0.5, < 5.0) + rexml (~> 3.2, >= 3.2.5) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) + watir (6.19.1) + regexp_parser (>= 1.2, < 3) + selenium-webdriver (>= 3.142.7) + webdrivers (5.1.0) + nokogiri (~> 1.6) + rubyzip (>= 1.3.0) + selenium-webdriver (~> 4.0) + websocket (1.2.9) + +PLATFORMS + ruby + +DEPENDENCIES + watir (~> 6.19.0) + webdrivers (~> 5.1.0) + +BUNDLED WITH + 2.1.4 diff --git a/gentest/fixtures/YGMinMaxDimensionTest.html b/gentest/fixtures/YGMinMaxDimensionTest.html index 69e29b90..f083d908 100644 --- a/gentest/fixtures/YGMinMaxDimensionTest.html +++ b/gentest/fixtures/YGMinMaxDimensionTest.html @@ -6,15 +6,21 @@
+ + + +
diff --git a/gentest/fixtures/YGPercentageTest.html b/gentest/fixtures/YGPercentageTest.html index fa722198..98f36604 100644 --- a/gentest/fixtures/YGPercentageTest.html +++ b/gentest/fixtures/YGPercentageTest.html @@ -20,10 +20,14 @@
+ + +
diff --git a/gentest/gentest.js b/gentest/gentest.js index 12e76f33..b2fef03e 100755 --- a/gentest/gentest.js +++ b/gentest/gentest.js @@ -1,5 +1,5 @@ /** - * 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. @@ -10,24 +10,28 @@ window.onload = function() { printTest( new CPPEmitter(), + 'cpp', document.body.children[0], document.body.children[1], document.body.children[2]); printTest( new JavaEmitter(), + 'java', document.body.children[0], document.body.children[1], document.body.children[2]); printTest( new CSEmitter(), + 'cs', document.body.children[0], document.body.children[1], document.body.children[2]); printTest( new JavascriptEmitter(), + 'js', document.body.children[0], document.body.children[1], document.body.children[2]); @@ -39,14 +43,15 @@ function assert(condition, message) { } } -function printTest(e, LTRContainer, RTLContainer, genericContainer) { +function printTest(e, ext, LTRContainer, RTLContainer, genericContainer) { e.push([ - '/*', - ' * Copyright (c) Facebook, Inc. and its affiliates.', + ext === 'js' ? '/**' : '/*', + ' * 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.', ' */', + ext === 'cpp' ? '\n// clang-format off' : '', '// @Generated by gentest/gentest.rb from gentest/fixtures/' + document.title + '.html', '', ]); diff --git a/gentest/gentest.rb b/gentest/gentest.rb index 01fec93e..54481ac3 100644 --- a/gentest/gentest.rb +++ b/gentest/gentest.rb @@ -1,20 +1,20 @@ #!/usr/bin/env ruby -# 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. require 'watir' +require 'webdrivers' require 'fileutils' -browser = Watir::Browser.new(:chrome, "goog:loggingPrefs" => { +browser = Watir::Browser.new(:chrome, options: { + "goog:loggingPrefs" => { "browser" => "ALL", "performance" => "ALL" }, - "chromeOptions" => { - "w3c" => "false" - }, - :switches => ['--force-device-scale-factor=1', '--window-position=0,0']) + args: ['--force-device-scale-factor=1', '--window-position=0,0'] +}) Dir.chdir(File.dirname($0)) @@ -40,7 +40,7 @@ Dir['fixtures/*.html'].each do |file| FileUtils.copy('test.html', "#{name}.html") if $DEBUG browser.goto('file://' + Dir.pwd + '/test.html') - logs = browser.driver.manage.logs.get(:browser) + logs = browser.driver.logs.get(:browser) f = File.open("../tests/#{name}.cpp", 'w') f.write eval(logs[0].message.sub(/^[^"]*/, '')) diff --git a/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java b/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java index 7652c919..17e32546 100644 --- a/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java +++ b/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGAlignContentTest.java b/java/tests/com/facebook/yoga/YGAlignContentTest.java index 9403ec28..135145a8 100644 --- a/java/tests/com/facebook/yoga/YGAlignContentTest.java +++ b/java/tests/com/facebook/yoga/YGAlignContentTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * 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 package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGAlignItemsTest.java b/java/tests/com/facebook/yoga/YGAlignItemsTest.java index 1db0a78f..e1e3e703 100644 --- a/java/tests/com/facebook/yoga/YGAlignItemsTest.java +++ b/java/tests/com/facebook/yoga/YGAlignItemsTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGAlignSelfTest.java b/java/tests/com/facebook/yoga/YGAlignSelfTest.java index a35f07a4..f3a76d99 100644 --- a/java/tests/com/facebook/yoga/YGAlignSelfTest.java +++ b/java/tests/com/facebook/yoga/YGAlignSelfTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGAndroidNewsFeed.java b/java/tests/com/facebook/yoga/YGAndroidNewsFeed.java index 1b4fde74..f7c0f52d 100644 --- a/java/tests/com/facebook/yoga/YGAndroidNewsFeed.java +++ b/java/tests/com/facebook/yoga/YGAndroidNewsFeed.java @@ -1,9 +1,10 @@ -/** - * 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. + * 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 package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGBorderTest.java b/java/tests/com/facebook/yoga/YGBorderTest.java index 5ecddc11..2f292f7c 100644 --- a/java/tests/com/facebook/yoga/YGBorderTest.java +++ b/java/tests/com/facebook/yoga/YGBorderTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGDimensionTest.java b/java/tests/com/facebook/yoga/YGDimensionTest.java index 3c9b9aa9..7a8659e5 100644 --- a/java/tests/com/facebook/yoga/YGDimensionTest.java +++ b/java/tests/com/facebook/yoga/YGDimensionTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGDisplayTest.java b/java/tests/com/facebook/yoga/YGDisplayTest.java index 999548bd..511327f7 100644 --- a/java/tests/com/facebook/yoga/YGDisplayTest.java +++ b/java/tests/com/facebook/yoga/YGDisplayTest.java @@ -1,5 +1,5 @@ /* - * 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. diff --git a/java/tests/com/facebook/yoga/YGFlexDirectionTest.java b/java/tests/com/facebook/yoga/YGFlexDirectionTest.java index ee014a02..ae24e4ee 100644 --- a/java/tests/com/facebook/yoga/YGFlexDirectionTest.java +++ b/java/tests/com/facebook/yoga/YGFlexDirectionTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGFlexTest.java b/java/tests/com/facebook/yoga/YGFlexTest.java index a85c5217..bdd68588 100644 --- a/java/tests/com/facebook/yoga/YGFlexTest.java +++ b/java/tests/com/facebook/yoga/YGFlexTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGFlexWrapTest.java b/java/tests/com/facebook/yoga/YGFlexWrapTest.java index c853642d..8cbfdc3e 100644 --- a/java/tests/com/facebook/yoga/YGFlexWrapTest.java +++ b/java/tests/com/facebook/yoga/YGFlexWrapTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexWrapTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGJustifyContentTest.java b/java/tests/com/facebook/yoga/YGJustifyContentTest.java index 4a1d96b8..3b67e371 100644 --- a/java/tests/com/facebook/yoga/YGJustifyContentTest.java +++ b/java/tests/com/facebook/yoga/YGJustifyContentTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGMarginTest.java b/java/tests/com/facebook/yoga/YGMarginTest.java index b922b084..6508042c 100644 --- a/java/tests/com/facebook/yoga/YGMarginTest.java +++ b/java/tests/com/facebook/yoga/YGMarginTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGMinMaxDimensionTest.java b/java/tests/com/facebook/yoga/YGMinMaxDimensionTest.java index 8280189c..850e1790 100644 --- a/java/tests/com/facebook/yoga/YGMinMaxDimensionTest.java +++ b/java/tests/com/facebook/yoga/YGMinMaxDimensionTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html package com.facebook.yoga; @@ -102,113 +103,6 @@ public class YGMinMaxDimensionTest { assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); } - @Test - public void test_min_height() { - YogaConfig config = YogaConfigFactory.create(); - - final YogaNode root = createNode(config); - root.setWidth(100f); - root.setHeight(100f); - - final YogaNode root_child0 = createNode(config); - root_child0.setFlexGrow(1f); - root_child0.setMinHeight(60f); - root.addChildAt(root_child0, 0); - - final YogaNode root_child1 = createNode(config); - root_child1.setFlexGrow(1f); - root.addChildAt(root_child1, 1); - root.setDirection(YogaDirection.LTR); - root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); - - assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(100f, root.getLayoutWidth(), 0.0f); - assertEquals(100f, root.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child0.getLayoutX(), 0.0f); - assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); - assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child1.getLayoutX(), 0.0f); - assertEquals(80f, root_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); - assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); - - root.setDirection(YogaDirection.RTL); - root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); - - assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(100f, root.getLayoutWidth(), 0.0f); - assertEquals(100f, root.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child0.getLayoutX(), 0.0f); - assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); - assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child1.getLayoutX(), 0.0f); - assertEquals(80f, root_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); - assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); - } - - @Test - public void test_min_width() { - YogaConfig config = YogaConfigFactory.create(); - - final YogaNode root = createNode(config); - root.setFlexDirection(YogaFlexDirection.ROW); - root.setWidth(100f); - root.setHeight(100f); - - final YogaNode root_child0 = createNode(config); - root_child0.setFlexGrow(1f); - root_child0.setMinWidth(60f); - root.addChildAt(root_child0, 0); - - final YogaNode root_child1 = createNode(config); - root_child1.setFlexGrow(1f); - root.addChildAt(root_child1, 1); - root.setDirection(YogaDirection.LTR); - root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); - - assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(100f, root.getLayoutWidth(), 0.0f); - assertEquals(100f, root.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child0.getLayoutX(), 0.0f); - assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(80f, root_child0.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); - - assertEquals(80f, root_child1.getLayoutX(), 0.0f); - assertEquals(0f, root_child1.getLayoutY(), 0.0f); - assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); - - root.setDirection(YogaDirection.RTL); - root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); - - assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(100f, root.getLayoutWidth(), 0.0f); - assertEquals(100f, root.getLayoutHeight(), 0.0f); - - assertEquals(20f, root_child0.getLayoutX(), 0.0f); - assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(80f, root_child0.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child1.getLayoutX(), 0.0f); - assertEquals(0f, root_child1.getLayoutY(), 0.0f); - assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); - } - @Test public void test_justify_content_min_max() { YogaConfig config = YogaConfigFactory.create(); diff --git a/java/tests/com/facebook/yoga/YGPaddingTest.java b/java/tests/com/facebook/yoga/YGPaddingTest.java index 978ab1c6..a1a09454 100644 --- a/java/tests/com/facebook/yoga/YGPaddingTest.java +++ b/java/tests/com/facebook/yoga/YGPaddingTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGPercentageTest.java b/java/tests/com/facebook/yoga/YGPercentageTest.java index 33f793ae..77629585 100644 --- a/java/tests/com/facebook/yoga/YGPercentageTest.java +++ b/java/tests/com/facebook/yoga/YGPercentageTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html package com.facebook.yoga; @@ -256,60 +257,6 @@ public class YGPercentageTest { assertEquals(75f, root_child1.getLayoutHeight(), 0.0f); } - @Test - public void test_percentage_flex_basis_cross_min_height() { - YogaConfig config = YogaConfigFactory.create(); - - final YogaNode root = createNode(config); - root.setWidth(200f); - root.setHeight(200f); - - final YogaNode root_child0 = createNode(config); - root_child0.setFlexGrow(1f); - root_child0.setMinHeightPercent(60f); - root.addChildAt(root_child0, 0); - - final YogaNode root_child1 = createNode(config); - root_child1.setFlexGrow(2f); - root_child1.setMinHeightPercent(10f); - root.addChildAt(root_child1, 1); - root.setDirection(YogaDirection.LTR); - root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); - - assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(200f, root.getLayoutWidth(), 0.0f); - assertEquals(200f, root.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child0.getLayoutX(), 0.0f); - assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); - assertEquals(140f, root_child0.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child1.getLayoutX(), 0.0f); - assertEquals(140f, root_child1.getLayoutY(), 0.0f); - assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); - assertEquals(60f, root_child1.getLayoutHeight(), 0.0f); - - root.setDirection(YogaDirection.RTL); - root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); - - assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(200f, root.getLayoutWidth(), 0.0f); - assertEquals(200f, root.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child0.getLayoutX(), 0.0f); - assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); - assertEquals(140f, root_child0.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child1.getLayoutX(), 0.0f); - assertEquals(140f, root_child1.getLayoutY(), 0.0f); - assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); - assertEquals(60f, root_child1.getLayoutHeight(), 0.0f); - } - @Test public void test_percentage_flex_basis_main_max_height() { YogaConfig config = YogaConfigFactory.create(); diff --git a/java/tests/com/facebook/yoga/YGRoundingTest.java b/java/tests/com/facebook/yoga/YGRoundingTest.java index f6752290..8c043d21 100644 --- a/java/tests/com/facebook/yoga/YGRoundingTest.java +++ b/java/tests/com/facebook/yoga/YGRoundingTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGSizeOverflowTest.java b/java/tests/com/facebook/yoga/YGSizeOverflowTest.java index e76e9cbf..4bdd36d0 100644 --- a/java/tests/com/facebook/yoga/YGSizeOverflowTest.java +++ b/java/tests/com/facebook/yoga/YGSizeOverflowTest.java @@ -1,9 +1,10 @@ -/** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGSizeOverflowTest.html package com.facebook.yoga; diff --git a/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js b/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js index 0677769f..212b5beb 100644 --- a/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js +++ b/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js @@ -1,9 +1,10 @@ /** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); diff --git a/javascript/tests/Facebook.Yoga/YGAlignContentTest.js b/javascript/tests/Facebook.Yoga/YGAlignContentTest.js index 1ff0eca8..047a9150 100644 --- a/javascript/tests/Facebook.Yoga/YGAlignContentTest.js +++ b/javascript/tests/Facebook.Yoga/YGAlignContentTest.js @@ -1,9 +1,10 @@ /** - * 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. + * 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 var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); diff --git a/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js b/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js index b5b16681..0ca20825 100644 --- a/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js +++ b/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js @@ -1,9 +1,10 @@ /** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); diff --git a/javascript/tests/Facebook.Yoga/YGAlignSelfTest.js b/javascript/tests/Facebook.Yoga/YGAlignSelfTest.js index 7aab341f..94eef4b5 100644 --- a/javascript/tests/Facebook.Yoga/YGAlignSelfTest.js +++ b/javascript/tests/Facebook.Yoga/YGAlignSelfTest.js @@ -1,9 +1,10 @@ /** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); diff --git a/javascript/tests/Facebook.Yoga/YGAndroidNewsFeed.js b/javascript/tests/Facebook.Yoga/YGAndroidNewsFeed.js index 96e7ec04..e26bcadc 100644 --- a/javascript/tests/Facebook.Yoga/YGAndroidNewsFeed.js +++ b/javascript/tests/Facebook.Yoga/YGAndroidNewsFeed.js @@ -1,9 +1,10 @@ /** - * 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. + * 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 var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); diff --git a/javascript/tests/Facebook.Yoga/YGBorderTest.js b/javascript/tests/Facebook.Yoga/YGBorderTest.js index 16f33c29..62a2d53c 100644 --- a/javascript/tests/Facebook.Yoga/YGBorderTest.js +++ b/javascript/tests/Facebook.Yoga/YGBorderTest.js @@ -1,9 +1,10 @@ /** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); diff --git a/javascript/tests/Facebook.Yoga/YGDimensionTest.js b/javascript/tests/Facebook.Yoga/YGDimensionTest.js index ac3937da..733479fa 100644 --- a/javascript/tests/Facebook.Yoga/YGDimensionTest.js +++ b/javascript/tests/Facebook.Yoga/YGDimensionTest.js @@ -1,9 +1,10 @@ /** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); diff --git a/javascript/tests/Facebook.Yoga/YGDisplayTest.js b/javascript/tests/Facebook.Yoga/YGDisplayTest.js index cf65ab22..34949a4c 100644 --- a/javascript/tests/Facebook.Yoga/YGDisplayTest.js +++ b/javascript/tests/Facebook.Yoga/YGDisplayTest.js @@ -1,5 +1,5 @@ /** - * 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. diff --git a/javascript/tests/Facebook.Yoga/YGFlexDirectionTest.js b/javascript/tests/Facebook.Yoga/YGFlexDirectionTest.js index fe68a6ad..7fa91364 100644 --- a/javascript/tests/Facebook.Yoga/YGFlexDirectionTest.js +++ b/javascript/tests/Facebook.Yoga/YGFlexDirectionTest.js @@ -1,9 +1,10 @@ /** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); diff --git a/javascript/tests/Facebook.Yoga/YGFlexTest.js b/javascript/tests/Facebook.Yoga/YGFlexTest.js index 3515e46f..08adf542 100644 --- a/javascript/tests/Facebook.Yoga/YGFlexTest.js +++ b/javascript/tests/Facebook.Yoga/YGFlexTest.js @@ -1,9 +1,10 @@ /** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); diff --git a/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js b/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js index 8ea08d21..cc2a4d05 100644 --- a/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js +++ b/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js @@ -1,9 +1,10 @@ /** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexWrapTest.html var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); diff --git a/javascript/tests/Facebook.Yoga/YGJustifyContentTest.js b/javascript/tests/Facebook.Yoga/YGJustifyContentTest.js index 83652004..f5297982 100644 --- a/javascript/tests/Facebook.Yoga/YGJustifyContentTest.js +++ b/javascript/tests/Facebook.Yoga/YGJustifyContentTest.js @@ -1,9 +1,10 @@ /** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); diff --git a/javascript/tests/Facebook.Yoga/YGMarginTest.js b/javascript/tests/Facebook.Yoga/YGMarginTest.js index 81f36432..2ccd37d6 100644 --- a/javascript/tests/Facebook.Yoga/YGMarginTest.js +++ b/javascript/tests/Facebook.Yoga/YGMarginTest.js @@ -1,9 +1,10 @@ /** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); diff --git a/javascript/tests/Facebook.Yoga/YGMinMaxDimensionTest.js b/javascript/tests/Facebook.Yoga/YGMinMaxDimensionTest.js index c52ea6e9..95883fba 100644 --- a/javascript/tests/Facebook.Yoga/YGMinMaxDimensionTest.js +++ b/javascript/tests/Facebook.Yoga/YGMinMaxDimensionTest.js @@ -1,9 +1,10 @@ /** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); @@ -95,121 +96,6 @@ it("max_height", function () { config.free(); } }); -it("min_height", function () { - var config = Yoga.Config.create(); - - try { - var root = Yoga.Node.create(config); - root.setWidth(100); - root.setHeight(100); - - var root_child0 = Yoga.Node.create(config); - root_child0.setFlexGrow(1); - root_child0.setMinHeight(60); - root.insertChild(root_child0, 0); - - var root_child1 = Yoga.Node.create(config); - root_child1.setFlexGrow(1); - root.insertChild(root_child1, 1); - root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); - - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); - - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(80 === root_child1.getComputedTop(), "80 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); - - root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); - - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); - - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(80 === root_child1.getComputedTop(), "80 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); - } finally { - if (typeof root !== "undefined") { - root.freeRecursive(); - } - - config.free(); - } -}); -it("min_width", function () { - var config = Yoga.Config.create(); - - try { - var root = Yoga.Node.create(config); - root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); - root.setWidth(100); - root.setHeight(100); - - var root_child0 = Yoga.Node.create(config); - root_child0.setFlexGrow(1); - root_child0.setMinWidth(60); - root.insertChild(root_child0, 0); - - var root_child1 = Yoga.Node.create(config); - root_child1.setFlexGrow(1); - root.insertChild(root_child1, 1); - root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); - - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); - - console.assert(80 === root_child1.getComputedLeft(), "80 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); - - root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); - - console.assert(20 === root_child0.getComputedLeft(), "20 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); - - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); - } finally { - if (typeof root !== "undefined") { - root.freeRecursive(); - } - - config.free(); - } -}); it("justify_content_min_max", function () { var config = Yoga.Config.create(); diff --git a/javascript/tests/Facebook.Yoga/YGPaddingTest.js b/javascript/tests/Facebook.Yoga/YGPaddingTest.js index a9f0b458..0cb7bc88 100644 --- a/javascript/tests/Facebook.Yoga/YGPaddingTest.js +++ b/javascript/tests/Facebook.Yoga/YGPaddingTest.js @@ -1,9 +1,10 @@ /** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); diff --git a/javascript/tests/Facebook.Yoga/YGPercentageTest.js b/javascript/tests/Facebook.Yoga/YGPercentageTest.js index 5ee49bcc..c211b3a7 100644 --- a/javascript/tests/Facebook.Yoga/YGPercentageTest.js +++ b/javascript/tests/Facebook.Yoga/YGPercentageTest.js @@ -1,9 +1,10 @@ /** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); @@ -261,64 +262,6 @@ it("percentage_flex_basis_cross", function () { config.free(); } }); -it("percentage_flex_basis_cross_min_height", function () { - var config = Yoga.Config.create(); - - try { - var root = Yoga.Node.create(config); - root.setWidth(200); - root.setHeight(200); - - var root_child0 = Yoga.Node.create(config); - root_child0.setFlexGrow(1); - root_child0.setMinHeight("60%"); - root.insertChild(root_child0, 0); - - var root_child1 = Yoga.Node.create(config); - root_child1.setFlexGrow(2); - root_child1.setMinHeight("10%"); - root.insertChild(root_child1, 1); - root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); - - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(140 === root_child0.getComputedHeight(), "140 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); - - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(140 === root_child1.getComputedTop(), "140 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(60 === root_child1.getComputedHeight(), "60 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); - - root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); - - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(140 === root_child0.getComputedHeight(), "140 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); - - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(140 === root_child1.getComputedTop(), "140 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(60 === root_child1.getComputedHeight(), "60 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); - } finally { - if (typeof root !== "undefined") { - root.freeRecursive(); - } - - config.free(); - } -}); it("percentage_flex_basis_main_max_height", function () { var config = Yoga.Config.create(); diff --git a/javascript/tests/Facebook.Yoga/YGRoundingTest.js b/javascript/tests/Facebook.Yoga/YGRoundingTest.js index 69caba7d..564faab6 100644 --- a/javascript/tests/Facebook.Yoga/YGRoundingTest.js +++ b/javascript/tests/Facebook.Yoga/YGRoundingTest.js @@ -1,9 +1,10 @@ /** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); diff --git a/javascript/tests/Facebook.Yoga/YGSizeOverflowTest.js b/javascript/tests/Facebook.Yoga/YGSizeOverflowTest.js index 7d94d200..b9751e33 100644 --- a/javascript/tests/Facebook.Yoga/YGSizeOverflowTest.js +++ b/javascript/tests/Facebook.Yoga/YGSizeOverflowTest.js @@ -1,9 +1,10 @@ /** - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + // @Generated by gentest/gentest.rb from gentest/fixtures/YGSizeOverflowTest.html var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); diff --git a/tests/YGAbsolutePositionTest.cpp b/tests/YGAbsolutePositionTest.cpp index eea56132..b7038918 100644 --- a/tests/YGAbsolutePositionTest.cpp +++ b/tests/YGAbsolutePositionTest.cpp @@ -1,11 +1,12 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ -// @Generated by gentest/gentest.rb from -// gentest/fixtures/YGAbsolutePositionTest.html + +// clang-format off +// @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html #include #include @@ -184,9 +185,7 @@ TEST(YogaTest, absolute_layout_width_height_start_top_end_bottom) { YGConfigFree(config); } -TEST( - YogaTest, - do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent) { +TEST(YogaTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent) { const YGConfigRef config = YGConfigNew(); const YGNodeRef root = YGNodeNewWithConfig(config); @@ -578,9 +577,7 @@ TEST(YogaTest, absolute_layout_align_items_center_on_child_only) { YGConfigFree(config); } -TEST( - YogaTest, - absolute_layout_align_items_and_justify_content_center_and_top_position) { +TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_top_position) { const YGConfigRef config = YGConfigNew(); const YGNodeRef root = YGNodeNewWithConfig(config); @@ -625,9 +622,7 @@ TEST( YGConfigFree(config); } -TEST( - YogaTest, - absolute_layout_align_items_and_justify_content_center_and_bottom_position) { +TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_bottom_position) { const YGConfigRef config = YGConfigNew(); const YGNodeRef root = YGNodeNewWithConfig(config); @@ -672,9 +667,7 @@ TEST( YGConfigFree(config); } -TEST( - YogaTest, - absolute_layout_align_items_and_justify_content_center_and_left_position) { +TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_left_position) { const YGConfigRef config = YGConfigNew(); const YGNodeRef root = YGNodeNewWithConfig(config); @@ -719,9 +712,7 @@ TEST( YGConfigFree(config); } -TEST( - YogaTest, - absolute_layout_align_items_and_justify_content_center_and_right_position) { +TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_right_position) { const YGConfigRef config = YGConfigNew(); const YGNodeRef root = YGNodeNewWithConfig(config); diff --git a/tests/YGAlignContentTest.cpp b/tests/YGAlignContentTest.cpp index 1bb3dce5..8e072f4a 100644 --- a/tests/YGAlignContentTest.cpp +++ b/tests/YGAlignContentTest.cpp @@ -1,11 +1,12 @@ /* - * 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. + * 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 + +// clang-format off +// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html #include #include diff --git a/tests/YGAlignItemsTest.cpp b/tests/YGAlignItemsTest.cpp index 2a581da8..30575f84 100644 --- a/tests/YGAlignItemsTest.cpp +++ b/tests/YGAlignItemsTest.cpp @@ -1,9 +1,11 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + +// clang-format off // @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html #include diff --git a/tests/YGAlignSelfTest.cpp b/tests/YGAlignSelfTest.cpp index afa3870a..40b35b1f 100644 --- a/tests/YGAlignSelfTest.cpp +++ b/tests/YGAlignSelfTest.cpp @@ -1,9 +1,11 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + +// clang-format off // @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html #include diff --git a/tests/YGAndroidNewsFeed.cpp b/tests/YGAndroidNewsFeed.cpp index bb4125df..0107b877 100644 --- a/tests/YGAndroidNewsFeed.cpp +++ b/tests/YGAndroidNewsFeed.cpp @@ -1,9 +1,11 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + +// clang-format off // @Generated by gentest/gentest.rb from gentest/fixtures/YGAndroidNewsFeed.html #include @@ -27,157 +29,89 @@ TEST(YogaTest, android_news_feed) { 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); + 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); + 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 = 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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 = 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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)); @@ -205,52 +139,30 @@ TEST(YogaTest, android_news_feed) { 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)); + 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(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(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_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(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)); @@ -262,51 +174,30 @@ TEST(YogaTest, android_news_feed) { 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)); + 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(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(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_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)); + 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); @@ -335,52 +226,30 @@ TEST(YogaTest, android_news_feed) { 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(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(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(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_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(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)); @@ -392,51 +261,30 @@ TEST(YogaTest, android_news_feed) { 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(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(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(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_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)); + 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); diff --git a/tests/YGBorderTest.cpp b/tests/YGBorderTest.cpp index 39318214..3bd0f2c9 100644 --- a/tests/YGBorderTest.cpp +++ b/tests/YGBorderTest.cpp @@ -1,9 +1,11 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + +// clang-format off // @Generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html #include diff --git a/tests/YGDimensionTest.cpp b/tests/YGDimensionTest.cpp index c4e50718..02ccb06c 100644 --- a/tests/YGDimensionTest.cpp +++ b/tests/YGDimensionTest.cpp @@ -1,9 +1,11 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + +// clang-format off // @Generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html #include diff --git a/tests/YGDisplayTest.cpp b/tests/YGDisplayTest.cpp index edc53358..e28d79a4 100644 --- a/tests/YGDisplayTest.cpp +++ b/tests/YGDisplayTest.cpp @@ -1,10 +1,11 @@ /* - * 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. */ +// clang-format off // @Generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html #include diff --git a/tests/YGFlexDirectionTest.cpp b/tests/YGFlexDirectionTest.cpp index 976ca82a..7eb4b81d 100644 --- a/tests/YGFlexDirectionTest.cpp +++ b/tests/YGFlexDirectionTest.cpp @@ -1,11 +1,12 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ -// @Generated by gentest/gentest.rb from -// gentest/fixtures/YGFlexDirectionTest.html + +// clang-format off +// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html #include #include diff --git a/tests/YGFlexTest.cpp b/tests/YGFlexTest.cpp index ab6dec76..82543c95 100644 --- a/tests/YGFlexTest.cpp +++ b/tests/YGFlexTest.cpp @@ -1,9 +1,11 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + +// clang-format off // @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html #include @@ -605,121 +607,3 @@ TEST(YogaTest, flex_grow_less_than_factor_one) { YGConfigFree(config); } - -TEST(YogaTest, flex_shrink_min_width) { - const YGConfigRef config = YGConfigNew(); - YGConfigSetUseWebDefaults(config, true); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); - YGNodeStyleSetWidth(root, 500); - YGNodeStyleSetHeight(root, 500); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); - YGNodeStyleSetWidth(root_child0, 100); - YGNodeStyleSetMinWidth(root_child0, 301); - YGNodeStyleSetHeight(root_child0, 100); - YGNodeInsertChild(root, root_child0, 0); - - const YGNodeRef root_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child1, YGFlexDirectionRow); - YGNodeStyleSetWidth(root_child1, 100); - YGNodeStyleSetMinWidth(root_child1, 25); - YGNodeStyleSetHeight(root_child1, 100); - YGNodeInsertChild(root, root_child1, 1); - - const YGNodeRef root_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child2, YGFlexDirectionRow); - YGNodeStyleSetWidth(root_child2, 100); - YGNodeStyleSetHeight(root_child2, 100); - YGNodeInsertChild(root, root_child2, 2); - - YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(301, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(301, YGNodeLayoutGetLeft(root_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1)); - - ASSERT_FLOAT_EQ(401, YGNodeLayoutGetLeft(root_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2)); - ASSERT_FLOAT_EQ(99, YGNodeLayoutGetWidth(root_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2)); - - YGNodeFreeRecursive(root); - - YGConfigFree(config); -} - -TEST(YogaTest, flex_shrink_flex_grow_min_width) { - const YGConfigRef config = YGConfigNew(); - YGConfigSetUseWebDefaults(config, true); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); - YGNodeStyleSetWidth(root, 500); - YGNodeStyleSetHeight(root, 500); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); - YGNodeStyleSetFlexGrow(root_child0, 0); - YGNodeStyleSetFlexShrink(root_child0, 1); - YGNodeStyleSetWidth(root_child0, 100); - YGNodeStyleSetMinWidth(root_child0, 301); - YGNodeStyleSetHeight(root_child0, 100); - YGNodeInsertChild(root, root_child0, 0); - - const YGNodeRef root_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child1, YGFlexDirectionRow); - YGNodeStyleSetFlexGrow(root_child1, 1); - YGNodeStyleSetFlexShrink(root_child1, 1); - YGNodeStyleSetWidth(root_child1, 100); - YGNodeStyleSetMinWidth(root_child1, 25); - YGNodeStyleSetHeight(root_child1, 100); - YGNodeInsertChild(root, root_child1, 1); - - const YGNodeRef root_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child2, YGFlexDirectionRow); - YGNodeStyleSetWidth(root_child2, 100); - YGNodeStyleSetHeight(root_child2, 100); - YGNodeStyleSetFlexShrink(root_child2, 1); - YGNodeStyleSetFlexGrow(root_child2, 1); - YGNodeInsertChild(root, root_child2, 2); - - YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(301, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(301, YGNodeLayoutGetLeft(root_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1)); - - ASSERT_FLOAT_EQ(401, YGNodeLayoutGetLeft(root_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2)); - ASSERT_FLOAT_EQ(99, YGNodeLayoutGetWidth(root_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2)); - - YGNodeFreeRecursive(root); - - YGConfigFree(config); -} diff --git a/tests/YGFlexWrapTest.cpp b/tests/YGFlexWrapTest.cpp index 38a9c51e..c0c59b75 100644 --- a/tests/YGFlexWrapTest.cpp +++ b/tests/YGFlexWrapTest.cpp @@ -1,9 +1,11 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + +// clang-format off // @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexWrapTest.html #include diff --git a/tests/YGJustifyContentTest.cpp b/tests/YGJustifyContentTest.cpp index e82263c5..013792d2 100644 --- a/tests/YGJustifyContentTest.cpp +++ b/tests/YGJustifyContentTest.cpp @@ -1,11 +1,12 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ -// @Generated by gentest/gentest.rb from -// gentest/fixtures/YGJustifyContentTest.html + +// clang-format off +// @Generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html #include #include @@ -998,9 +999,7 @@ TEST(YogaTest, justify_content_row_space_evenly) { YGConfigFree(config); } -TEST( - YogaTest, - justify_content_min_width_with_padding_child_width_greater_than_parent) { +TEST(YogaTest, justify_content_min_width_with_padding_child_width_greater_than_parent) { const YGConfigRef config = YGConfigNew(); const YGNodeRef root = YGNodeNewWithConfig(config); @@ -1077,9 +1076,7 @@ TEST( YGConfigFree(config); } -TEST( - YogaTest, - justify_content_min_width_with_padding_child_width_lower_than_parent) { +TEST(YogaTest, justify_content_min_width_with_padding_child_width_lower_than_parent) { const YGConfigRef config = YGConfigNew(); const YGNodeRef root = YGNodeNewWithConfig(config); diff --git a/tests/YGMarginTest.cpp b/tests/YGMarginTest.cpp index e857da09..fe6c2074 100644 --- a/tests/YGMarginTest.cpp +++ b/tests/YGMarginTest.cpp @@ -1,9 +1,11 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + +// clang-format off // @Generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html #include diff --git a/tests/YGMinMaxDimensionTest.cpp b/tests/YGMinMaxDimensionTest.cpp index 621aff4d..9a6ce263 100644 --- a/tests/YGMinMaxDimensionTest.cpp +++ b/tests/YGMinMaxDimensionTest.cpp @@ -1,11 +1,12 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ -// @Generated by gentest/gentest.rb from -// gentest/fixtures/YGMinMaxDimensionTest.html + +// clang-format off +// @Generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html #include #include @@ -91,115 +92,6 @@ TEST(YogaTest, max_height) { YGConfigFree(config); } -TEST(YogaTest, min_height) { - const YGConfigRef config = YGConfigNew(); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root, 100); - YGNodeStyleSetHeight(root, 100); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexGrow(root_child0, 1); - YGNodeStyleSetMinHeight(root_child0, 60); - YGNodeInsertChild(root, root_child0, 0); - - const YGNodeRef root_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexGrow(root_child1, 1); - 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(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(80, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1)); - ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1)); - ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1)); - - 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(80, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1)); - ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1)); - ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1)); - - YGNodeFreeRecursive(root); - - YGConfigFree(config); -} - -TEST(YogaTest, min_width) { - const YGConfigRef config = YGConfigNew(); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); - YGNodeStyleSetWidth(root, 100); - YGNodeStyleSetHeight(root, 100); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexGrow(root_child0, 1); - YGNodeStyleSetMinWidth(root_child0, 60); - YGNodeInsertChild(root, root_child0, 0); - - const YGNodeRef root_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexGrow(root_child1, 1); - 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(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(80, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1)); - ASSERT_FLOAT_EQ(20, 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(100, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root)); - - ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(80, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1)); - ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1)); - - YGNodeFreeRecursive(root); - - YGConfigFree(config); -} - TEST(YogaTest, justify_content_min_max) { const YGConfigRef config = YGConfigNew(); @@ -1295,82 +1187,3 @@ TEST(YogaTest, min_max_percent_no_width_height) { YGConfigFree(config); } - -static YGSize _measureCk_test_label_shrink_based_on_height( - YGNodeRef node, - float width, - YGMeasureMode widthMode, - float height, - YGMeasureMode heightMode) { - - if (heightMode == YGMeasureModeAtMost) { - return YGSize{ - .width = 290, - .height = 103, - }; - } else { - return YGSize{ - .width = 290, - .height = height, - }; - } -} - -TEST(YogaTest, min_max_percent_margin_percent_no_width_height) { - const YGConfigRef config = YGConfigNew(); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root, 320); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeInsertChild(root, root_child0, 0); - - const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetHeight(root_child0_child0, 450); - YGNodeInsertChild(root_child0, root_child0_child0, 0); - - const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child0_child0_child0, YGFlexDirectionRow); - YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeTop, 5); - YGNodeStyleSetMaxHeightPercent(root_child0_child0_child0, 10); - YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); - - const YGNodeRef root_child0_child0_child0_child0 = - YGNodeNewWithConfig(config); - YGNodeSetMeasureFunc( - root_child0_child0_child0_child0, - _measureCk_test_label_shrink_based_on_height); - YGNodeInsertChild( - root_child0_child0_child0, root_child0_child0_child0_child0, 0); - - YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root_child0_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(45, YGNodeLayoutGetHeight(root_child0_child0_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0_child0)); - ASSERT_FLOAT_EQ(290, YGNodeLayoutGetWidth(root_child0_child0_child0_child0)); - ASSERT_FLOAT_EQ(45, YGNodeLayoutGetHeight(root_child0_child0_child0_child0)); - - YGNodeFreeRecursive(root); - - YGConfigFree(config); -} diff --git a/tests/YGPaddingTest.cpp b/tests/YGPaddingTest.cpp index bc3847d8..818c086d 100644 --- a/tests/YGPaddingTest.cpp +++ b/tests/YGPaddingTest.cpp @@ -1,9 +1,11 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + +// clang-format off // @Generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html #include diff --git a/tests/YGPercentageTest.cpp b/tests/YGPercentageTest.cpp index 805df24b..38f7f897 100644 --- a/tests/YGPercentageTest.cpp +++ b/tests/YGPercentageTest.cpp @@ -1,9 +1,11 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + +// clang-format off // @Generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html #include @@ -247,61 +249,6 @@ TEST(YogaTest, percentage_flex_basis_cross) { YGConfigFree(config); } -TEST(YogaTest, percentage_flex_basis_cross_min_height) { - const YGConfigRef config = YGConfigNew(); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root, 200); - YGNodeStyleSetHeight(root, 200); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexGrow(root_child0, 1); - YGNodeStyleSetMinHeightPercent(root_child0, 60); - YGNodeInsertChild(root, root_child0, 0); - - const YGNodeRef root_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexGrow(root_child1, 2); - YGNodeStyleSetMinHeightPercent(root_child1, 10); - 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(200, 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(200, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(140, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1)); - ASSERT_FLOAT_EQ(140, YGNodeLayoutGetTop(root_child1)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child1)); - ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child1)); - - YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(140, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1)); - ASSERT_FLOAT_EQ(140, YGNodeLayoutGetTop(root_child1)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child1)); - ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child1)); - - YGNodeFreeRecursive(root); - - YGConfigFree(config); -} - TEST(YogaTest, percentage_flex_basis_main_max_height) { const YGConfigRef config = YGConfigNew(); @@ -647,9 +594,7 @@ TEST(YogaTest, percentage_flex_basis_cross_min_width) { YGConfigFree(config); } -TEST( - YogaTest, - percentage_multiple_nested_with_padding_margin_and_percentage_values) { +TEST(YogaTest, percentage_multiple_nested_with_padding_margin_and_percentage_values) { const YGConfigRef config = YGConfigNew(); const YGNodeRef root = YGNodeNewWithConfig(config); @@ -1193,81 +1138,3 @@ TEST(YogaTest, percent_absolute_position) { YGConfigFree(config); } - -static YGSize _measureCk_test_label_shrink_based_on_height( - YGNodeRef node, - float width, - YGMeasureMode widthMode, - float height, - YGMeasureMode heightMode) { - - if (heightMode == YGMeasureModeAtMost) { - return YGSize{ - .width = 290, - .height = 103, - }; - } else { - return YGSize{ - .width = 290, - .height = height, - }; - } -} - -TEST(YogaTest, margin_percent_with_measure_func) { - const YGConfigRef config = YGConfigNew(); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root, 320); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeInsertChild(root, root_child0, 0); - - const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetHeight(root_child0_child0, 450); - YGNodeInsertChild(root_child0, root_child0_child0, 0); - - const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child0_child0_child0, YGFlexDirectionRow); - YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeTop, 5); - YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); - - const YGNodeRef root_child0_child0_child0_child0 = - YGNodeNewWithConfig(config); - YGNodeSetMeasureFunc( - root_child0_child0_child0_child0, - _measureCk_test_label_shrink_based_on_height); - YGNodeInsertChild( - root_child0_child0_child0, root_child0_child0_child0_child0, 0); - - YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root_child0_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(103, YGNodeLayoutGetHeight(root_child0_child0_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0_child0)); - ASSERT_FLOAT_EQ(290, YGNodeLayoutGetWidth(root_child0_child0_child0_child0)); - ASSERT_FLOAT_EQ(103, YGNodeLayoutGetHeight(root_child0_child0_child0_child0)); - - YGNodeFreeRecursive(root); - - YGConfigFree(config); -} diff --git a/tests/YGRoundingTest.cpp b/tests/YGRoundingTest.cpp index 1b3af640..63dfdad5 100644 --- a/tests/YGRoundingTest.cpp +++ b/tests/YGRoundingTest.cpp @@ -1,9 +1,11 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + +// clang-format off // @Generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html #include diff --git a/tests/YGSizeOverflowTest.cpp b/tests/YGSizeOverflowTest.cpp index 4cfa0a68..62fb5087 100644 --- a/tests/YGSizeOverflowTest.cpp +++ b/tests/YGSizeOverflowTest.cpp @@ -1,11 +1,12 @@ /* - * 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. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ -// @Generated by gentest/gentest.rb from -// gentest/fixtures/YGSizeOverflowTest.html + +// clang-format off +// @Generated by gentest/gentest.rb from gentest/fixtures/YGSizeOverflowTest.html #include #include diff --git a/website/contents/contributing/testing.md b/website/contents/contributing/testing.md index 5c120032..a1808920 100644 --- a/website/contents/contributing/testing.md +++ b/website/contents/contributing/testing.md @@ -8,7 +8,7 @@ hasPlayground: false Yoga tries to be as close as possible to chrome in its flexbox behaviour. To ensure this most of Yoga's test suite is automatically generateded from -running the corresponding layout in chrome using a webdriver which then generates +running the corresponding layout in chrome using a webdriver which then generates C++ test which asserts that Yoga will produce matching outputs for that layout. ## Running the Test Suite @@ -34,12 +34,10 @@ 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 with the string in the `id` corresponding to the test name. -You may need to install the latest watir gem (`gem install watir`) and -[ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/) to -run `gentest/gentest.rb` Ruby script. +You should run `bundle install` in the `gentest` directory to install dependencies for the `gentest/gentest.rb` Ruby script. ## Manual test For some aspects of Yoga we cannot generate a test using the test generation -infrastructure described earlier. For these cases we manually write a test in -the `/tests` directory. +infrastructure described earlier. For these cases we manually write a test in +the `/tests` directory.