private void TestMeasureFuncWithDestructorForGC(YogaNode parent) { YogaNode child = new YogaNode(); parent.Insert(0, child); child.SetMeasureFunction((_, width, widthMode, height, heightMode) => { return(MeasureOutput.Make(120, 130)); }); }
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)); }
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); }
public void TestMeasureFuncWithFloat() { YogaNode node = new YogaNode(); node.SetMeasureFunction((_, width, widthMode, height, heightMode) => { return(MeasureOutput.Make(123.4f, 81.7f)); }); node.CalculateLayout(); Assert.AreEqual(124.0f, node.LayoutWidth); Assert.AreEqual(82.0f, node.LayoutHeight); node = new YogaNode(new YogaConfig { PointScaleFactor = 0 }); 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); }