Exemplo n.º 1
0
        private void TestMeasureFuncWithDestructorForGC(YogaNode parent)
        {
            YogaNode child = new YogaNode();

            parent.Insert(0, child);
            child.SetMeasureFunction((_, width, widthMode, height, heightMode) => {
                return(MeasureOutput.Make(120, 130));
            });
        }
Exemplo n.º 2
0
        public void TestMeasureFuncWithChild()
        {
            YogaNode node  = new YogaNode();
            YogaNode child = new YogaNode();

            node.Insert(0, child);
            node.SetMeasureFunction((_, width, widthMode, height, heightMode) => {
                return(MeasureOutput.Make(100, 150));
            });
        }
Exemplo n.º 3
0
        public void TestMeasureFunc()
        {
            YogaNode node = new YogaNode();

            node.SetMeasureFunction((_, width, widthMode, height, heightMode) => {
                return(MeasureOutput.Make(100, 150));
            });
            node.CalculateLayout();
            Assert.AreEqual(100, node.LayoutWidth);
            Assert.AreEqual(150, node.LayoutHeight);
        }
Exemplo n.º 4
0
        public void TestMeasureFuncWithFloat()
        {
            YogaNode node = new YogaNode();

            node.SetMeasureFunction((_, width, widthMode, height, heightMode) => {
                return(MeasureOutput.Make(123.4f, 81.7f));
            });
            node.CalculateLayout();
            Assert.AreEqual(123.4f, node.LayoutWidth);
            Assert.AreEqual(81.7f, node.LayoutHeight);
        }
Exemplo n.º 5
0
        public void TestChildWithMeasureFunc()
        {
            YogaNode node = new YogaNode();

            node.SetMeasureFunction((_, width, widthMode, height, heightMode) => {
                return(MeasureOutput.Make(100, 150));
            });
            YogaNode child = new YogaNode();

            Assert.Throws <InvalidOperationException>(() => node.Insert(0, child));
        }