diff --git a/csharp/tests/Facebook.Yoga/YGAlignBaseline.cs b/csharp/tests/Facebook.Yoga/YGAlignBaseline.cs
deleted file mode 100644
index 6ca5f00a..00000000
--- a/csharp/tests/Facebook.Yoga/YGAlignBaseline.cs
+++ /dev/null
@@ -1,923 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
- // @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignBaseline.html
-
-using System;
-using NUnit.Framework;
-
-namespace Facebook.Yoga
-{
- [TestFixture]
- public class YGAlignBaseline
- {
- [Test]
- public void Test_align_baseline()
- {
- YogaNode root = new YogaNode();
- root.FlexDirection = YogaFlexDirection.Row;
- root.AlignItems = YogaAlign.Baseline;
- root.Width = 100;
- root.Height = 100;
-
- YogaNode root_child0 = new YogaNode();
- root_child0.Width = 50;
- root_child0.Height = 50;
- root.Insert(0, root_child0);
-
- YogaNode root_child1 = new YogaNode();
- root_child1.Width = 50;
- root_child1.Height = 20;
- root.Insert(1, root_child1);
- root.StyleDirection = YogaDirection.LTR;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(0f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child1.LayoutX);
- Assert.AreEqual(30f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- root.StyleDirection = YogaDirection.RTL;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(50f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1.LayoutX);
- Assert.AreEqual(30f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
- }
-
- [Test]
- public void Test_align_baseline_child()
- {
- YogaNode root = new YogaNode();
- root.FlexDirection = YogaFlexDirection.Row;
- root.AlignItems = YogaAlign.Baseline;
- root.Width = 100;
- root.Height = 100;
-
- YogaNode root_child0 = new YogaNode();
- root_child0.Width = 50;
- root_child0.Height = 50;
- root.Insert(0, root_child0);
-
- YogaNode root_child1 = new YogaNode();
- root_child1.Width = 50;
- root_child1.Height = 20;
- root.Insert(1, root_child1);
-
- YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.Width = 50;
- root_child1_child0.Height = 10;
- root_child1.Insert(0, root_child1_child0);
- root.StyleDirection = YogaDirection.LTR;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(0f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child1.LayoutX);
- Assert.AreEqual(40f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
-
- root.StyleDirection = YogaDirection.RTL;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(50f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1.LayoutX);
- Assert.AreEqual(40f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
- }
-
- [Test]
- public void Test_align_baseline_child_top()
- {
- YogaNode root = new YogaNode();
- root.FlexDirection = YogaFlexDirection.Row;
- root.AlignItems = YogaAlign.Baseline;
- root.Width = 100;
- root.Height = 100;
-
- YogaNode root_child0 = new YogaNode();
- root_child0.SetPosition(YogaEdge.Top, 10);
- root_child0.Width = 50;
- root_child0.Height = 50;
- root.Insert(0, root_child0);
-
- YogaNode root_child1 = new YogaNode();
- root_child1.Width = 50;
- root_child1.Height = 20;
- root.Insert(1, root_child1);
-
- YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.Width = 50;
- root_child1_child0.Height = 10;
- root_child1.Insert(0, root_child1_child0);
- root.StyleDirection = YogaDirection.LTR;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(0f, root_child0.LayoutX);
- Assert.AreEqual(10f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child1.LayoutX);
- Assert.AreEqual(40f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
-
- root.StyleDirection = YogaDirection.RTL;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(50f, root_child0.LayoutX);
- Assert.AreEqual(10f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1.LayoutX);
- Assert.AreEqual(40f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
- }
-
- [Test]
- public void Test_align_baseline_child_top2()
- {
- YogaNode root = new YogaNode();
- root.FlexDirection = YogaFlexDirection.Row;
- root.AlignItems = YogaAlign.Baseline;
- root.Width = 100;
- root.Height = 100;
-
- YogaNode root_child0 = new YogaNode();
- root_child0.Width = 50;
- root_child0.Height = 50;
- root.Insert(0, root_child0);
-
- YogaNode root_child1 = new YogaNode();
- root_child1.SetPosition(YogaEdge.Top, 5);
- root_child1.Width = 50;
- root_child1.Height = 20;
- root.Insert(1, root_child1);
-
- YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.Width = 50;
- root_child1_child0.Height = 10;
- root_child1.Insert(0, root_child1_child0);
- root.StyleDirection = YogaDirection.LTR;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(0f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child1.LayoutX);
- Assert.AreEqual(45f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
-
- root.StyleDirection = YogaDirection.RTL;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(50f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1.LayoutX);
- Assert.AreEqual(45f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
- }
-
- [Test]
- public void Test_align_baseline_double_nested_child()
- {
- YogaNode root = new YogaNode();
- root.FlexDirection = YogaFlexDirection.Row;
- root.AlignItems = YogaAlign.Baseline;
- root.Width = 100;
- root.Height = 100;
-
- YogaNode root_child0 = new YogaNode();
- root_child0.Width = 50;
- root_child0.Height = 50;
- root.Insert(0, root_child0);
-
- YogaNode root_child0_child0 = new YogaNode();
- root_child0_child0.Width = 50;
- root_child0_child0.Height = 20;
- root_child0.Insert(0, root_child0_child0);
-
- YogaNode root_child1 = new YogaNode();
- root_child1.Width = 50;
- root_child1.Height = 20;
- root.Insert(1, root_child1);
-
- YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.Width = 50;
- root_child1_child0.Height = 15;
- root_child1.Insert(0, root_child1_child0);
- root.StyleDirection = YogaDirection.LTR;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(0f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child0_child0.LayoutX);
- Assert.AreEqual(0f, root_child0_child0.LayoutY);
- Assert.AreEqual(50f, root_child0_child0.LayoutWidth);
- Assert.AreEqual(20f, root_child0_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child1.LayoutX);
- Assert.AreEqual(5f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(15f, root_child1_child0.LayoutHeight);
-
- root.StyleDirection = YogaDirection.RTL;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(50f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child0_child0.LayoutX);
- Assert.AreEqual(0f, root_child0_child0.LayoutY);
- Assert.AreEqual(50f, root_child0_child0.LayoutWidth);
- Assert.AreEqual(20f, root_child0_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1.LayoutX);
- Assert.AreEqual(5f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(15f, root_child1_child0.LayoutHeight);
- }
-
- [Test]
- public void Test_align_baseline_column()
- {
- YogaNode root = new YogaNode();
- root.AlignItems = YogaAlign.Baseline;
- root.Width = 100;
- root.Height = 100;
-
- YogaNode root_child0 = new YogaNode();
- root_child0.Width = 50;
- root_child0.Height = 50;
- root.Insert(0, root_child0);
-
- YogaNode root_child1 = new YogaNode();
- root_child1.Width = 50;
- root_child1.Height = 20;
- root.Insert(1, root_child1);
- root.StyleDirection = YogaDirection.LTR;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(0f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1.LayoutX);
- Assert.AreEqual(50f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- root.StyleDirection = YogaDirection.RTL;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(50f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child1.LayoutX);
- Assert.AreEqual(50f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
- }
-
- [Test]
- public void Test_align_baseline_child_margin()
- {
- YogaNode root = new YogaNode();
- root.FlexDirection = YogaFlexDirection.Row;
- root.AlignItems = YogaAlign.Baseline;
- root.Width = 100;
- root.Height = 100;
-
- YogaNode root_child0 = new YogaNode();
- root_child0.SetMargin(YogaEdge.Left, 5);
- root_child0.SetMargin(YogaEdge.Top, 5);
- root_child0.SetMargin(YogaEdge.Right, 5);
- root_child0.SetMargin(YogaEdge.Bottom, 5);
- root_child0.Width = 50;
- root_child0.Height = 50;
- root.Insert(0, root_child0);
-
- YogaNode root_child1 = new YogaNode();
- root_child1.Width = 50;
- root_child1.Height = 20;
- root.Insert(1, root_child1);
-
- YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.SetMargin(YogaEdge.Left, 1);
- root_child1_child0.SetMargin(YogaEdge.Top, 1);
- root_child1_child0.SetMargin(YogaEdge.Right, 1);
- root_child1_child0.SetMargin(YogaEdge.Bottom, 1);
- root_child1_child0.Width = 50;
- root_child1_child0.Height = 10;
- root_child1.Insert(0, root_child1_child0);
- root.StyleDirection = YogaDirection.LTR;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(5f, root_child0.LayoutX);
- Assert.AreEqual(5f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(60f, root_child1.LayoutX);
- Assert.AreEqual(44f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- Assert.AreEqual(1f, root_child1_child0.LayoutX);
- Assert.AreEqual(1f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
-
- root.StyleDirection = YogaDirection.RTL;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(45f, root_child0.LayoutX);
- Assert.AreEqual(5f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(-10f, root_child1.LayoutX);
- Assert.AreEqual(44f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- Assert.AreEqual(-1f, root_child1_child0.LayoutX);
- Assert.AreEqual(1f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
- }
-
- [Test]
- public void Test_align_baseline_multiline()
- {
- YogaNode root = new YogaNode();
- root.FlexDirection = YogaFlexDirection.Row;
- root.AlignItems = YogaAlign.Baseline;
- root.Wrap = YogaWrap.Wrap;
- root.Width = 100;
- root.Height = 100;
-
- YogaNode root_child0 = new YogaNode();
- root_child0.Width = 50;
- root_child0.Height = 50;
- root.Insert(0, root_child0);
-
- YogaNode root_child1 = new YogaNode();
- root_child1.Width = 50;
- root_child1.Height = 20;
- root.Insert(1, root_child1);
-
- YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.Width = 50;
- root_child1_child0.Height = 10;
- root_child1.Insert(0, root_child1_child0);
-
- YogaNode root_child2 = new YogaNode();
- root_child2.Width = 50;
- root_child2.Height = 20;
- root.Insert(2, root_child2);
-
- YogaNode root_child2_child0 = new YogaNode();
- root_child2_child0.Width = 50;
- root_child2_child0.Height = 10;
- root_child2.Insert(0, root_child2_child0);
-
- YogaNode root_child3 = new YogaNode();
- root_child3.Width = 50;
- root_child3.Height = 50;
- root.Insert(3, root_child3);
- root.StyleDirection = YogaDirection.LTR;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(0f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child1.LayoutX);
- Assert.AreEqual(40f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child2.LayoutX);
- Assert.AreEqual(100f, root_child2.LayoutY);
- Assert.AreEqual(50f, root_child2.LayoutWidth);
- Assert.AreEqual(20f, root_child2.LayoutHeight);
-
- Assert.AreEqual(0f, root_child2_child0.LayoutX);
- Assert.AreEqual(0f, root_child2_child0.LayoutY);
- Assert.AreEqual(50f, root_child2_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child2_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child3.LayoutX);
- Assert.AreEqual(60f, root_child3.LayoutY);
- Assert.AreEqual(50f, root_child3.LayoutWidth);
- Assert.AreEqual(50f, root_child3.LayoutHeight);
-
- root.StyleDirection = YogaDirection.RTL;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(50f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1.LayoutX);
- Assert.AreEqual(40f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child2.LayoutX);
- Assert.AreEqual(100f, root_child2.LayoutY);
- Assert.AreEqual(50f, root_child2.LayoutWidth);
- Assert.AreEqual(20f, root_child2.LayoutHeight);
-
- Assert.AreEqual(0f, root_child2_child0.LayoutX);
- Assert.AreEqual(0f, root_child2_child0.LayoutY);
- Assert.AreEqual(50f, root_child2_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child2_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child3.LayoutX);
- Assert.AreEqual(60f, root_child3.LayoutY);
- Assert.AreEqual(50f, root_child3.LayoutWidth);
- Assert.AreEqual(50f, root_child3.LayoutHeight);
- }
-
- [Test]
- public void Test_align_baseline_self()
- {
- YogaNode root = new YogaNode();
- root.FlexDirection = YogaFlexDirection.Row;
- root.Width = 100;
- root.Height = 100;
-
- YogaNode root_child0 = new YogaNode();
- root_child0.AlignSelf = YogaAlign.Baseline;
- root_child0.Width = 50;
- root_child0.Height = 50;
- root.Insert(0, root_child0);
-
- YogaNode root_child1 = new YogaNode();
- root_child1.AlignSelf = YogaAlign.Baseline;
- root_child1.Width = 50;
- root_child1.Height = 20;
- root.Insert(1, root_child1);
-
- YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.Width = 50;
- root_child1_child0.Height = 10;
- root_child1.Insert(0, root_child1_child0);
- root.StyleDirection = YogaDirection.LTR;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(0f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child1.LayoutX);
- Assert.AreEqual(40f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
-
- root.StyleDirection = YogaDirection.RTL;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(50f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1.LayoutX);
- Assert.AreEqual(40f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(20f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
- }
-
- [Test]
- public void Test_align_baseline_multiline_column()
- {
- YogaNode root = new YogaNode();
- root.AlignItems = YogaAlign.Baseline;
- root.Wrap = YogaWrap.Wrap;
- root.Width = 100;
- root.Height = 100;
-
- YogaNode root_child0 = new YogaNode();
- root_child0.Width = 50;
- root_child0.Height = 50;
- root.Insert(0, root_child0);
-
- YogaNode root_child1 = new YogaNode();
- root_child1.Width = 50;
- root_child1.Height = 50;
- root.Insert(1, root_child1);
-
- YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.Width = 50;
- root_child1_child0.Height = 10;
- root_child1.Insert(0, root_child1_child0);
-
- YogaNode root_child2 = new YogaNode();
- root_child2.Width = 50;
- root_child2.Height = 20;
- root.Insert(2, root_child2);
-
- YogaNode root_child2_child0 = new YogaNode();
- root_child2_child0.Width = 50;
- root_child2_child0.Height = 10;
- root_child2.Insert(0, root_child2_child0);
-
- YogaNode root_child3 = new YogaNode();
- root_child3.Width = 50;
- root_child3.Height = 20;
- root.Insert(3, root_child3);
- root.StyleDirection = YogaDirection.LTR;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(0f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1.LayoutX);
- Assert.AreEqual(50f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(50f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child2.LayoutX);
- Assert.AreEqual(0f, root_child2.LayoutY);
- Assert.AreEqual(50f, root_child2.LayoutWidth);
- Assert.AreEqual(20f, root_child2.LayoutHeight);
-
- Assert.AreEqual(0f, root_child2_child0.LayoutX);
- Assert.AreEqual(0f, root_child2_child0.LayoutY);
- Assert.AreEqual(50f, root_child2_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child2_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child3.LayoutX);
- Assert.AreEqual(20f, root_child3.LayoutY);
- Assert.AreEqual(50f, root_child3.LayoutWidth);
- Assert.AreEqual(20f, root_child3.LayoutHeight);
-
- root.StyleDirection = YogaDirection.RTL;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(50f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child1.LayoutX);
- Assert.AreEqual(50f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(50f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child2.LayoutX);
- Assert.AreEqual(0f, root_child2.LayoutY);
- Assert.AreEqual(50f, root_child2.LayoutWidth);
- Assert.AreEqual(20f, root_child2.LayoutHeight);
-
- Assert.AreEqual(0f, root_child2_child0.LayoutX);
- Assert.AreEqual(0f, root_child2_child0.LayoutY);
- Assert.AreEqual(50f, root_child2_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child2_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child3.LayoutX);
- Assert.AreEqual(20f, root_child3.LayoutY);
- Assert.AreEqual(50f, root_child3.LayoutWidth);
- Assert.AreEqual(20f, root_child3.LayoutHeight);
- }
-
- [Test]
- public void Test_align_baseline_multiline_row_and_column()
- {
- YogaNode root = new YogaNode();
- root.FlexDirection = YogaFlexDirection.Row;
- root.AlignItems = YogaAlign.Baseline;
- root.Wrap = YogaWrap.Wrap;
- root.Width = 100;
- root.Height = 100;
-
- YogaNode root_child0 = new YogaNode();
- root_child0.Width = 50;
- root_child0.Height = 50;
- root.Insert(0, root_child0);
-
- YogaNode root_child1 = new YogaNode();
- root_child1.Width = 50;
- root_child1.Height = 50;
- root.Insert(1, root_child1);
-
- YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.Width = 50;
- root_child1_child0.Height = 10;
- root_child1.Insert(0, root_child1_child0);
-
- YogaNode root_child2 = new YogaNode();
- root_child2.Width = 50;
- root_child2.Height = 20;
- root.Insert(2, root_child2);
-
- YogaNode root_child2_child0 = new YogaNode();
- root_child2_child0.Width = 50;
- root_child2_child0.Height = 10;
- root_child2.Insert(0, root_child2_child0);
-
- YogaNode root_child3 = new YogaNode();
- root_child3.Width = 50;
- root_child3.Height = 20;
- root.Insert(3, root_child3);
- root.StyleDirection = YogaDirection.LTR;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(0f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child1.LayoutX);
- Assert.AreEqual(40f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(50f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child2.LayoutX);
- Assert.AreEqual(100f, root_child2.LayoutY);
- Assert.AreEqual(50f, root_child2.LayoutWidth);
- Assert.AreEqual(20f, root_child2.LayoutHeight);
-
- Assert.AreEqual(0f, root_child2_child0.LayoutX);
- Assert.AreEqual(0f, root_child2_child0.LayoutY);
- Assert.AreEqual(50f, root_child2_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child2_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child3.LayoutX);
- Assert.AreEqual(90f, root_child3.LayoutY);
- Assert.AreEqual(50f, root_child3.LayoutWidth);
- Assert.AreEqual(20f, root_child3.LayoutHeight);
-
- root.StyleDirection = YogaDirection.RTL;
- root.CalculateLayout();
-
- Assert.AreEqual(0f, root.LayoutX);
- Assert.AreEqual(0f, root.LayoutY);
- Assert.AreEqual(100f, root.LayoutWidth);
- Assert.AreEqual(100f, root.LayoutHeight);
-
- Assert.AreEqual(50f, root_child0.LayoutX);
- Assert.AreEqual(0f, root_child0.LayoutY);
- Assert.AreEqual(50f, root_child0.LayoutWidth);
- Assert.AreEqual(50f, root_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1.LayoutX);
- Assert.AreEqual(40f, root_child1.LayoutY);
- Assert.AreEqual(50f, root_child1.LayoutWidth);
- Assert.AreEqual(50f, root_child1.LayoutHeight);
-
- Assert.AreEqual(0f, root_child1_child0.LayoutX);
- Assert.AreEqual(0f, root_child1_child0.LayoutY);
- Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
-
- Assert.AreEqual(50f, root_child2.LayoutX);
- Assert.AreEqual(100f, root_child2.LayoutY);
- Assert.AreEqual(50f, root_child2.LayoutWidth);
- Assert.AreEqual(20f, root_child2.LayoutHeight);
-
- Assert.AreEqual(0f, root_child2_child0.LayoutX);
- Assert.AreEqual(0f, root_child2_child0.LayoutY);
- Assert.AreEqual(50f, root_child2_child0.LayoutWidth);
- Assert.AreEqual(10f, root_child2_child0.LayoutHeight);
-
- Assert.AreEqual(0f, root_child3.LayoutX);
- Assert.AreEqual(90f, root_child3.LayoutY);
- Assert.AreEqual(50f, root_child3.LayoutWidth);
- Assert.AreEqual(20f, root_child3.LayoutHeight);
- }
-
- }
-}
diff --git a/csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs b/csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs
index bcafe460..b13004bf 100644
--- a/csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs
+++ b/csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs
@@ -171,5 +171,836 @@ namespace Facebook.Yoga
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
+ [Test]
+ public void Test_align_baseline()
+ {
+ YogaNode root = new YogaNode();
+ root.FlexDirection = YogaFlexDirection.Row;
+ root.AlignItems = YogaAlign.Baseline;
+ root.Width = 100;
+ root.Height = 100;
+
+ YogaNode root_child0 = new YogaNode();
+ root_child0.Width = 50;
+ root_child0.Height = 50;
+ root.Insert(0, root_child0);
+
+ YogaNode root_child1 = new YogaNode();
+ root_child1.Width = 50;
+ root_child1.Height = 20;
+ root.Insert(1, root_child1);
+ root.StyleDirection = YogaDirection.LTR;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child1.LayoutX);
+ Assert.AreEqual(30f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ root.StyleDirection = YogaDirection.RTL;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(30f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+ }
+
+ [Test]
+ public void Test_align_baseline_child()
+ {
+ YogaNode root = new YogaNode();
+ root.FlexDirection = YogaFlexDirection.Row;
+ root.AlignItems = YogaAlign.Baseline;
+ root.Width = 100;
+ root.Height = 100;
+
+ YogaNode root_child0 = new YogaNode();
+ root_child0.Width = 50;
+ root_child0.Height = 50;
+ root.Insert(0, root_child0);
+
+ YogaNode root_child1 = new YogaNode();
+ root_child1.Width = 50;
+ root_child1.Height = 20;
+ root.Insert(1, root_child1);
+
+ YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.Width = 50;
+ root_child1_child0.Height = 10;
+ root_child1.Insert(0, root_child1_child0);
+ root.StyleDirection = YogaDirection.LTR;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child1.LayoutX);
+ Assert.AreEqual(40f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+
+ root.StyleDirection = YogaDirection.RTL;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(40f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+ }
+
+ [Test]
+ public void Test_align_baseline_child_top()
+ {
+ YogaNode root = new YogaNode();
+ root.FlexDirection = YogaFlexDirection.Row;
+ root.AlignItems = YogaAlign.Baseline;
+ root.Width = 100;
+ root.Height = 100;
+
+ YogaNode root_child0 = new YogaNode();
+ root_child0.SetPosition(YogaEdge.Top, 10);
+ root_child0.Width = 50;
+ root_child0.Height = 50;
+ root.Insert(0, root_child0);
+
+ YogaNode root_child1 = new YogaNode();
+ root_child1.Width = 50;
+ root_child1.Height = 20;
+ root.Insert(1, root_child1);
+
+ YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.Width = 50;
+ root_child1_child0.Height = 10;
+ root_child1.Insert(0, root_child1_child0);
+ root.StyleDirection = YogaDirection.LTR;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(10f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child1.LayoutX);
+ Assert.AreEqual(40f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+
+ root.StyleDirection = YogaDirection.RTL;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child0.LayoutX);
+ Assert.AreEqual(10f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(40f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+ }
+
+ [Test]
+ public void Test_align_baseline_child_top2()
+ {
+ YogaNode root = new YogaNode();
+ root.FlexDirection = YogaFlexDirection.Row;
+ root.AlignItems = YogaAlign.Baseline;
+ root.Width = 100;
+ root.Height = 100;
+
+ YogaNode root_child0 = new YogaNode();
+ root_child0.Width = 50;
+ root_child0.Height = 50;
+ root.Insert(0, root_child0);
+
+ YogaNode root_child1 = new YogaNode();
+ root_child1.SetPosition(YogaEdge.Top, 5);
+ root_child1.Width = 50;
+ root_child1.Height = 20;
+ root.Insert(1, root_child1);
+
+ YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.Width = 50;
+ root_child1_child0.Height = 10;
+ root_child1.Insert(0, root_child1_child0);
+ root.StyleDirection = YogaDirection.LTR;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child1.LayoutX);
+ Assert.AreEqual(45f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+
+ root.StyleDirection = YogaDirection.RTL;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(45f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+ }
+
+ [Test]
+ public void Test_align_baseline_double_nested_child()
+ {
+ YogaNode root = new YogaNode();
+ root.FlexDirection = YogaFlexDirection.Row;
+ root.AlignItems = YogaAlign.Baseline;
+ root.Width = 100;
+ root.Height = 100;
+
+ YogaNode root_child0 = new YogaNode();
+ root_child0.Width = 50;
+ root_child0.Height = 50;
+ root.Insert(0, root_child0);
+
+ YogaNode root_child0_child0 = new YogaNode();
+ root_child0_child0.Width = 50;
+ root_child0_child0.Height = 20;
+ root_child0.Insert(0, root_child0_child0);
+
+ YogaNode root_child1 = new YogaNode();
+ root_child1.Width = 50;
+ root_child1.Height = 20;
+ root.Insert(1, root_child1);
+
+ YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.Width = 50;
+ root_child1_child0.Height = 15;
+ root_child1.Insert(0, root_child1_child0);
+ root.StyleDirection = YogaDirection.LTR;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0_child0.LayoutWidth);
+ Assert.AreEqual(20f, root_child0_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child1.LayoutX);
+ Assert.AreEqual(5f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(15f, root_child1_child0.LayoutHeight);
+
+ root.StyleDirection = YogaDirection.RTL;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0_child0.LayoutWidth);
+ Assert.AreEqual(20f, root_child0_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(5f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(15f, root_child1_child0.LayoutHeight);
+ }
+
+ [Test]
+ public void Test_align_baseline_column()
+ {
+ YogaNode root = new YogaNode();
+ root.AlignItems = YogaAlign.Baseline;
+ root.Width = 100;
+ root.Height = 100;
+
+ YogaNode root_child0 = new YogaNode();
+ root_child0.Width = 50;
+ root_child0.Height = 50;
+ root.Insert(0, root_child0);
+
+ YogaNode root_child1 = new YogaNode();
+ root_child1.Width = 50;
+ root_child1.Height = 20;
+ root.Insert(1, root_child1);
+ root.StyleDirection = YogaDirection.LTR;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(50f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ root.StyleDirection = YogaDirection.RTL;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child1.LayoutX);
+ Assert.AreEqual(50f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+ }
+
+ [Test]
+ public void Test_align_baseline_child_margin()
+ {
+ YogaNode root = new YogaNode();
+ root.FlexDirection = YogaFlexDirection.Row;
+ root.AlignItems = YogaAlign.Baseline;
+ root.Width = 100;
+ root.Height = 100;
+
+ YogaNode root_child0 = new YogaNode();
+ root_child0.SetMargin(YogaEdge.Left, 5);
+ root_child0.SetMargin(YogaEdge.Top, 5);
+ root_child0.SetMargin(YogaEdge.Right, 5);
+ root_child0.SetMargin(YogaEdge.Bottom, 5);
+ root_child0.Width = 50;
+ root_child0.Height = 50;
+ root.Insert(0, root_child0);
+
+ YogaNode root_child1 = new YogaNode();
+ root_child1.Width = 50;
+ root_child1.Height = 20;
+ root.Insert(1, root_child1);
+
+ YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.SetMargin(YogaEdge.Left, 1);
+ root_child1_child0.SetMargin(YogaEdge.Top, 1);
+ root_child1_child0.SetMargin(YogaEdge.Right, 1);
+ root_child1_child0.SetMargin(YogaEdge.Bottom, 1);
+ root_child1_child0.Width = 50;
+ root_child1_child0.Height = 10;
+ root_child1.Insert(0, root_child1_child0);
+ root.StyleDirection = YogaDirection.LTR;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(5f, root_child0.LayoutX);
+ Assert.AreEqual(5f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(60f, root_child1.LayoutX);
+ Assert.AreEqual(44f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(1f, root_child1_child0.LayoutX);
+ Assert.AreEqual(1f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+
+ root.StyleDirection = YogaDirection.RTL;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(45f, root_child0.LayoutX);
+ Assert.AreEqual(5f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(-10f, root_child1.LayoutX);
+ Assert.AreEqual(44f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(-1f, root_child1_child0.LayoutX);
+ Assert.AreEqual(1f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+ }
+
+ [Test]
+ public void Test_align_baseline_multiline()
+ {
+ YogaNode root = new YogaNode();
+ root.FlexDirection = YogaFlexDirection.Row;
+ root.AlignItems = YogaAlign.Baseline;
+ root.Wrap = YogaWrap.Wrap;
+ root.Width = 100;
+ root.Height = 100;
+
+ YogaNode root_child0 = new YogaNode();
+ root_child0.Width = 50;
+ root_child0.Height = 50;
+ root.Insert(0, root_child0);
+
+ YogaNode root_child1 = new YogaNode();
+ root_child1.Width = 50;
+ root_child1.Height = 20;
+ root.Insert(1, root_child1);
+
+ YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.Width = 50;
+ root_child1_child0.Height = 10;
+ root_child1.Insert(0, root_child1_child0);
+
+ YogaNode root_child2 = new YogaNode();
+ root_child2.Width = 50;
+ root_child2.Height = 20;
+ root.Insert(2, root_child2);
+
+ YogaNode root_child2_child0 = new YogaNode();
+ root_child2_child0.Width = 50;
+ root_child2_child0.Height = 10;
+ root_child2.Insert(0, root_child2_child0);
+
+ YogaNode root_child3 = new YogaNode();
+ root_child3.Width = 50;
+ root_child3.Height = 50;
+ root.Insert(3, root_child3);
+ root.StyleDirection = YogaDirection.LTR;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child1.LayoutX);
+ Assert.AreEqual(40f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child2.LayoutX);
+ Assert.AreEqual(100f, root_child2.LayoutY);
+ Assert.AreEqual(50f, root_child2.LayoutWidth);
+ Assert.AreEqual(20f, root_child2.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child2_child0.LayoutX);
+ Assert.AreEqual(0f, root_child2_child0.LayoutY);
+ Assert.AreEqual(50f, root_child2_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child2_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child3.LayoutX);
+ Assert.AreEqual(60f, root_child3.LayoutY);
+ Assert.AreEqual(50f, root_child3.LayoutWidth);
+ Assert.AreEqual(50f, root_child3.LayoutHeight);
+
+ root.StyleDirection = YogaDirection.RTL;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(40f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child2.LayoutX);
+ Assert.AreEqual(100f, root_child2.LayoutY);
+ Assert.AreEqual(50f, root_child2.LayoutWidth);
+ Assert.AreEqual(20f, root_child2.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child2_child0.LayoutX);
+ Assert.AreEqual(0f, root_child2_child0.LayoutY);
+ Assert.AreEqual(50f, root_child2_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child2_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child3.LayoutX);
+ Assert.AreEqual(60f, root_child3.LayoutY);
+ Assert.AreEqual(50f, root_child3.LayoutWidth);
+ Assert.AreEqual(50f, root_child3.LayoutHeight);
+ }
+
+ [Test]
+ public void Test_align_baseline_multiline_column()
+ {
+ YogaNode root = new YogaNode();
+ root.AlignItems = YogaAlign.Baseline;
+ root.Wrap = YogaWrap.Wrap;
+ root.Width = 100;
+ root.Height = 100;
+
+ YogaNode root_child0 = new YogaNode();
+ root_child0.Width = 50;
+ root_child0.Height = 50;
+ root.Insert(0, root_child0);
+
+ YogaNode root_child1 = new YogaNode();
+ root_child1.Width = 50;
+ root_child1.Height = 50;
+ root.Insert(1, root_child1);
+
+ YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.Width = 50;
+ root_child1_child0.Height = 10;
+ root_child1.Insert(0, root_child1_child0);
+
+ YogaNode root_child2 = new YogaNode();
+ root_child2.Width = 50;
+ root_child2.Height = 20;
+ root.Insert(2, root_child2);
+
+ YogaNode root_child2_child0 = new YogaNode();
+ root_child2_child0.Width = 50;
+ root_child2_child0.Height = 10;
+ root_child2.Insert(0, root_child2_child0);
+
+ YogaNode root_child3 = new YogaNode();
+ root_child3.Width = 50;
+ root_child3.Height = 20;
+ root.Insert(3, root_child3);
+ root.StyleDirection = YogaDirection.LTR;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(50f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(50f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child2.LayoutX);
+ Assert.AreEqual(0f, root_child2.LayoutY);
+ Assert.AreEqual(50f, root_child2.LayoutWidth);
+ Assert.AreEqual(20f, root_child2.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child2_child0.LayoutX);
+ Assert.AreEqual(0f, root_child2_child0.LayoutY);
+ Assert.AreEqual(50f, root_child2_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child2_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child3.LayoutX);
+ Assert.AreEqual(20f, root_child3.LayoutY);
+ Assert.AreEqual(50f, root_child3.LayoutWidth);
+ Assert.AreEqual(20f, root_child3.LayoutHeight);
+
+ root.StyleDirection = YogaDirection.RTL;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child1.LayoutX);
+ Assert.AreEqual(50f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(50f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child2.LayoutX);
+ Assert.AreEqual(0f, root_child2.LayoutY);
+ Assert.AreEqual(50f, root_child2.LayoutWidth);
+ Assert.AreEqual(20f, root_child2.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child2_child0.LayoutX);
+ Assert.AreEqual(0f, root_child2_child0.LayoutY);
+ Assert.AreEqual(50f, root_child2_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child2_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child3.LayoutX);
+ Assert.AreEqual(20f, root_child3.LayoutY);
+ Assert.AreEqual(50f, root_child3.LayoutWidth);
+ Assert.AreEqual(20f, root_child3.LayoutHeight);
+ }
+
+ [Test]
+ public void Test_align_baseline_multiline_row_and_column()
+ {
+ YogaNode root = new YogaNode();
+ root.FlexDirection = YogaFlexDirection.Row;
+ root.AlignItems = YogaAlign.Baseline;
+ root.Wrap = YogaWrap.Wrap;
+ root.Width = 100;
+ root.Height = 100;
+
+ YogaNode root_child0 = new YogaNode();
+ root_child0.Width = 50;
+ root_child0.Height = 50;
+ root.Insert(0, root_child0);
+
+ YogaNode root_child1 = new YogaNode();
+ root_child1.Width = 50;
+ root_child1.Height = 50;
+ root.Insert(1, root_child1);
+
+ YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.Width = 50;
+ root_child1_child0.Height = 10;
+ root_child1.Insert(0, root_child1_child0);
+
+ YogaNode root_child2 = new YogaNode();
+ root_child2.Width = 50;
+ root_child2.Height = 20;
+ root.Insert(2, root_child2);
+
+ YogaNode root_child2_child0 = new YogaNode();
+ root_child2_child0.Width = 50;
+ root_child2_child0.Height = 10;
+ root_child2.Insert(0, root_child2_child0);
+
+ YogaNode root_child3 = new YogaNode();
+ root_child3.Width = 50;
+ root_child3.Height = 20;
+ root.Insert(3, root_child3);
+ root.StyleDirection = YogaDirection.LTR;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child1.LayoutX);
+ Assert.AreEqual(40f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(50f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child2.LayoutX);
+ Assert.AreEqual(100f, root_child2.LayoutY);
+ Assert.AreEqual(50f, root_child2.LayoutWidth);
+ Assert.AreEqual(20f, root_child2.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child2_child0.LayoutX);
+ Assert.AreEqual(0f, root_child2_child0.LayoutY);
+ Assert.AreEqual(50f, root_child2_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child2_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child3.LayoutX);
+ Assert.AreEqual(90f, root_child3.LayoutY);
+ Assert.AreEqual(50f, root_child3.LayoutWidth);
+ Assert.AreEqual(20f, root_child3.LayoutHeight);
+
+ root.StyleDirection = YogaDirection.RTL;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(40f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(50f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child2.LayoutX);
+ Assert.AreEqual(100f, root_child2.LayoutY);
+ Assert.AreEqual(50f, root_child2.LayoutWidth);
+ Assert.AreEqual(20f, root_child2.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child2_child0.LayoutX);
+ Assert.AreEqual(0f, root_child2_child0.LayoutY);
+ Assert.AreEqual(50f, root_child2_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child2_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child3.LayoutX);
+ Assert.AreEqual(90f, root_child3.LayoutY);
+ Assert.AreEqual(50f, root_child3.LayoutWidth);
+ Assert.AreEqual(20f, root_child3.LayoutHeight);
+ }
+
}
}
diff --git a/csharp/tests/Facebook.Yoga/YGAlignSelfTest.cs b/csharp/tests/Facebook.Yoga/YGAlignSelfTest.cs
index b4ca0e13..520d5e8c 100644
--- a/csharp/tests/Facebook.Yoga/YGAlignSelfTest.cs
+++ b/csharp/tests/Facebook.Yoga/YGAlignSelfTest.cs
@@ -174,5 +174,76 @@ namespace Facebook.Yoga
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
+ [Test]
+ public void Test_align_self_baseline()
+ {
+ YogaNode root = new YogaNode();
+ root.FlexDirection = YogaFlexDirection.Row;
+ root.Width = 100;
+ root.Height = 100;
+
+ YogaNode root_child0 = new YogaNode();
+ root_child0.AlignSelf = YogaAlign.Baseline;
+ root_child0.Width = 50;
+ root_child0.Height = 50;
+ root.Insert(0, root_child0);
+
+ YogaNode root_child1 = new YogaNode();
+ root_child1.AlignSelf = YogaAlign.Baseline;
+ root_child1.Width = 50;
+ root_child1.Height = 20;
+ root.Insert(1, root_child1);
+
+ YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.Width = 50;
+ root_child1_child0.Height = 10;
+ root_child1.Insert(0, root_child1_child0);
+ root.StyleDirection = YogaDirection.LTR;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child1.LayoutX);
+ Assert.AreEqual(40f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+
+ root.StyleDirection = YogaDirection.RTL;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(100f, root.LayoutWidth);
+ Assert.AreEqual(100f, root.LayoutHeight);
+
+ Assert.AreEqual(50f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(50f, root_child0.LayoutWidth);
+ Assert.AreEqual(50f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(40f, root_child1.LayoutY);
+ Assert.AreEqual(50f, root_child1.LayoutWidth);
+ Assert.AreEqual(20f, root_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child1_child0.LayoutY);
+ Assert.AreEqual(50f, root_child1_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
+ }
+
}
}
diff --git a/gentest/fixtures/YGAlignBaseline.html b/gentest/fixtures/YGAlignBaseline.html
deleted file mode 100644
index a4a98b76..00000000
--- a/gentest/fixtures/YGAlignBaseline.html
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/gentest/fixtures/YGAlignItemsTest.html b/gentest/fixtures/YGAlignItemsTest.html
index e040b9ed..e83362ca 100644
--- a/gentest/fixtures/YGAlignItemsTest.html
+++ b/gentest/fixtures/YGAlignItemsTest.html
@@ -13,3 +13,84 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/gentest/fixtures/YGAlignSelfTest.html b/gentest/fixtures/YGAlignSelfTest.html
index 047de30c..c2f656ed 100644
--- a/gentest/fixtures/YGAlignSelfTest.html
+++ b/gentest/fixtures/YGAlignSelfTest.html
@@ -13,3 +13,11 @@
+
+
+
diff --git a/java/tests/com/facebook/yoga/YGAlignBaseline.java b/java/tests/com/facebook/yoga/YGAlignBaseline.java
deleted file mode 100644
index 05ac65b2..00000000
--- a/java/tests/com/facebook/yoga/YGAlignBaseline.java
+++ /dev/null
@@ -1,910 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
- // @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignBaseline.html
-
-package com.facebook.yoga;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class YGAlignBaseline {
- @Test
- public void test_align_baseline() {
- final YogaNode root = new YogaNode();
- root.setFlexDirection(YogaFlexDirection.ROW);
- root.setAlignItems(YogaAlign.BASELINE);
- root.setWidth(100f);
- root.setHeight(100f);
-
- final YogaNode root_child0 = new YogaNode();
- root_child0.setWidth(50f);
- root_child0.setHeight(50f);
- root.addChildAt(root_child0, 0);
-
- final YogaNode root_child1 = new YogaNode();
- root_child1.setWidth(50f);
- root_child1.setHeight(20f);
- root.addChildAt(root_child1, 1);
- root.setDirection(YogaDirection.LTR);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child1.getLayoutX(), 0.0f);
- assertEquals(30f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- root.setDirection(YogaDirection.RTL);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1.getLayoutX(), 0.0f);
- assertEquals(30f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
- }
-
- @Test
- public void test_align_baseline_child() {
- final YogaNode root = new YogaNode();
- root.setFlexDirection(YogaFlexDirection.ROW);
- root.setAlignItems(YogaAlign.BASELINE);
- root.setWidth(100f);
- root.setHeight(100f);
-
- final YogaNode root_child0 = new YogaNode();
- root_child0.setWidth(50f);
- root_child0.setHeight(50f);
- root.addChildAt(root_child0, 0);
-
- final YogaNode root_child1 = new YogaNode();
- root_child1.setWidth(50f);
- root_child1.setHeight(20f);
- root.addChildAt(root_child1, 1);
-
- final YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.setWidth(50f);
- root_child1_child0.setHeight(10f);
- root_child1.addChildAt(root_child1_child0, 0);
- root.setDirection(YogaDirection.LTR);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child1.getLayoutX(), 0.0f);
- assertEquals(40f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
-
- root.setDirection(YogaDirection.RTL);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1.getLayoutX(), 0.0f);
- assertEquals(40f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
- }
-
- @Test
- public void test_align_baseline_child_top() {
- final YogaNode root = new YogaNode();
- root.setFlexDirection(YogaFlexDirection.ROW);
- root.setAlignItems(YogaAlign.BASELINE);
- root.setWidth(100f);
- root.setHeight(100f);
-
- final YogaNode root_child0 = new YogaNode();
- root_child0.setPosition(YogaEdge.TOP, 10f);
- root_child0.setWidth(50f);
- root_child0.setHeight(50f);
- root.addChildAt(root_child0, 0);
-
- final YogaNode root_child1 = new YogaNode();
- root_child1.setWidth(50f);
- root_child1.setHeight(20f);
- root.addChildAt(root_child1, 1);
-
- final YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.setWidth(50f);
- root_child1_child0.setHeight(10f);
- root_child1.addChildAt(root_child1_child0, 0);
- root.setDirection(YogaDirection.LTR);
- root.calculateLayout();
-
- 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(10f, root_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child1.getLayoutX(), 0.0f);
- assertEquals(40f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
-
- root.setDirection(YogaDirection.RTL);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutX(), 0.0f);
- assertEquals(10f, root_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1.getLayoutX(), 0.0f);
- assertEquals(40f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
- }
-
- @Test
- public void test_align_baseline_child_top2() {
- final YogaNode root = new YogaNode();
- root.setFlexDirection(YogaFlexDirection.ROW);
- root.setAlignItems(YogaAlign.BASELINE);
- root.setWidth(100f);
- root.setHeight(100f);
-
- final YogaNode root_child0 = new YogaNode();
- root_child0.setWidth(50f);
- root_child0.setHeight(50f);
- root.addChildAt(root_child0, 0);
-
- final YogaNode root_child1 = new YogaNode();
- root_child1.setPosition(YogaEdge.TOP, 5f);
- root_child1.setWidth(50f);
- root_child1.setHeight(20f);
- root.addChildAt(root_child1, 1);
-
- final YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.setWidth(50f);
- root_child1_child0.setHeight(10f);
- root_child1.addChildAt(root_child1_child0, 0);
- root.setDirection(YogaDirection.LTR);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child1.getLayoutX(), 0.0f);
- assertEquals(45f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
-
- root.setDirection(YogaDirection.RTL);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1.getLayoutX(), 0.0f);
- assertEquals(45f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
- }
-
- @Test
- public void test_align_baseline_double_nested_child() {
- final YogaNode root = new YogaNode();
- root.setFlexDirection(YogaFlexDirection.ROW);
- root.setAlignItems(YogaAlign.BASELINE);
- root.setWidth(100f);
- root.setHeight(100f);
-
- final YogaNode root_child0 = new YogaNode();
- root_child0.setWidth(50f);
- root_child0.setHeight(50f);
- root.addChildAt(root_child0, 0);
-
- final YogaNode root_child0_child0 = new YogaNode();
- root_child0_child0.setWidth(50f);
- root_child0_child0.setHeight(20f);
- root_child0.addChildAt(root_child0_child0, 0);
-
- final YogaNode root_child1 = new YogaNode();
- root_child1.setWidth(50f);
- root_child1.setHeight(20f);
- root.addChildAt(root_child1, 1);
-
- final YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.setWidth(50f);
- root_child1_child0.setHeight(15f);
- root_child1.addChildAt(root_child1_child0, 0);
- root.setDirection(YogaDirection.LTR);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child1.getLayoutX(), 0.0f);
- assertEquals(5f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(15f, root_child1_child0.getLayoutHeight(), 0.0f);
-
- root.setDirection(YogaDirection.RTL);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1.getLayoutX(), 0.0f);
- assertEquals(5f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(15f, root_child1_child0.getLayoutHeight(), 0.0f);
- }
-
- @Test
- public void test_align_baseline_column() {
- final YogaNode root = new YogaNode();
- root.setAlignItems(YogaAlign.BASELINE);
- root.setWidth(100f);
- root.setHeight(100f);
-
- final YogaNode root_child0 = new YogaNode();
- root_child0.setWidth(50f);
- root_child0.setHeight(50f);
- root.addChildAt(root_child0, 0);
-
- final YogaNode root_child1 = new YogaNode();
- root_child1.setWidth(50f);
- root_child1.setHeight(20f);
- root.addChildAt(root_child1, 1);
- root.setDirection(YogaDirection.LTR);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1.getLayoutX(), 0.0f);
- assertEquals(50f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- root.setDirection(YogaDirection.RTL);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child1.getLayoutX(), 0.0f);
- assertEquals(50f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
- }
-
- @Test
- public void test_align_baseline_child_margin() {
- final YogaNode root = new YogaNode();
- root.setFlexDirection(YogaFlexDirection.ROW);
- root.setAlignItems(YogaAlign.BASELINE);
- root.setWidth(100f);
- root.setHeight(100f);
-
- final YogaNode root_child0 = new YogaNode();
- root_child0.setMargin(YogaEdge.LEFT, 5f);
- root_child0.setMargin(YogaEdge.TOP, 5f);
- root_child0.setMargin(YogaEdge.RIGHT, 5f);
- root_child0.setMargin(YogaEdge.BOTTOM, 5f);
- root_child0.setWidth(50f);
- root_child0.setHeight(50f);
- root.addChildAt(root_child0, 0);
-
- final YogaNode root_child1 = new YogaNode();
- root_child1.setWidth(50f);
- root_child1.setHeight(20f);
- root.addChildAt(root_child1, 1);
-
- final YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.setMargin(YogaEdge.LEFT, 1f);
- root_child1_child0.setMargin(YogaEdge.TOP, 1f);
- root_child1_child0.setMargin(YogaEdge.RIGHT, 1f);
- root_child1_child0.setMargin(YogaEdge.BOTTOM, 1f);
- root_child1_child0.setWidth(50f);
- root_child1_child0.setHeight(10f);
- root_child1.addChildAt(root_child1_child0, 0);
- root.setDirection(YogaDirection.LTR);
- root.calculateLayout();
-
- 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(5f, root_child0.getLayoutX(), 0.0f);
- assertEquals(5f, root_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(60f, root_child1.getLayoutX(), 0.0f);
- assertEquals(44f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(1f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(1f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
-
- root.setDirection(YogaDirection.RTL);
- root.calculateLayout();
-
- 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(45f, root_child0.getLayoutX(), 0.0f);
- assertEquals(5f, root_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(-10f, root_child1.getLayoutX(), 0.0f);
- assertEquals(44f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(-1f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(1f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
- }
-
- @Test
- public void test_align_baseline_multiline() {
- final YogaNode root = new YogaNode();
- root.setFlexDirection(YogaFlexDirection.ROW);
- root.setAlignItems(YogaAlign.BASELINE);
- root.setWrap(YogaWrap.WRAP);
- root.setWidth(100f);
- root.setHeight(100f);
-
- final YogaNode root_child0 = new YogaNode();
- root_child0.setWidth(50f);
- root_child0.setHeight(50f);
- root.addChildAt(root_child0, 0);
-
- final YogaNode root_child1 = new YogaNode();
- root_child1.setWidth(50f);
- root_child1.setHeight(20f);
- root.addChildAt(root_child1, 1);
-
- final YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.setWidth(50f);
- root_child1_child0.setHeight(10f);
- root_child1.addChildAt(root_child1_child0, 0);
-
- final YogaNode root_child2 = new YogaNode();
- root_child2.setWidth(50f);
- root_child2.setHeight(20f);
- root.addChildAt(root_child2, 2);
-
- final YogaNode root_child2_child0 = new YogaNode();
- root_child2_child0.setWidth(50f);
- root_child2_child0.setHeight(10f);
- root_child2.addChildAt(root_child2_child0, 0);
-
- final YogaNode root_child3 = new YogaNode();
- root_child3.setWidth(50f);
- root_child3.setHeight(50f);
- root.addChildAt(root_child3, 3);
- root.setDirection(YogaDirection.LTR);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child1.getLayoutX(), 0.0f);
- assertEquals(40f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child2.getLayoutX(), 0.0f);
- assertEquals(100f, root_child2.getLayoutY(), 0.0f);
- assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child3.getLayoutX(), 0.0f);
- assertEquals(60f, root_child3.getLayoutY(), 0.0f);
- assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child3.getLayoutHeight(), 0.0f);
-
- root.setDirection(YogaDirection.RTL);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1.getLayoutX(), 0.0f);
- assertEquals(40f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child2.getLayoutX(), 0.0f);
- assertEquals(100f, root_child2.getLayoutY(), 0.0f);
- assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child3.getLayoutX(), 0.0f);
- assertEquals(60f, root_child3.getLayoutY(), 0.0f);
- assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child3.getLayoutHeight(), 0.0f);
- }
-
- @Test
- public void test_align_baseline_self() {
- final YogaNode root = new YogaNode();
- root.setFlexDirection(YogaFlexDirection.ROW);
- root.setWidth(100f);
- root.setHeight(100f);
-
- final YogaNode root_child0 = new YogaNode();
- root_child0.setAlignSelf(YogaAlign.BASELINE);
- root_child0.setWidth(50f);
- root_child0.setHeight(50f);
- root.addChildAt(root_child0, 0);
-
- final YogaNode root_child1 = new YogaNode();
- root_child1.setAlignSelf(YogaAlign.BASELINE);
- root_child1.setWidth(50f);
- root_child1.setHeight(20f);
- root.addChildAt(root_child1, 1);
-
- final YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.setWidth(50f);
- root_child1_child0.setHeight(10f);
- root_child1.addChildAt(root_child1_child0, 0);
- root.setDirection(YogaDirection.LTR);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child1.getLayoutX(), 0.0f);
- assertEquals(40f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
-
- root.setDirection(YogaDirection.RTL);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1.getLayoutX(), 0.0f);
- assertEquals(40f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
- }
-
- @Test
- public void test_align_baseline_multiline_column() {
- final YogaNode root = new YogaNode();
- root.setAlignItems(YogaAlign.BASELINE);
- root.setWrap(YogaWrap.WRAP);
- root.setWidth(100f);
- root.setHeight(100f);
-
- final YogaNode root_child0 = new YogaNode();
- root_child0.setWidth(50f);
- root_child0.setHeight(50f);
- root.addChildAt(root_child0, 0);
-
- final YogaNode root_child1 = new YogaNode();
- root_child1.setWidth(50f);
- root_child1.setHeight(50f);
- root.addChildAt(root_child1, 1);
-
- final YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.setWidth(50f);
- root_child1_child0.setHeight(10f);
- root_child1.addChildAt(root_child1_child0, 0);
-
- final YogaNode root_child2 = new YogaNode();
- root_child2.setWidth(50f);
- root_child2.setHeight(20f);
- root.addChildAt(root_child2, 2);
-
- final YogaNode root_child2_child0 = new YogaNode();
- root_child2_child0.setWidth(50f);
- root_child2_child0.setHeight(10f);
- root_child2.addChildAt(root_child2_child0, 0);
-
- final YogaNode root_child3 = new YogaNode();
- root_child3.setWidth(50f);
- root_child3.setHeight(20f);
- root.addChildAt(root_child3, 3);
- root.setDirection(YogaDirection.LTR);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1.getLayoutX(), 0.0f);
- assertEquals(50f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child2.getLayoutX(), 0.0f);
- assertEquals(0f, root_child2.getLayoutY(), 0.0f);
- assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child3.getLayoutX(), 0.0f);
- assertEquals(20f, root_child3.getLayoutY(), 0.0f);
- assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child3.getLayoutHeight(), 0.0f);
-
- root.setDirection(YogaDirection.RTL);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child1.getLayoutX(), 0.0f);
- assertEquals(50f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child2.getLayoutX(), 0.0f);
- assertEquals(0f, root_child2.getLayoutY(), 0.0f);
- assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child3.getLayoutX(), 0.0f);
- assertEquals(20f, root_child3.getLayoutY(), 0.0f);
- assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child3.getLayoutHeight(), 0.0f);
- }
-
- @Test
- public void test_align_baseline_multiline_row_and_column() {
- final YogaNode root = new YogaNode();
- root.setFlexDirection(YogaFlexDirection.ROW);
- root.setAlignItems(YogaAlign.BASELINE);
- root.setWrap(YogaWrap.WRAP);
- root.setWidth(100f);
- root.setHeight(100f);
-
- final YogaNode root_child0 = new YogaNode();
- root_child0.setWidth(50f);
- root_child0.setHeight(50f);
- root.addChildAt(root_child0, 0);
-
- final YogaNode root_child1 = new YogaNode();
- root_child1.setWidth(50f);
- root_child1.setHeight(50f);
- root.addChildAt(root_child1, 1);
-
- final YogaNode root_child1_child0 = new YogaNode();
- root_child1_child0.setWidth(50f);
- root_child1_child0.setHeight(10f);
- root_child1.addChildAt(root_child1_child0, 0);
-
- final YogaNode root_child2 = new YogaNode();
- root_child2.setWidth(50f);
- root_child2.setHeight(20f);
- root.addChildAt(root_child2, 2);
-
- final YogaNode root_child2_child0 = new YogaNode();
- root_child2_child0.setWidth(50f);
- root_child2_child0.setHeight(10f);
- root_child2.addChildAt(root_child2_child0, 0);
-
- final YogaNode root_child3 = new YogaNode();
- root_child3.setWidth(50f);
- root_child3.setHeight(20f);
- root.addChildAt(root_child3, 3);
- root.setDirection(YogaDirection.LTR);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child1.getLayoutX(), 0.0f);
- assertEquals(40f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child2.getLayoutX(), 0.0f);
- assertEquals(100f, root_child2.getLayoutY(), 0.0f);
- assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child3.getLayoutX(), 0.0f);
- assertEquals(90f, root_child3.getLayoutY(), 0.0f);
- assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child3.getLayoutHeight(), 0.0f);
-
- root.setDirection(YogaDirection.RTL);
- root.calculateLayout();
-
- 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(50f, root_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1.getLayoutX(), 0.0f);
- assertEquals(40f, root_child1.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(50f, root_child2.getLayoutX(), 0.0f);
- assertEquals(100f, root_child2.getLayoutY(), 0.0f);
- assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f);
- assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f);
- assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f);
- assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f);
-
- assertEquals(0f, root_child3.getLayoutX(), 0.0f);
- assertEquals(90f, root_child3.getLayoutY(), 0.0f);
- assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
- assertEquals(20f, root_child3.getLayoutHeight(), 0.0f);
- }
-
-}
diff --git a/java/tests/com/facebook/yoga/YGAlignItemsTest.java b/java/tests/com/facebook/yoga/YGAlignItemsTest.java
index c7fd7a2a..339001b2 100644
--- a/java/tests/com/facebook/yoga/YGAlignItemsTest.java
+++ b/java/tests/com/facebook/yoga/YGAlignItemsTest.java
@@ -166,4 +166,825 @@ public class YGAlignItemsTest {
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
+ @Test
+ public void test_align_baseline() {
+ final YogaNode root = new YogaNode();
+ root.setFlexDirection(YogaFlexDirection.ROW);
+ root.setAlignItems(YogaAlign.BASELINE);
+ root.setWidth(100f);
+ root.setHeight(100f);
+
+ final YogaNode root_child0 = new YogaNode();
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = new YogaNode();
+ root_child1.setWidth(50f);
+ root_child1.setHeight(20f);
+ root.addChildAt(root_child1, 1);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(30f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(30f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_align_baseline_child() {
+ final YogaNode root = new YogaNode();
+ root.setFlexDirection(YogaFlexDirection.ROW);
+ root.setAlignItems(YogaAlign.BASELINE);
+ root.setWidth(100f);
+ root.setHeight(100f);
+
+ final YogaNode root_child0 = new YogaNode();
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = new YogaNode();
+ root_child1.setWidth(50f);
+ root_child1.setHeight(20f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.setWidth(50f);
+ root_child1_child0.setHeight(10f);
+ root_child1.addChildAt(root_child1_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(40f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(40f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_align_baseline_child_top() {
+ final YogaNode root = new YogaNode();
+ root.setFlexDirection(YogaFlexDirection.ROW);
+ root.setAlignItems(YogaAlign.BASELINE);
+ root.setWidth(100f);
+ root.setHeight(100f);
+
+ final YogaNode root_child0 = new YogaNode();
+ root_child0.setPosition(YogaEdge.TOP, 10f);
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = new YogaNode();
+ root_child1.setWidth(50f);
+ root_child1.setHeight(20f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.setWidth(50f);
+ root_child1_child0.setHeight(10f);
+ root_child1.addChildAt(root_child1_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout();
+
+ 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(10f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(40f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(40f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_align_baseline_child_top2() {
+ final YogaNode root = new YogaNode();
+ root.setFlexDirection(YogaFlexDirection.ROW);
+ root.setAlignItems(YogaAlign.BASELINE);
+ root.setWidth(100f);
+ root.setHeight(100f);
+
+ final YogaNode root_child0 = new YogaNode();
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = new YogaNode();
+ root_child1.setPosition(YogaEdge.TOP, 5f);
+ root_child1.setWidth(50f);
+ root_child1.setHeight(20f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.setWidth(50f);
+ root_child1_child0.setHeight(10f);
+ root_child1.addChildAt(root_child1_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(45f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(45f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_align_baseline_double_nested_child() {
+ final YogaNode root = new YogaNode();
+ root.setFlexDirection(YogaFlexDirection.ROW);
+ root.setAlignItems(YogaAlign.BASELINE);
+ root.setWidth(100f);
+ root.setHeight(100f);
+
+ final YogaNode root_child0 = new YogaNode();
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = new YogaNode();
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(20f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child1 = new YogaNode();
+ root_child1.setWidth(50f);
+ root_child1.setHeight(20f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.setWidth(50f);
+ root_child1_child0.setHeight(15f);
+ root_child1.addChildAt(root_child1_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(5f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(15f, root_child1_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(5f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(15f, root_child1_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_align_baseline_column() {
+ final YogaNode root = new YogaNode();
+ root.setAlignItems(YogaAlign.BASELINE);
+ root.setWidth(100f);
+ root.setHeight(100f);
+
+ final YogaNode root_child0 = new YogaNode();
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = new YogaNode();
+ root_child1.setWidth(50f);
+ root_child1.setHeight(20f);
+ root.addChildAt(root_child1, 1);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_align_baseline_child_margin() {
+ final YogaNode root = new YogaNode();
+ root.setFlexDirection(YogaFlexDirection.ROW);
+ root.setAlignItems(YogaAlign.BASELINE);
+ root.setWidth(100f);
+ root.setHeight(100f);
+
+ final YogaNode root_child0 = new YogaNode();
+ root_child0.setMargin(YogaEdge.LEFT, 5f);
+ root_child0.setMargin(YogaEdge.TOP, 5f);
+ root_child0.setMargin(YogaEdge.RIGHT, 5f);
+ root_child0.setMargin(YogaEdge.BOTTOM, 5f);
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = new YogaNode();
+ root_child1.setWidth(50f);
+ root_child1.setHeight(20f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.setMargin(YogaEdge.LEFT, 1f);
+ root_child1_child0.setMargin(YogaEdge.TOP, 1f);
+ root_child1_child0.setMargin(YogaEdge.RIGHT, 1f);
+ root_child1_child0.setMargin(YogaEdge.BOTTOM, 1f);
+ root_child1_child0.setWidth(50f);
+ root_child1_child0.setHeight(10f);
+ root_child1.addChildAt(root_child1_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout();
+
+ 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(5f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(5f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(60f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(44f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(1f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(1f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout();
+
+ 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(45f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(5f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(-10f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(44f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(-1f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(1f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_align_baseline_multiline() {
+ final YogaNode root = new YogaNode();
+ root.setFlexDirection(YogaFlexDirection.ROW);
+ root.setAlignItems(YogaAlign.BASELINE);
+ root.setWrap(YogaWrap.WRAP);
+ root.setWidth(100f);
+ root.setHeight(100f);
+
+ final YogaNode root_child0 = new YogaNode();
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = new YogaNode();
+ root_child1.setWidth(50f);
+ root_child1.setHeight(20f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.setWidth(50f);
+ root_child1_child0.setHeight(10f);
+ root_child1.addChildAt(root_child1_child0, 0);
+
+ final YogaNode root_child2 = new YogaNode();
+ root_child2.setWidth(50f);
+ root_child2.setHeight(20f);
+ root.addChildAt(root_child2, 2);
+
+ final YogaNode root_child2_child0 = new YogaNode();
+ root_child2_child0.setWidth(50f);
+ root_child2_child0.setHeight(10f);
+ root_child2.addChildAt(root_child2_child0, 0);
+
+ final YogaNode root_child3 = new YogaNode();
+ root_child3.setWidth(50f);
+ root_child3.setHeight(50f);
+ root.addChildAt(root_child3, 3);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(40f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child3.getLayoutX(), 0.0f);
+ assertEquals(60f, root_child3.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child3.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(40f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child3.getLayoutX(), 0.0f);
+ assertEquals(60f, root_child3.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child3.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_align_baseline_multiline_column() {
+ final YogaNode root = new YogaNode();
+ root.setAlignItems(YogaAlign.BASELINE);
+ root.setWrap(YogaWrap.WRAP);
+ root.setWidth(100f);
+ root.setHeight(100f);
+
+ final YogaNode root_child0 = new YogaNode();
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = new YogaNode();
+ root_child1.setWidth(50f);
+ root_child1.setHeight(50f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.setWidth(50f);
+ root_child1_child0.setHeight(10f);
+ root_child1.addChildAt(root_child1_child0, 0);
+
+ final YogaNode root_child2 = new YogaNode();
+ root_child2.setWidth(50f);
+ root_child2.setHeight(20f);
+ root.addChildAt(root_child2, 2);
+
+ final YogaNode root_child2_child0 = new YogaNode();
+ root_child2_child0.setWidth(50f);
+ root_child2_child0.setHeight(10f);
+ root_child2.addChildAt(root_child2_child0, 0);
+
+ final YogaNode root_child3 = new YogaNode();
+ root_child3.setWidth(50f);
+ root_child3.setHeight(20f);
+ root.addChildAt(root_child3, 3);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child3.getLayoutX(), 0.0f);
+ assertEquals(20f, root_child3.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child3.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child3.getLayoutX(), 0.0f);
+ assertEquals(20f, root_child3.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child3.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_align_baseline_multiline_row_and_column() {
+ final YogaNode root = new YogaNode();
+ root.setFlexDirection(YogaFlexDirection.ROW);
+ root.setAlignItems(YogaAlign.BASELINE);
+ root.setWrap(YogaWrap.WRAP);
+ root.setWidth(100f);
+ root.setHeight(100f);
+
+ final YogaNode root_child0 = new YogaNode();
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = new YogaNode();
+ root_child1.setWidth(50f);
+ root_child1.setHeight(50f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.setWidth(50f);
+ root_child1_child0.setHeight(10f);
+ root_child1.addChildAt(root_child1_child0, 0);
+
+ final YogaNode root_child2 = new YogaNode();
+ root_child2.setWidth(50f);
+ root_child2.setHeight(20f);
+ root.addChildAt(root_child2, 2);
+
+ final YogaNode root_child2_child0 = new YogaNode();
+ root_child2_child0.setWidth(50f);
+ root_child2_child0.setHeight(10f);
+ root_child2.addChildAt(root_child2_child0, 0);
+
+ final YogaNode root_child3 = new YogaNode();
+ root_child3.setWidth(50f);
+ root_child3.setHeight(20f);
+ root.addChildAt(root_child3, 3);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(40f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child3.getLayoutX(), 0.0f);
+ assertEquals(90f, root_child3.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child3.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(40f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child3.getLayoutX(), 0.0f);
+ assertEquals(90f, root_child3.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child3.getLayoutHeight(), 0.0f);
+ }
+
}
diff --git a/java/tests/com/facebook/yoga/YGAlignSelfTest.java b/java/tests/com/facebook/yoga/YGAlignSelfTest.java
index f8dc750b..006ae1f7 100644
--- a/java/tests/com/facebook/yoga/YGAlignSelfTest.java
+++ b/java/tests/com/facebook/yoga/YGAlignSelfTest.java
@@ -169,4 +169,74 @@ public class YGAlignSelfTest {
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
+ @Test
+ public void test_align_self_baseline() {
+ final YogaNode root = new YogaNode();
+ root.setFlexDirection(YogaFlexDirection.ROW);
+ root.setWidth(100f);
+ root.setHeight(100f);
+
+ final YogaNode root_child0 = new YogaNode();
+ root_child0.setAlignSelf(YogaAlign.BASELINE);
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = new YogaNode();
+ root_child1.setAlignSelf(YogaAlign.BASELINE);
+ root_child1.setWidth(50f);
+ root_child1.setHeight(20f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child1_child0 = new YogaNode();
+ root_child1_child0.setWidth(50f);
+ root_child1_child0.setHeight(10f);
+ root_child1.addChildAt(root_child1_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(40f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout();
+
+ 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(50f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(40f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
+ }
+
}
diff --git a/tests/YGAlignBaseline.cpp b/tests/YGAlignBaseline.cpp
deleted file mode 100644
index b6e85aac..00000000
--- a/tests/YGAlignBaseline.cpp
+++ /dev/null
@@ -1,893 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
- // @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignBaseline.html
-
-#include
-#include
-
-TEST(YogaTest, align_baseline) {
- const YGNodeRef root = YGNodeNew();
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignItems(root, YGAlignBaseline);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeStyleSetHeight(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 20);
- 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(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, 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(50, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- YGNodeFreeRecursive(root);
-}
-
-TEST(YogaTest, align_baseline_child) {
- const YGNodeRef root = YGNodeNew();
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignItems(root, YGAlignBaseline);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeStyleSetHeight(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 20);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child1_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1_child0, 50);
- YGNodeStyleSetHeight(root_child1_child0, 10);
- YGNodeInsertChild(root_child1, root_child1_child0, 0);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- YGNodeFreeRecursive(root);
-}
-
-TEST(YogaTest, align_baseline_child_top) {
- const YGNodeRef root = YGNodeNew();
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignItems(root, YGAlignBaseline);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNew();
- YGNodeStyleSetPosition(root_child0, YGEdgeTop, 10);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeStyleSetHeight(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 20);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child1_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1_child0, 50);
- YGNodeStyleSetHeight(root_child1_child0, 10);
- YGNodeInsertChild(root_child1, root_child1_child0, 0);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- YGNodeFreeRecursive(root);
-}
-
-TEST(YogaTest, align_baseline_child_top2) {
- const YGNodeRef root = YGNodeNew();
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignItems(root, YGAlignBaseline);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeStyleSetHeight(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNew();
- YGNodeStyleSetPosition(root_child1, YGEdgeTop, 5);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 20);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child1_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1_child0, 50);
- YGNodeStyleSetHeight(root_child1_child0, 10);
- YGNodeInsertChild(root_child1, root_child1_child0, 0);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- YGNodeFreeRecursive(root);
-}
-
-TEST(YogaTest, align_baseline_double_nested_child) {
- const YGNodeRef root = YGNodeNew();
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignItems(root, YGAlignBaseline);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeStyleSetHeight(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child0_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child0_child0, 50);
- YGNodeStyleSetHeight(root_child0_child0, 20);
- YGNodeInsertChild(root_child0, root_child0_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 20);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child1_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1_child0, 50);
- YGNodeStyleSetHeight(root_child1_child0, 15);
- YGNodeInsertChild(root_child1, root_child1_child0, 0);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(15, YGNodeLayoutGetHeight(root_child1_child0));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(15, YGNodeLayoutGetHeight(root_child1_child0));
-
- YGNodeFreeRecursive(root);
-}
-
-TEST(YogaTest, align_baseline_column) {
- const YGNodeRef root = YGNodeNew();
- YGNodeStyleSetAlignItems(root, YGAlignBaseline);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeStyleSetHeight(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 20);
- 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(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(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(50, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- YGNodeFreeRecursive(root);
-}
-
-TEST(YogaTest, align_baseline_child_margin) {
- const YGNodeRef root = YGNodeNew();
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignItems(root, YGAlignBaseline);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNew();
- YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 5);
- YGNodeStyleSetMargin(root_child0, YGEdgeTop, 5);
- YGNodeStyleSetMargin(root_child0, YGEdgeRight, 5);
- YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 5);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeStyleSetHeight(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 20);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child1_child0 = YGNodeNew();
- YGNodeStyleSetMargin(root_child1_child0, YGEdgeLeft, 1);
- YGNodeStyleSetMargin(root_child1_child0, YGEdgeTop, 1);
- YGNodeStyleSetMargin(root_child1_child0, YGEdgeRight, 1);
- YGNodeStyleSetMargin(root_child1_child0, YGEdgeBottom, 1);
- YGNodeStyleSetWidth(root_child1_child0, 50);
- YGNodeStyleSetHeight(root_child1_child0, 10);
- YGNodeInsertChild(root_child1, root_child1_child0, 0);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(5, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(44, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(1, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(1, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(45, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(44, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(-1, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(1, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- YGNodeFreeRecursive(root);
-}
-
-TEST(YogaTest, align_baseline_multiline) {
- const YGNodeRef root = YGNodeNew();
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignItems(root, YGAlignBaseline);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeStyleSetHeight(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 20);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child1_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1_child0, 50);
- YGNodeStyleSetHeight(root_child1_child0, 10);
- YGNodeInsertChild(root_child1, root_child1_child0, 0);
-
- const YGNodeRef root_child2 = YGNodeNew();
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeStyleSetHeight(root_child2, 20);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child2_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child2_child0, 50);
- YGNodeStyleSetHeight(root_child2_child0, 10);
- YGNodeInsertChild(root_child2, root_child2_child0, 0);
-
- const YGNodeRef root_child3 = YGNodeNew();
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeStyleSetHeight(root_child3, 50);
- YGNodeInsertChild(root, root_child3, 3);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child3));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child3));
-
- YGNodeFreeRecursive(root);
-}
-
-TEST(YogaTest, align_baseline_self) {
- const YGNodeRef root = YGNodeNew();
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNew();
- YGNodeStyleSetAlignSelf(root_child0, YGAlignBaseline);
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeStyleSetHeight(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNew();
- YGNodeStyleSetAlignSelf(root_child1, YGAlignBaseline);
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 20);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child1_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1_child0, 50);
- YGNodeStyleSetHeight(root_child1_child0, 10);
- YGNodeInsertChild(root_child1, root_child1_child0, 0);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- YGNodeFreeRecursive(root);
-}
-
-TEST(YogaTest, align_baseline_multiline_column) {
- const YGNodeRef root = YGNodeNew();
- YGNodeStyleSetAlignItems(root, YGAlignBaseline);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeStyleSetHeight(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 50);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child1_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1_child0, 50);
- YGNodeStyleSetHeight(root_child1_child0, 10);
- YGNodeInsertChild(root_child1, root_child1_child0, 0);
-
- const YGNodeRef root_child2 = YGNodeNew();
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeStyleSetHeight(root_child2, 20);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child2_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child2_child0, 50);
- YGNodeStyleSetHeight(root_child2_child0, 10);
- YGNodeInsertChild(root_child2, root_child2_child0, 0);
-
- const YGNodeRef root_child3 = YGNodeNew();
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeStyleSetHeight(root_child3, 20);
- YGNodeInsertChild(root, root_child3, 3);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child3));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child3));
-
- YGNodeFreeRecursive(root);
-}
-
-TEST(YogaTest, align_baseline_multiline_row_and_column) {
- const YGNodeRef root = YGNodeNew();
- YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
- YGNodeStyleSetAlignItems(root, YGAlignBaseline);
- YGNodeStyleSetFlexWrap(root, YGWrapWrap);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 100);
-
- const YGNodeRef root_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child0, 50);
- YGNodeStyleSetHeight(root_child0, 50);
- YGNodeInsertChild(root, root_child0, 0);
-
- const YGNodeRef root_child1 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1, 50);
- YGNodeStyleSetHeight(root_child1, 50);
- YGNodeInsertChild(root, root_child1, 1);
-
- const YGNodeRef root_child1_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child1_child0, 50);
- YGNodeStyleSetHeight(root_child1_child0, 10);
- YGNodeInsertChild(root_child1, root_child1_child0, 0);
-
- const YGNodeRef root_child2 = YGNodeNew();
- YGNodeStyleSetWidth(root_child2, 50);
- YGNodeStyleSetHeight(root_child2, 20);
- YGNodeInsertChild(root, root_child2, 2);
-
- const YGNodeRef root_child2_child0 = YGNodeNew();
- YGNodeStyleSetWidth(root_child2_child0, 50);
- YGNodeStyleSetHeight(root_child2_child0, 10);
- YGNodeInsertChild(root_child2, root_child2_child0, 0);
-
- const YGNodeRef root_child3 = YGNodeNew();
- YGNodeStyleSetWidth(root_child3, 50);
- YGNodeStyleSetHeight(root_child3, 20);
- YGNodeInsertChild(root, root_child3, 3);
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child3));
-
- YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
- ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
-
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
- ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child2));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child2));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2_child0));
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2_child0));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2_child0));
- ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2_child0));
-
- ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
- ASSERT_FLOAT_EQ(90, YGNodeLayoutGetTop(root_child3));
- ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
- ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child3));
-
- YGNodeFreeRecursive(root);
-}
diff --git a/tests/YGAlignItemsTest.cpp b/tests/YGAlignItemsTest.cpp
index e80ae1d4..884ec1bb 100644
--- a/tests/YGAlignItemsTest.cpp
+++ b/tests/YGAlignItemsTest.cpp
@@ -157,3 +157,814 @@ TEST(YogaTest, align_items_flex_end) {
YGNodeFreeRecursive(root);
}
+
+TEST(YogaTest, align_baseline) {
+ const YGNodeRef root = YGNodeNew();
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetAlignItems(root, YGAlignBaseline);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetHeight(root, 100);
+
+ const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 20);
+ 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(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, 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(50, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ YGNodeFreeRecursive(root);
+}
+
+TEST(YogaTest, align_baseline_child) {
+ const YGNodeRef root = YGNodeNew();
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetAlignItems(root, YGAlignBaseline);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetHeight(root, 100);
+
+ const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 20);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ const YGNodeRef root_child1_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1_child0, 50);
+ YGNodeStyleSetHeight(root_child1_child0, 10);
+ YGNodeInsertChild(root_child1, root_child1_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ YGNodeFreeRecursive(root);
+}
+
+TEST(YogaTest, align_baseline_child_top) {
+ const YGNodeRef root = YGNodeNew();
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetAlignItems(root, YGAlignBaseline);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetHeight(root, 100);
+
+ const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeStyleSetPosition(root_child0, YGEdgeTop, 10);
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 20);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ const YGNodeRef root_child1_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1_child0, 50);
+ YGNodeStyleSetHeight(root_child1_child0, 10);
+ YGNodeInsertChild(root_child1, root_child1_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ YGNodeFreeRecursive(root);
+}
+
+TEST(YogaTest, align_baseline_child_top2) {
+ const YGNodeRef root = YGNodeNew();
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetAlignItems(root, YGAlignBaseline);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetHeight(root, 100);
+
+ const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNew();
+ YGNodeStyleSetPosition(root_child1, YGEdgeTop, 5);
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 20);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ const YGNodeRef root_child1_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1_child0, 50);
+ YGNodeStyleSetHeight(root_child1_child0, 10);
+ YGNodeInsertChild(root_child1, root_child1_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ YGNodeFreeRecursive(root);
+}
+
+TEST(YogaTest, align_baseline_double_nested_child) {
+ const YGNodeRef root = YGNodeNew();
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetAlignItems(root, YGAlignBaseline);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetHeight(root, 100);
+
+ const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 20);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 20);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ const YGNodeRef root_child1_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1_child0, 50);
+ YGNodeStyleSetHeight(root_child1_child0, 15);
+ YGNodeInsertChild(root_child1, root_child1_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(15, YGNodeLayoutGetHeight(root_child1_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(15, YGNodeLayoutGetHeight(root_child1_child0));
+
+ YGNodeFreeRecursive(root);
+}
+
+TEST(YogaTest, align_baseline_column) {
+ const YGNodeRef root = YGNodeNew();
+ YGNodeStyleSetAlignItems(root, YGAlignBaseline);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetHeight(root, 100);
+
+ const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 20);
+ 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(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(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(50, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ YGNodeFreeRecursive(root);
+}
+
+TEST(YogaTest, align_baseline_child_margin) {
+ const YGNodeRef root = YGNodeNew();
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetAlignItems(root, YGAlignBaseline);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetHeight(root, 100);
+
+ const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 5);
+ YGNodeStyleSetMargin(root_child0, YGEdgeTop, 5);
+ YGNodeStyleSetMargin(root_child0, YGEdgeRight, 5);
+ YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 5);
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 20);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ const YGNodeRef root_child1_child0 = YGNodeNew();
+ YGNodeStyleSetMargin(root_child1_child0, YGEdgeLeft, 1);
+ YGNodeStyleSetMargin(root_child1_child0, YGEdgeTop, 1);
+ YGNodeStyleSetMargin(root_child1_child0, YGEdgeRight, 1);
+ YGNodeStyleSetMargin(root_child1_child0, YGEdgeBottom, 1);
+ YGNodeStyleSetWidth(root_child1_child0, 50);
+ YGNodeStyleSetHeight(root_child1_child0, 10);
+ YGNodeInsertChild(root_child1, root_child1_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(5, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(44, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(1, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(1, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(45, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(44, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(-1, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(1, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ YGNodeFreeRecursive(root);
+}
+
+TEST(YogaTest, align_baseline_multiline) {
+ const YGNodeRef root = YGNodeNew();
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetAlignItems(root, YGAlignBaseline);
+ YGNodeStyleSetFlexWrap(root, YGWrapWrap);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetHeight(root, 100);
+
+ const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 20);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ const YGNodeRef root_child1_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1_child0, 50);
+ YGNodeStyleSetHeight(root_child1_child0, 10);
+ YGNodeInsertChild(root_child1, root_child1_child0, 0);
+
+ const YGNodeRef root_child2 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child2, 50);
+ YGNodeStyleSetHeight(root_child2, 20);
+ YGNodeInsertChild(root, root_child2, 2);
+
+ const YGNodeRef root_child2_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child2_child0, 50);
+ YGNodeStyleSetHeight(root_child2_child0, 10);
+ YGNodeInsertChild(root_child2, root_child2_child0, 0);
+
+ const YGNodeRef root_child3 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child3, 50);
+ YGNodeStyleSetHeight(root_child3, 50);
+ YGNodeInsertChild(root, root_child3, 3);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child2));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
+ ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child3));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child3));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child2));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
+ ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child3));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child3));
+
+ YGNodeFreeRecursive(root);
+}
+
+TEST(YogaTest, align_baseline_multiline_column) {
+ const YGNodeRef root = YGNodeNew();
+ YGNodeStyleSetAlignItems(root, YGAlignBaseline);
+ YGNodeStyleSetFlexWrap(root, YGWrapWrap);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetHeight(root, 100);
+
+ const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 50);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ const YGNodeRef root_child1_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1_child0, 50);
+ YGNodeStyleSetHeight(root_child1_child0, 10);
+ YGNodeInsertChild(root_child1, root_child1_child0, 0);
+
+ const YGNodeRef root_child2 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child2, 50);
+ YGNodeStyleSetHeight(root_child2, 20);
+ YGNodeInsertChild(root, root_child2, 2);
+
+ const YGNodeRef root_child2_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child2_child0, 50);
+ YGNodeStyleSetHeight(root_child2_child0, 10);
+ YGNodeInsertChild(root_child2, root_child2_child0, 0);
+
+ const YGNodeRef root_child3 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child3, 50);
+ YGNodeStyleSetHeight(root_child3, 20);
+ YGNodeInsertChild(root, root_child3, 3);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child2));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child3));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child3));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child2));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child3));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child3));
+
+ YGNodeFreeRecursive(root);
+}
+
+TEST(YogaTest, align_baseline_multiline_row_and_column) {
+ const YGNodeRef root = YGNodeNew();
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetAlignItems(root, YGAlignBaseline);
+ YGNodeStyleSetFlexWrap(root, YGWrapWrap);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetHeight(root, 100);
+
+ const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 50);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ const YGNodeRef root_child1_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1_child0, 50);
+ YGNodeStyleSetHeight(root_child1_child0, 10);
+ YGNodeInsertChild(root_child1, root_child1_child0, 0);
+
+ const YGNodeRef root_child2 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child2, 50);
+ YGNodeStyleSetHeight(root_child2, 20);
+ YGNodeInsertChild(root, root_child2, 2);
+
+ const YGNodeRef root_child2_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child2_child0, 50);
+ YGNodeStyleSetHeight(root_child2_child0, 10);
+ YGNodeInsertChild(root_child2, root_child2_child0, 0);
+
+ const YGNodeRef root_child3 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child3, 50);
+ YGNodeStyleSetHeight(root_child3, 20);
+ YGNodeInsertChild(root, root_child3, 3);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child2));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetTop(root_child3));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child3));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child2));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetTop(root_child3));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child3));
+
+ YGNodeFreeRecursive(root);
+}
diff --git a/tests/YGAlignSelfTest.cpp b/tests/YGAlignSelfTest.cpp
index 436d78b4..79e3f89b 100644
--- a/tests/YGAlignSelfTest.cpp
+++ b/tests/YGAlignSelfTest.cpp
@@ -160,3 +160,72 @@ TEST(YogaTest, align_self_flex_end_override_flex_start) {
YGNodeFreeRecursive(root);
}
+
+TEST(YogaTest, align_self_baseline) {
+ const YGNodeRef root = YGNodeNew();
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetHeight(root, 100);
+
+ const YGNodeRef root_child0 = YGNodeNew();
+ YGNodeStyleSetAlignSelf(root_child0, YGAlignBaseline);
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNew();
+ YGNodeStyleSetAlignSelf(root_child1, YGAlignBaseline);
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 20);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ const YGNodeRef root_child1_child0 = YGNodeNew();
+ YGNodeStyleSetWidth(root_child1_child0, 50);
+ YGNodeStyleSetHeight(root_child1_child0, 10);
+ YGNodeInsertChild(root_child1, root_child1_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
+
+ YGNodeFreeRecursive(root);
+}
diff --git a/tests/YGAlignBaselineCustomTest.cpp b/tests/YGBaselineFuncTest.cpp
similarity index 100%
rename from tests/YGAlignBaselineCustomTest.cpp
rename to tests/YGBaselineFuncTest.cpp