public void exactly_measure_stretched_child_row() { MeasureConstraintList constraintList = new MeasureConstraintList(); YogaNode root = YGNodeNew(); YGNodeStyleSetFlexDirection(root, FlexDirection.Row); YGNodeStyleSetWidth(root, 100); YGNodeStyleSetHeight(root, 100); YogaNode rootChild0 = YGNodeNew(); // root_child0.Context = &constraintList); rootChild0.Context = constraintList; YGNodeSetMeasureFunc(rootChild0, _measure); YGNodeInsertChild(root, rootChild0, 0); YGNodeCalculateLayout(root, YogaValue.YGUndefined, YogaValue.YGUndefined, Direction.LTR); Assert.AreEqual(1, constraintList.Count); Assert.AreEqual(100, constraintList[0].Height); Assert.AreEqual(MeasureMode.Exactly, constraintList[0].HeightMode); // free(constraintList.constraints); }
public void overflow_scroll_row() { var constraintList = new MeasureConstraintList(); YogaNode root = YGNodeNew(); YGNodeStyleSetAlignItems(root, YogaAlign.FlexStart); YGNodeStyleSetFlexDirection(root, FlexDirection.Row); YGNodeStyleSetOverflow(root, Overflow.Scroll); YGNodeStyleSetHeight(root, 100); YGNodeStyleSetWidth(root, 100); YogaNode rootChild0 = YGNodeNew(); rootChild0.Context = constraintList; YGNodeSetMeasureFunc(rootChild0, _measure); YGNodeInsertChild(root, rootChild0, 0); YGNodeCalculateLayout(root, YogaValue.YGUndefined, YogaValue.YGUndefined, Direction.LTR); Assert.AreEqual(1, constraintList.Count); Assert.IsTrue(constraintList[0].Width.IsUndefined()); Assert.AreEqual(MeasureMode.Undefined, constraintList[0].WidthMode); Assert.AreEqual(100, constraintList[0].Height); Assert.AreEqual(MeasureMode.AtMost, constraintList[0].HeightMode); // free(constraintList.constraints); }
public void flex_child_with_flex_basis() { var constraintList = new MeasureConstraintList(); YogaNode root = YGNodeNew(); YGNodeStyleSetHeight(root, 100); YogaNode rootChild0 = YGNodeNew(); YGNodeStyleSetFlexGrow(rootChild0, 1); YGNodeStyleSetFlexBasis(rootChild0, 0); rootChild0.Context = constraintList; YGNodeSetMeasureFunc(rootChild0, _measure); YGNodeInsertChild(root, rootChild0, 0); YGNodeCalculateLayout(root, YogaValue.YGUndefined, YogaValue.YGUndefined, Direction.LTR); Assert.AreEqual(1, constraintList.Count); Assert.AreEqual(100, constraintList[0].Height); Assert.AreEqual(MeasureMode.Exactly, constraintList[0].HeightMode); // free(constraintList.constraints); }
public void at_most_main_axis_row() { var constraintList = new MeasureConstraintList(); YogaNode root = YGNodeNew(); YGNodeStyleSetFlexDirection(root, FlexDirection.Row); YGNodeStyleSetWidth(root, 100); YGNodeStyleSetHeight(root, 100); YogaNode rootChild0 = YGNodeNew(); rootChild0.Context = constraintList; YGNodeSetMeasureFunc(rootChild0, _measure); YGNodeInsertChild(root, rootChild0, 0); YGNodeCalculateLayout(root, YogaValue.YGUndefined, YogaValue.YGUndefined, Direction.LTR); Assert.AreEqual(1, constraintList.Count); Assert.AreEqual(100, constraintList[0].Width); Assert.AreEqual(MeasureMode.AtMost, constraintList[0].WidthMode); // free(constraintList.constraints); }
public void at_most_cross_axis_column() { var constraintList = new MeasureConstraintList(); YogaNode rootChild0; YogaNode root = Node(alignItems: YogaAlign.FlexStart, width: 100, height: 100) .Add(rootChild0 = Node(measureFunc: _measure)); rootChild0.Context = constraintList; YogaArrange.CalculateLayout(root, YogaValue.YGUndefined, YogaValue.YGUndefined, Direction.LTR); Assert.AreEqual(1, constraintList.Count); Assert.AreEqual(100, constraintList[0].Width); Assert.AreEqual(MeasureMode.AtMost, constraintList[0].WidthMode); }
public void exactly_measure_stretched_child_row() { MeasureConstraintList constraintList = new MeasureConstraintList(); YogaNode rootChild0; YogaNode root = Node(flexDirection: FlexDirection.Row, width: 100, height: 100) .Add(rootChild0 = Node(measureFunc: _measure)); rootChild0.Context = constraintList; YogaArrange.CalculateLayout(root, YogaValue.YGUndefined, YogaValue.YGUndefined, Direction.LTR); Assert.AreEqual(1, constraintList.Count); Assert.AreEqual(100, constraintList[0].Height); Assert.AreEqual(MeasureMode.Exactly, constraintList[0].HeightMode); }
public void flex_child_with_flex_basis() { var constraintList = new MeasureConstraintList(); YogaNode rootChild0; YogaNode root = Node(height: 100) .Add(rootChild0 = Node(flexGrow: 1, flexBasis: 0, measureFunc: _measure)); rootChild0.Context = constraintList; YogaArrange.CalculateLayout(root, YogaValue.YGUndefined, YogaValue.YGUndefined, Direction.LTR); Assert.AreEqual(1, constraintList.Count); Assert.AreEqual(100, constraintList[0].Height); Assert.AreEqual(MeasureMode.Exactly, constraintList[0].HeightMode); }
public void overflow_scroll_row() { var constraintList = new MeasureConstraintList(); YogaNode rootChild0; YogaNode root = Node(alignItems: YogaAlign.FlexStart, flexDirection: FlexDirection.Row, overflow: Overflow.Scroll, width: 100, height: 100) .Add(rootChild0 = Node(measureFunc: _measure)); rootChild0.Context = constraintList; YogaArrange.CalculateLayout(root, YogaValue.YGUndefined, YogaValue.YGUndefined, Direction.LTR); Assert.AreEqual(1, constraintList.Count); Assert.IsTrue(constraintList[0].Width.IsUndefined()); Assert.AreEqual(MeasureMode.Undefined, constraintList[0].WidthMode); Assert.AreEqual(100, constraintList[0].Height); Assert.AreEqual(MeasureMode.AtMost, constraintList[0].HeightMode); }