2017-02-03 05:37:45 -08:00
|
|
|
/**
|
2018-09-11 15:27:47 -07:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2017-02-03 05:37:45 -08:00
|
|
|
*
|
2018-02-16 18:24:55 -08:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2017-02-03 05:37:45 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
namespace Facebook.Yoga
|
|
|
|
{
|
|
|
|
[TestFixture]
|
|
|
|
public class YGDimensionTest
|
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void Test_wrap_child()
|
|
|
|
{
|
2017-03-01 09:19:55 -08:00
|
|
|
YogaConfig config = new YogaConfig();
|
2017-02-03 05:37:45 -08:00
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
YogaNode root = new YogaNode(config);
|
|
|
|
|
|
|
|
YogaNode root_child0 = new YogaNode(config);
|
2017-02-03 05:37:45 -08:00
|
|
|
root_child0.Width = 100;
|
|
|
|
root_child0.Height = 100;
|
|
|
|
root.Insert(0, root_child0);
|
|
|
|
root.StyleDirection = YogaDirection.LTR;
|
|
|
|
root.CalculateLayout();
|
|
|
|
|
|
|
|
Assert.AreEqual(0f, root.LayoutX);
|
|
|
|
Assert.AreEqual(0f, root.LayoutY);
|
|
|
|
Assert.AreEqual(100f, root.LayoutWidth);
|
|
|
|
Assert.AreEqual(100f, root.LayoutHeight);
|
|
|
|
|
|
|
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
|
|
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
|
|
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
|
|
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
|
|
|
|
|
|
|
root.StyleDirection = YogaDirection.RTL;
|
|
|
|
root.CalculateLayout();
|
|
|
|
|
|
|
|
Assert.AreEqual(0f, root.LayoutX);
|
|
|
|
Assert.AreEqual(0f, root.LayoutY);
|
|
|
|
Assert.AreEqual(100f, root.LayoutWidth);
|
|
|
|
Assert.AreEqual(100f, root.LayoutHeight);
|
|
|
|
|
|
|
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
|
|
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
|
|
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
|
|
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Test_wrap_grandchild()
|
|
|
|
{
|
2017-03-01 09:19:55 -08:00
|
|
|
YogaConfig config = new YogaConfig();
|
|
|
|
|
|
|
|
YogaNode root = new YogaNode(config);
|
2017-02-03 05:37:45 -08:00
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
YogaNode root_child0 = new YogaNode(config);
|
2017-02-03 05:37:45 -08:00
|
|
|
root.Insert(0, root_child0);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
YogaNode root_child0_child0 = new YogaNode(config);
|
2017-02-03 05:37:45 -08:00
|
|
|
root_child0_child0.Width = 100;
|
|
|
|
root_child0_child0.Height = 100;
|
|
|
|
root_child0.Insert(0, root_child0_child0);
|
|
|
|
root.StyleDirection = YogaDirection.LTR;
|
|
|
|
root.CalculateLayout();
|
|
|
|
|
|
|
|
Assert.AreEqual(0f, root.LayoutX);
|
|
|
|
Assert.AreEqual(0f, root.LayoutY);
|
|
|
|
Assert.AreEqual(100f, root.LayoutWidth);
|
|
|
|
Assert.AreEqual(100f, root.LayoutHeight);
|
|
|
|
|
|
|
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
|
|
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
|
|
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
|
|
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
|
|
|
|
|
|
|
Assert.AreEqual(0f, root_child0_child0.LayoutX);
|
|
|
|
Assert.AreEqual(0f, root_child0_child0.LayoutY);
|
|
|
|
Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
|
|
|
|
Assert.AreEqual(100f, root_child0_child0.LayoutHeight);
|
|
|
|
|
|
|
|
root.StyleDirection = YogaDirection.RTL;
|
|
|
|
root.CalculateLayout();
|
|
|
|
|
|
|
|
Assert.AreEqual(0f, root.LayoutX);
|
|
|
|
Assert.AreEqual(0f, root.LayoutY);
|
|
|
|
Assert.AreEqual(100f, root.LayoutWidth);
|
|
|
|
Assert.AreEqual(100f, root.LayoutHeight);
|
|
|
|
|
|
|
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
|
|
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
|
|
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
|
|
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
|
|
|
|
|
|
|
Assert.AreEqual(0f, root_child0_child0.LayoutX);
|
|
|
|
Assert.AreEqual(0f, root_child0_child0.LayoutY);
|
|
|
|
Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
|
|
|
|
Assert.AreEqual(100f, root_child0_child0.LayoutHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|