private void TestClearWithChildDestructorForGC(YogaNode parent, int instanceCount) { YogaNode child = new YogaNode(); Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); parent.Insert(0, child); }
private void TestDestructorForGC(int instanceCount) { YogaNode node = new YogaNode(); Assert.IsNotNull(node); Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); node = null; }
public void TestDestructorWithChildren() { ForceGC(); int instanceCount = YogaNode.GetInstanceCount(); TestDestructorWithChildrenForGC1(instanceCount); ForceGC(); Assert.AreEqual(instanceCount, YogaNode.GetInstanceCount()); }
public void TestReset() { int instanceCount = YogaNode.GetInstanceCount(); YogaNode node = new YogaNode(); Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); node.Reset(); Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); }
public void TestMeasureFuncWithDestructor() { ForceGC(); int instanceCount = YogaNode.GetInstanceCount(); YogaNode parent = new YogaNode(); Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); TestMeasureFuncWithDestructorForGC(parent); ForceGC(); Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount()); parent.CalculateLayout(); Assert.AreEqual(120, (int)parent.LayoutWidth); Assert.AreEqual(130, (int)parent.LayoutHeight); }
public void TestParentDestructor() { ForceGC(); int instanceCount = YogaNode.GetInstanceCount(); YogaNode child = new YogaNode(); Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); TestParentDestructorForGC(child, instanceCount + 1); ForceGC(); Assert.IsNull(child.Parent); Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); }
public void TestClearWithChildDestructor() { ForceGC(); int instanceCount = YogaNode.GetInstanceCount(); YogaNode node = new YogaNode(); Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); TestClearWithChildDestructorForGC(node, instanceCount + 1); ForceGC(); Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount()); node.Clear(); Assert.AreEqual(0, node.Count); ForceGC(); Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); }
private void TestDestructorWithChildrenForGC1(int instanceCount) { YogaNode node = new YogaNode(); Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); TestDestructorWithChildrenForGC2(node, instanceCount + 1); ForceGC(); Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount()); TestDestructorWithChildrenForGC2(node, instanceCount + 2); ForceGC(); Assert.AreEqual(instanceCount + 3, YogaNode.GetInstanceCount()); node = null; }
public void TestClear() { int instanceCount = YogaNode.GetInstanceCount(); YogaNode parent = new YogaNode(); Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); YogaNode child = new YogaNode(); Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount()); parent.Insert(0, child); Assert.AreEqual(1, parent.Count); Assert.AreEqual(parent, child.Parent); parent.Clear(); Assert.AreEqual(0, parent.Count); Assert.IsNull(child.Parent); Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount()); }