Beispiel #1
0
        public void exactly_measure_stretched_child_row()
        {
            _MeasureConstraintList constraintList = new _MeasureConstraintList();

            YGNode root = YGNodeNew();

            YGNodeStyleSetFlexDirection(root, YGFlexDirection.Row);
            YGNodeStyleSetWidth(root, 100);
            YGNodeStyleSetHeight(root, 100);

            YGNode root_child0 = YGNodeNew();

            //  root_child0.setContext(&constraintList);
            root_child0.setContext(constraintList);
            root_child0.setMeasureFunc(_measure);
            YGNodeInsertChild(root, root_child0, 0);

            YGNodeCalculateLayout(root, YGValue.YGUndefined, YGValue.YGUndefined, YGDirection.LTR);

            Assert.AreEqual(1, constraintList.Count);

            Assert.AreEqual(100, constraintList[0].height);
            Assert.AreEqual(YGMeasureMode.Exactly, constraintList[0].heightMode);

            // free(constraintList.constraints);
        }
Beispiel #2
0
        public void flex_child_with_flex_basis()
        {
            var constraintList = new _MeasureConstraintList();

            YGNode root = YGNodeNew();

            YGNodeStyleSetHeight(root, 100);

            YGNode root_child0 = YGNodeNew();

            YGNodeStyleSetFlexGrow(root_child0, 1);
            YGNodeStyleSetFlexBasis(root_child0, 0);
            root_child0.setContext(constraintList);
            root_child0.setMeasureFunc(_measure);
            YGNodeInsertChild(root, root_child0, 0);

            YGNodeCalculateLayout(root, YGValue.YGUndefined, YGValue.YGUndefined, YGDirection.LTR);

            Assert.AreEqual(1, constraintList.Count);

            Assert.AreEqual(100, constraintList[0].height);
            Assert.AreEqual(YGMeasureMode.Exactly, constraintList[0].heightMode);

            // free(constraintList.constraints);
        }
Beispiel #3
0
        public void overflow_scroll_row()
        {
            var constraintList = new _MeasureConstraintList();

            YGNode root = YGNodeNew();

            YGNodeStyleSetAlignItems(root, YGAlign.FlexStart);
            YGNodeStyleSetFlexDirection(root, YGFlexDirection.Row);
            YGNodeStyleSetOverflow(root, YGOverflow.Scroll);
            YGNodeStyleSetHeight(root, 100);
            YGNodeStyleSetWidth(root, 100);

            YGNode root_child0 = YGNodeNew();

            root_child0.setContext(constraintList);
            root_child0.setMeasureFunc(_measure);
            YGNodeInsertChild(root, root_child0, 0);

            YGNodeCalculateLayout(root, YGValue.YGUndefined, YGValue.YGUndefined, YGDirection.LTR);

            Assert.AreEqual(1, constraintList.Count);

            Assert.IsTrue(YogaIsUndefined(constraintList[0].width));
            Assert.AreEqual(YGMeasureMode.Undefined, constraintList[0].widthMode);

            Assert.AreEqual(100, constraintList[0].height);
            Assert.AreEqual(YGMeasureMode.AtMost, constraintList[0].heightMode);

            // free(constraintList.constraints);
        }
Beispiel #4
0
        public void at_most_main_axis_row()
        {
            var constraintList = new _MeasureConstraintList();

            YGNode root = YGNodeNew();

            YGNodeStyleSetFlexDirection(root, YGFlexDirection.Row);
            YGNodeStyleSetWidth(root, 100);
            YGNodeStyleSetHeight(root, 100);

            YGNode root_child0 = YGNodeNew();

            root_child0.setContext(constraintList);
            root_child0.setMeasureFunc(_measure);
            YGNodeInsertChild(root, root_child0, 0);

            YGNodeCalculateLayout(root, YGValue.YGUndefined, YGValue.YGUndefined, YGDirection.LTR);

            Assert.AreEqual(1, constraintList.Count);

            Assert.AreEqual(100, constraintList[0].width);
            Assert.AreEqual(YGMeasureMode.AtMost, constraintList[0].widthMode);

            // free(constraintList.constraints);
        }