Summary: This diff does two things - Clean up some of the generated code making the files smaller. - Add experiment support to generated tests allowing us to use gentest for things still being experimented with such as more compliant flex-basis behavior. Reviewed By: gkassabli Differential Revision: D4226734 fbshipit-source-id: 2cc1471c21883e8e326f16e7a8bb1a3657acd84b
179 lines
6.3 KiB
C#
179 lines
6.3 KiB
C#
/**
|
|
* 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/CSSLayoutAlignSelfTest.html
|
|
|
|
using System;
|
|
using NUnit.Framework;
|
|
|
|
namespace Facebook.CSSLayout
|
|
{
|
|
[TestFixture]
|
|
public class CSSLayoutAlignSelfTest
|
|
{
|
|
[Test]
|
|
public void Test_align_self_center()
|
|
{
|
|
CSSNode root = new CSSNode();
|
|
root.StyleWidth = 100f;
|
|
root.StyleHeight = 100f;
|
|
|
|
CSSNode root_child0 = new CSSNode();
|
|
root_child0.AlignSelf = CSSAlign.Center;
|
|
root_child0.StyleWidth = 10f;
|
|
root_child0.StyleHeight = 10f;
|
|
root.Insert(0, root_child0);
|
|
root.StyleDirection = CSSDirection.LTR;
|
|
root.CalculateLayout();
|
|
|
|
Assert.AreEqual(0f, root.LayoutX);
|
|
Assert.AreEqual(0f, root.LayoutY);
|
|
Assert.AreEqual(100f, root.LayoutWidth);
|
|
Assert.AreEqual(100f, root.LayoutHeight);
|
|
|
|
Assert.AreEqual(45f, root_child0.LayoutX);
|
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
|
Assert.AreEqual(10f, root_child0.LayoutWidth);
|
|
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
|
|
|
root.StyleDirection = CSSDirection.RTL;
|
|
root.CalculateLayout();
|
|
|
|
Assert.AreEqual(0f, root.LayoutX);
|
|
Assert.AreEqual(0f, root.LayoutY);
|
|
Assert.AreEqual(100f, root.LayoutWidth);
|
|
Assert.AreEqual(100f, root.LayoutHeight);
|
|
|
|
Assert.AreEqual(45f, root_child0.LayoutX);
|
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
|
Assert.AreEqual(10f, root_child0.LayoutWidth);
|
|
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
|
}
|
|
|
|
[Test]
|
|
public void Test_align_self_flex_end()
|
|
{
|
|
CSSNode root = new CSSNode();
|
|
root.StyleWidth = 100f;
|
|
root.StyleHeight = 100f;
|
|
|
|
CSSNode root_child0 = new CSSNode();
|
|
root_child0.AlignSelf = CSSAlign.FlexEnd;
|
|
root_child0.StyleWidth = 10f;
|
|
root_child0.StyleHeight = 10f;
|
|
root.Insert(0, root_child0);
|
|
root.StyleDirection = CSSDirection.LTR;
|
|
root.CalculateLayout();
|
|
|
|
Assert.AreEqual(0f, root.LayoutX);
|
|
Assert.AreEqual(0f, root.LayoutY);
|
|
Assert.AreEqual(100f, root.LayoutWidth);
|
|
Assert.AreEqual(100f, root.LayoutHeight);
|
|
|
|
Assert.AreEqual(90f, root_child0.LayoutX);
|
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
|
Assert.AreEqual(10f, root_child0.LayoutWidth);
|
|
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
|
|
|
root.StyleDirection = CSSDirection.RTL;
|
|
root.CalculateLayout();
|
|
|
|
Assert.AreEqual(0f, root.LayoutX);
|
|
Assert.AreEqual(0f, root.LayoutY);
|
|
Assert.AreEqual(100f, root.LayoutWidth);
|
|
Assert.AreEqual(100f, root.LayoutHeight);
|
|
|
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
|
Assert.AreEqual(10f, root_child0.LayoutWidth);
|
|
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
|
}
|
|
|
|
[Test]
|
|
public void Test_align_self_flex_start()
|
|
{
|
|
CSSNode root = new CSSNode();
|
|
root.StyleWidth = 100f;
|
|
root.StyleHeight = 100f;
|
|
|
|
CSSNode root_child0 = new CSSNode();
|
|
root_child0.AlignSelf = CSSAlign.FlexStart;
|
|
root_child0.StyleWidth = 10f;
|
|
root_child0.StyleHeight = 10f;
|
|
root.Insert(0, root_child0);
|
|
root.StyleDirection = CSSDirection.LTR;
|
|
root.CalculateLayout();
|
|
|
|
Assert.AreEqual(0f, root.LayoutX);
|
|
Assert.AreEqual(0f, root.LayoutY);
|
|
Assert.AreEqual(100f, root.LayoutWidth);
|
|
Assert.AreEqual(100f, root.LayoutHeight);
|
|
|
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
|
Assert.AreEqual(10f, root_child0.LayoutWidth);
|
|
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
|
|
|
root.StyleDirection = CSSDirection.RTL;
|
|
root.CalculateLayout();
|
|
|
|
Assert.AreEqual(0f, root.LayoutX);
|
|
Assert.AreEqual(0f, root.LayoutY);
|
|
Assert.AreEqual(100f, root.LayoutWidth);
|
|
Assert.AreEqual(100f, root.LayoutHeight);
|
|
|
|
Assert.AreEqual(90f, root_child0.LayoutX);
|
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
|
Assert.AreEqual(10f, root_child0.LayoutWidth);
|
|
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
|
}
|
|
|
|
[Test]
|
|
public void Test_align_self_flex_end_override_flex_start()
|
|
{
|
|
CSSNode root = new CSSNode();
|
|
root.AlignItems = CSSAlign.FlexStart;
|
|
root.StyleWidth = 100f;
|
|
root.StyleHeight = 100f;
|
|
|
|
CSSNode root_child0 = new CSSNode();
|
|
root_child0.AlignSelf = CSSAlign.FlexEnd;
|
|
root_child0.StyleWidth = 10f;
|
|
root_child0.StyleHeight = 10f;
|
|
root.Insert(0, root_child0);
|
|
root.StyleDirection = CSSDirection.LTR;
|
|
root.CalculateLayout();
|
|
|
|
Assert.AreEqual(0f, root.LayoutX);
|
|
Assert.AreEqual(0f, root.LayoutY);
|
|
Assert.AreEqual(100f, root.LayoutWidth);
|
|
Assert.AreEqual(100f, root.LayoutHeight);
|
|
|
|
Assert.AreEqual(90f, root_child0.LayoutX);
|
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
|
Assert.AreEqual(10f, root_child0.LayoutWidth);
|
|
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
|
|
|
root.StyleDirection = CSSDirection.RTL;
|
|
root.CalculateLayout();
|
|
|
|
Assert.AreEqual(0f, root.LayoutX);
|
|
Assert.AreEqual(0f, root.LayoutY);
|
|
Assert.AreEqual(100f, root.LayoutWidth);
|
|
Assert.AreEqual(100f, root.LayoutHeight);
|
|
|
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
|
Assert.AreEqual(10f, root_child0.LayoutWidth);
|
|
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
|
}
|
|
|
|
}
|
|
}
|